@chatpta/jwt-read
v3.0.23
Published
Auth utility functions
Downloads
34
Readme
Jwt read utility
Main Functionality
This is a collection of jwt reading functions.
Main functions
const jwtReader = require( '@chatpta/jwt-read' );
Read jwt
const jwtMiddleware = jwtReader.verifyJwtAndRole( "admin", publicKey, jwtReader.throwUsedTokenError );
await jwtMiddleware( req, res, next );
Following the above req.jwt
contains
{
header: {
alg:...
}
,
payload: {
...
}
}