Skip to content
Cutie extension for generating and validating JWT.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
build.js
index.js
package-lock.json
package.json
test.js

README.md

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.

You can’t perform that action at this time.