https://github.com/splashsky/jwt
A simple, self-contained module for making and verifying JWTs using HMAC SHA256.
https://github.com/splashsky/jwt
Last synced: 6 months ago
JSON representation
A simple, self-contained module for making and verifying JWTs using HMAC SHA256.
- Host: GitHub
- URL: https://github.com/splashsky/jwt
- Owner: splashsky
- License: mit
- Created: 2024-01-06T05:05:46.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-19T15:39:03.000Z (over 2 years ago)
- Last Synced: 2025-10-10T23:34:25.192Z (9 months ago)
- Language: V
- Homepage: https://git.sharkk.net/Sky/jwt
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# JWT
A simple, self-contained module for making and verifying JWTs using HMAC SHA256. Built to be simple!
## Example
```v
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
}
```