jwt-core

1.1.0 • Public • Published

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);

you also use create method

const jwt = require('jwt-core')
 
const token = jwt.Token.createByPayload(payload);

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 same jsonwebtoken

Create Token By Encoding Token

const jwt = require('jwt-core')
 
const token = jwt.Token.createByEncodingToken(jwtString, secretOrPrivateKey, options);

Encode Token

token.encode(secretOrPrivateKey, options);

Get And Set Token Claim

Get

token.get(key);
  • Alias is applied

Set

token.set(key, value);
  • Alias is applied

Readme

Keywords

Package Sidebar

Install

npm i jwt-core

Weekly Downloads

340

Version

1.1.0

License

MIT

Unpacked Size

7.49 kB

Total Files

14

Last publish

Collaborators

  • araxsiyual