npm.io
0.18.0 • Published 6 years agoCLI

jwt-ssm

Licence
MIT
Version
0.18.0
Deps
3
Size
31 kB
Vulns
5
Weekly
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!")
  }
})()