Skip to content

Promisified version of auth0/node-jwks-rsa, retrieve RSA public keys from a JWKS endpoint

License

Notifications You must be signed in to change notification settings

aneilbaboo/node-jwks-rsa-promisified

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jwks-rsa-promisified

Add promisified methods to auth0/node-jwks-rsa

Install

npm install jwks-rsa-promisified

Example

const jwksClient = require('jwks-rsa-promisified');

const client = jwksClient({
  strictSsl: true, // Default value
  jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json'
});

async function retrieveKey() {
  const kid = 'RkI5MjI5OUY5ODc1N0Q4QzM0OUYzNkVGMTJDOUEzQkFCOTU3NjE2Rg';
  const key = await client.getSigningKeyAsync(kid);
  return key.publicKey || key.rsaPublicKey;
}

Additional methods

// type Jwk {
//   kid: string;
//   nbf?: number;
//   publicKey?: string;
//   rsaPublicKey?: string;
// }
client.getSigningKeyAsync(key); // => Promise<Jwk>
client.getSigningKeysAsync(); // => Promise<Jwk[]>
client.getKey(); // => Promise<Jwk>

About

Promisified version of auth0/node-jwks-rsa, retrieve RSA public keys from a JWKS endpoint

Resources

License

Stars

Watchers

Forks

Packages

No packages published