Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

Cutie extension for generating and validating JWT.

Resources

License

Stars

Watchers

Forks

Packages

No packages published