jwt-core
v1.1.0
Published
use simple jwt
Downloads
1,526
Readme
JWT Core
You can simply use jwt
This project was created to make using jsonwebtoken
easier.
Most features can be used the same as jsonwebtoken
Install
$ npm i jwt-core
Usage
Create Token By Payload
const jwt = require('jwt-core')
const token = new jwt.Token(payload);
payload
is samejsonwebtoken
you also use create method
const jwt = require('jwt-core')
const token = jwt.Token.createByPayload(payload);
payload
is samejsonwebtoken
Create Token By Aliased Payload
const jwt = require('jwt-core')
const token = jwt.Token.createByAliasPayload(payload);
you can use claim key by aliased key
{ issuer: 'iss', subject: 'sub', audience: 'aud', expiresIn: 'exp', notBefore: 'nbf', issuedAt: 'iat', jwtId: 'jti', }
payload
is samejsonwebtoken
Create Token By Encoding Token
const jwt = require('jwt-core')
const token = jwt.Token.createByEncodingToken(jwtString, secretOrPrivateKey, options);
options
is samejsonwebtoken
Encode Token
token.encode(secretOrPrivateKey, options);
options
is samejsonwebtoken
Get And Set Token Claim
Get
token.get(key);
- Alias is applied
Set
token.set(key, value);
- Alias is applied