jwks-rsa-promisified
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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>

Readme

Keywords

none

Package Sidebar

Install

npm i jwks-rsa-promisified

Weekly Downloads

194

Version

1.0.2

License

MIT

Unpacked Size

19.7 kB

Total Files

6

Last publish

Collaborators

  • aneilbaboo