How to use the jose.JWKS.KeyStore 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 auth0 / express-openid-connect / lib / appSession.js View on Github external
module.exports = ({ name, secret, duration, cookieOptions = {} }) => {
  let current;

  const COOKIES = Symbol('cookies');
  const alg = 'dir';
  const enc = 'A256GCM';

  let keystore = new JWKS.KeyStore();

  if (!Array.isArray(secret)) {
    secret = [secret];
  }

  secret.forEach((secretString, i) => {
    const key = JWK.asKey(deriveKey(secretString));
    if (i === 0) {
      current = key;
    }
    keystore.add(key);
  });

  if (keystore.size === 1) {
    keystore = current;
  }

jose

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

MIT
Latest version published 20 days ago

Package Health Score

94 / 100
Full package analysis