Skip to content
/ jwt Public

A simple, self-contained module for making and verifying JWTs using HMAC SHA256.

License

Notifications You must be signed in to change notification settings

splashsky/jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT

A simple, self-contained module for making and verifying JWTs using HMAC SHA256. Built to be simple!

Example

import jwt
import json

const secret := "secret-key"

// Create a new token
payload := jwt.Payload{
    sub: "1234567890",
    ext: json.encode(/* some struct */)
}
token := jwt.Token.new(payload, secret)
respond_with(token.str())

// Validate a token from the web
token := jwt.Token.from_str(/* receive a token from the web */)
if token.valid(secret) {
    // do stuff
}

About

A simple, self-contained module for making and verifying JWTs using HMAC SHA256.

Resources

License

Stars

Watchers

Forks

Languages