0.18.0 • Published 4 years ago
jwt-ssm v0.18.0
jwt-ssm
Generate and verify JWT tokens with AWS SSM Parameter Store and GCP Secret Manager
Install
npm install jwt-ssm
Make sure your environment is configured for AWS and GCP.
CLI usage
Rotate private key
jwt-ssm rotate /myNamespace/myKey
Generate token
jwt-ssm token /myNamespace/myKey
Verify token
jwt-ssm verify /myNamespace/myKey eyJhbGciOiJIUz...
Decode token (without verification)
jwt-ssm decode eyJhbGciOiJIUz...
Library usage
import JwtSsm from "jwt-ssm"
;(async (): Promise<void> => {
await JwtSsm.rotate("/myNamespace/myKey")
const myToken = await JwtSsm.token(
"/myNamespace/myKey",
"myJwtSubject"
)
if (JwtSsm.decode(myToken)) {
console.log("decoded!")
}
if (await JwtSsm.verify("/myNamespace/myKey", myToken)) {
console.log("verified!")
}
})()