Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danieldaeschle/vjwt
JWT module for V. https://jwt.io/
https://github.com/danieldaeschle/vjwt
jwt v
Last synced: 3 days ago
JSON representation
JWT module for V. https://jwt.io/
- Host: GitHub
- URL: https://github.com/danieldaeschle/vjwt
- Owner: danieldaeschle
- Created: 2020-11-03T08:48:45.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-23T13:36:13.000Z (over 1 year ago)
- Last Synced: 2023-07-23T14:38:27.599Z (over 1 year ago)
- Topics: jwt, v
- Language: V
- Homepage:
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> Currently it's work in progress until the json module in V is finalized.
# jwt for V
A small native library to encode and decode JWT in V.# Getting started
## Encode
To parse a struct to a JWT token you just have to do:
> This example is using a `map[string]string` as payload.
```v
import jwtpayload := {
'sub': '1234567890'
'name': 'John Doe'
'iat': '1516239022'
}
token := jwt.encode(
payload: payload
key: 'secret'
)!
```## Decode
```v
import jwt
struct User {
name string
}
obj := jwt.decode[User](
payload: payload
key: 'secret'
)!
```# Implementation progress
- [x] Sign
- [x] Verify
- [x] HS256
- [x] HS384
- [x] HS512
- [ ] PS256
- [ ] PS384
- [ ] PS512
- [ ] RS256
- [ ] RS384
- [ ] RS512
- [ ] ES256
- [ ] ES256K
- [ ] ES384
- [ ] ES512
- [ ] EdDSA
- [ ] `iss` check
- [ ] `sub` check
- [ ] `aud` check
- [ ] `exp` check
- [ ] `nbf` check
- [ ] `iat` check
- [ ] `jti` check