@cuties/jwt

1.0.4 • Public • Published

cutie-jwt

NPM Version Build Status codecov

Cutie extension for generating and validating JWT. It's based on the Async Tree Pattern.

Examples

You can find examples of using this library in the test directory.

Install

npm install @cuties/jwt

Run test

npm test

Run build

npm run build

Async objects

GeneratedHS256JWT(payload, secret[, minutesFromNow])

Generates JWT using HS256 algorithm. You can also use parameter minutesFromNow to set expiration time to payload(payload object will not be changed, it will be copied with set exp property).

IsHS256JWTValid(token, secret)

Validates token by secret. If it's valid this async object represents true, otherwise it represents false.

GeneratedRS256JWT(payload, privateKey[, minutesFromNow])

Generates JWT using RS256 algorithm. You can also use parameter minutesFromNow to set expiration time to payload(payload object will not be changed, it will be copied with set exp property).

IsRS256JWTValid(token, publicKey)

Validates token by publicKey. If it's valid this async object represents true, otherwise it represents false.

JWTOfRequest(request[, tokenName])

Retrieves JWT from Authorization header of incoming request parsing by tokenName(by default it's Bearer).

JWTPayload(token)

Retrieves payload from token.

JWTPayloadValue(token, key)

Retrieves payload value from token by key.

Readme

Keywords

Package Sidebar

Install

npm i @cuties/jwt

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

22.9 kB

Total Files

24

Last publish

Collaborators

  • guseyn