3.0.21 • Published 1 year ago
@chatpta/auth-util v3.0.21
Auth utilities class
Main Functionality
This is a collection of utility functions for use in authentication
Main functions
const { jwtUtilAuth, pwdUtilAuth } = require( '@chatpta/auth-util' );
Create jwt
const headerObject = {
alg: "SHA256", // Mendatory acceptable algorithm
...
};
const payloadObject = {
...
};
const jwt = jwtUtilAuth.createSignedJwtFromObject( headerObject, payloadObject, privateKey );
Verify jwt signature returns true
or false
const isVerified = jwtUtilAuth.verifyJwtSignature( jwt, publicKey );
Get header and payload object from jwt.
const { header, payload } = jwtUtilAuth.getHeaderPayloadFromJwt( jwt );
Create password hash to save in database
const hash = pwdUtilAuth.createPasswordHashWithRandomSalt( password, secret, algorithm );
Create another password hash based on saved hash to compare.
const hashForLogin = pwdUtilAuth.createPasswordHashBasedOnSavedAlgorithmSalt( passwordForLogin, savedPasswordHash, secret );
3.0.21
1 year ago
3.0.2
1 year ago
3.0.20
1 year ago
3.0.1
2 years ago
3.0.0
2 years ago
2.1.1
2 years ago
2.1.3
2 years ago
2.1.7
2 years ago
2.1.0
2 years ago
2.0.11
2 years ago
2.0.10
2 years ago
2.0.9
2 years ago
2.0.8
2 years ago
2.0.7
2 years ago
2.0.6
2 years ago
2.0.5
2 years ago
2.0.4
2 years ago
2.0.3
2 years ago
2.0.2
2 years ago
2.0.1
2 years ago
2.0.0
2 years ago