Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 359 Bytes

README.md

File metadata and controls

17 lines (14 loc) · 359 Bytes

Pure Nim implementation of JWT (JSON Web Token). Currently supports SHA256 and SHA512.

let secret = tokenUrlSafe(128)
# NOTE: claims
let payload = %* {
  "sub": "1234567890",
  "name": "John Doe",
  "iat": 1516239022
}

let token = sign(payload, secret)
echo fmt"JWT: {token}"

let isValid = verify(token, secret)
echo fmt"valid token: {isValid}"