fix: importing x5c in electron requires the input split

This commit is contained in:
Filip Skokan 2019-07-27 15:31:08 +02:00
parent 60efc06a93
commit 181fd0954e

View file

@ -56,7 +56,7 @@ class Key {
let publicKey
try {
publicKey = createPublicKey({
key: `-----BEGIN CERTIFICATE-----\n${cert}\n-----END CERTIFICATE-----`, format: 'pem'
key: `-----BEGIN CERTIFICATE-----\n${cert.match(/.{1,64}/g).join('\n')}\n-----END CERTIFICATE-----`, format: 'pem'
})
} catch (err) {
throw new errors.JWKInvalid(`\`x5c\` member at index ${i} is not a valid base64-encoded DER PKIX certificate`)