1.0.5 • Published 2 years ago
jwt-tiny v1.0.5
jwt-tiny
Zero dependency, pure JS, tiny JWT for servers.
npm test
import { JWT } from 'jwt-tiny')
const secret = 'your-256-bit-secret'
const payload = {
name: "John Doe",
roles: ["admin"]
iat: +new Date()
}
const jwt = new JWT(secret)
const jwtstr = jwt.create(payload)
const payload = jwt.verify(jwtstr)
const asJSON = jwt.verifyJSON(jwtstr)
console.log(jwtstr, asJSON)