dorongrinstein-jwt-generator
v0.0.10
Published
Simple JWT generator
Downloads
5
Readme
dorongrinstein-jwt-generator is a small library that generates JWTs which are Base64Url encoded.
Installation
npm install dorongrinstein-jwt-generator [--save]
Usage
// make sure you have a private key *.pem file
// note that in lieu of a file name, you can provide the UTF-8 encoded private key string
// to the constructor below. It accepts either a file name or a string
let jwtGenerator = new (require('dorongrinstein-jwt-generator'))('./private_key.pem');
jwtGenerator.addClaim('name', 'doron');
jwtGenerator.addHeader('keyid', '1234'); // keyid is one special header that is valid. Not every header is acceptable
let token = jwtGenerator.make();
console.log(token); // you've got a token buddy, enjoy..
Author
License
This project is licensed under the MIT license. See the LICENSE file for more info.