Created
September 10, 2018 18:50
-
-
Save chatu/7738411c7e8dcf604bc5a0aad7937299 to your computer and use it in GitHub Desktop.
Convert JWKS cert to PEM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* If you wanted to use `n` and `e` from JWKS check out node-jwks-rsa's implementation: | |
* https://github.com/auth0/node-jwks-rsa/blob/master/src/utils.js#L35-L57 | |
*/ | |
export function certToPEM(cert) { | |
cert = cert.match(/.{1,64}/g).join('\n'); | |
cert = `-----BEGIN CERTIFICATE-----\n${cert}\n-----END CERTIFICATE-----\n`; | |
return cert; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment