danieldaeschle / vjwt

JWT module for V. https://jwt.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 tokens 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.

import jwt

payload := {
    'sub': '1234567890'
    'name': 'John Doe'
    'iat': '1516239022'
}
token := jwt.encode({
	payload: payload
	key: 'secret'
})

Decode

Implementation progress

  • Sign
  • Verify
  • HS256
  • HS384
  • 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
ezoic increase your site revenue

About

JWT module for V. https://jwt.io/


Languages

Language:V 97.8%Language:AMPL 2.2%