jwt
sign
Sign a payload.
import { jwt } from 'darkflare'
const token = await jwt.verify(token, secret)
// alternatively, you can encrypt the token:
const token = await jwt.verify(token, secret, { encrypt: encryptionSecret })
verify
Verify the validity of a JSON Web Token.
import { jwt } from 'darkflare'
const payload = await jwt.verify(token, secret) // returns undefined if the token is invalid
// alternatively, if you chose to encrypt your payload, you can decrypt it by specifying the secret:
const payload = await jwt.verify(token, secret, { decrypt: encryptionSecret })