0.2.0 • Published 4 years ago

jwt-keysource v0.2.0

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

jwt-keysource

npm

(Work In Progress)

A library to provide keys for JWT verification.

npm install --save jwt-keysource

Example

var signingKeyUrls = [
    'https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com',
    'https://www.googleapis.com/oauth2/v1/certs'
];

/*
* For inclusion in middleware:
*
* Is a function taking arguments (req, header, payload, cb)
*/
var signingKeyProvider = require('jwt-keysource').buildKeyProvider(signingKeyUrls);


/*
 * Raw key source:
 * Exposes 'getVerificationKeys()' which returns a promise of keys JSON. 
 */
var UriKeySource = require('jwt-keysource').UriKeySource;
var myKeySource = new UriKeySource(/* URI to JSON of keys mapped by key ID*/)

Showing Trace Logs

To show trace logs you can set the following environment variable:

DEBUG=jwt-keysource

License

ISC

Acknowledgements