Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function initializeKeystore(jwks) {
if (isEqual(jwks, DEV_KEYSTORE)) {
/* eslint-disable no-multi-str */
attention.warn('a quick start development-only signing keys are used, you are expected to \
provide your own in configuration "jwks" property');
/* eslint-enable */
}
let keystore;
try {
keystore = JWKS.asKeyStore(jwks);
} catch (err) {
throw new Error('keystore must be a JSON Web Key Set formatted object');
}
if (!runtimeSupport.shake256 && keystore.get({ kty: 'OKP', crv: 'Ed448' })) {
throw new Error('Ed448 keys are only fully supported to sign ID Tokens with in node runtime >= 12.8.0');
}
if (keystore.get({ kty: 'EC', crv: 'secp256k1' }) && !instance(this).configuration('features.secp256k1.enabled')) {
throw new Error('`features.secp256k1` must be enabled before adding secp256k1 EC keys');
}
instance(this).keystore = keystore;
let warned;
for (const key of keystore) { // eslint-disable-line no-restricted-syntax
if (!warned && keystore.all({ kid: key.kid }).length > 1) {