Package used to create and verify JWT(JSON Web Token) that allows for verification of claims on resources also known as authorization. Used in the backend to create and verify the JWT, allowing access to required information from the database.
npm i @nuclear-packages/jwt-creator
From: https://www.npmjs.com/package/@nuclear-packages/jwt-creator
const JWT = require('@nuclear-packages');
const jwt = JWT.createJWTSHA256({
"name":"john",
"role":"admin"
},"coifodnfn1");
const verify = JWT.verifyJWTSHA256(jwt,"coifodnn1");
createJWTSHA256()
function requires a payload in the form of a JSON object containing information such as the name, username, email, resource role, etc, and a
secret code that could be the hashed password (salted hashed passwords work). Returns the jwt string as header.payload.signature with added information, encoded in base64url
and hashed using SHA-256 algorithm
verifyJWTSHA256()
function requires a jwt token as a string, and the secret code that could be the hashed password (salted hashed passwords work), and will verify if
the token is valid or not.
Pull requests are welcome for any changes. For major changes, first open an issue and then contribute