Currently it's work in progress until the json module in V is finalized.
A small native library to encode and decode JWT in V.
To parse a struct to a JWT token you just have to do:
This example is using a
map[string]stringas payload.
import jwt
payload := {
'sub': '1234567890'
'name': 'John Doe'
'iat': '1516239022'
}
token := jwt.encode(
payload: payload
key: 'secret'
)!import jwt
struct User {
name string
}
obj := jwt.decode[User](
payload: payload
key: 'secret'
)!- Sign
- Verify
- HS256
- HS384
- HS512
- PS256
- PS384
- PS512
- RS256
- RS384
- RS512
- ES256
- ES256K
- ES384
- ES512
- EdDSA
-
isscheck -
subcheck -
audcheck -
expcheck -
nbfcheck -
iatcheck -
jticheck