@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
15 lines • 601 B
JavaScript
// TODO: fix jwt-simple types
import jwt from "jwt-simple";
const { encode, decode } = jwt;
export function encodeJwtToken(claim, jwtSecret, algorithm = "HS256") {
const token = encode(claim,
// Note: This type casting is required as even though jwt-simple accepts a buffer as a
// secret types definitions exposed by @types/jwt-simple only takes a string
jwtSecret, algorithm);
return token;
}
export function decodeJwtToken(token, jwtSecret, algorithm = "HS256") {
const claim = decode(token, jwtSecret, false, algorithm);
return claim;
}
//# sourceMappingURL=jwt.js.map