How to use the jose.JWKS.asKeyStore function in jose

To help you get started, we’ve selected a few jose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github panva / node-oidc-provider / lib / helpers / initialize_keystore.js View on Github external
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) {


JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes

Latest version published 16 days ago

Package Health Score

94 / 100
Full package analysis