package core.crypto.keys
EXPERIMENTAL: JWT support is under active development. The public interface for this package is subject to change.
JWT :: struct {
method: JWT_Signing_Method
headers: Map([] u8, [] u8)
claims: Map([] u8, Value)
_body: [..] u8
}
Methods
JWT.make_with_claims :: (method: JWT_Signing_Method, claims: Map([] u8, Value)) -> JWT
JWT.parse :: (token: [] u8, signing_key: [] u8, allocator: Allocator) -> Result(JWT, JWT_Parse_Error)
JWT_Parse_Error :: enum {
Bad_Format :: 0
Invalid_Header :: 1
Invalid_Body :: 2
Invalid_Signature :: 3
}
JWT_Signing_Method :: enum {
UNKNOWN :: 0
NONE :: 1
HS256 :: 2
}
The algorithm used to secure the JWT. Currently, only NONE
and HS256
are supported, as they are the only required algorithms per RFC-7518. When the standard library of Onyx has support for RSA and ECDSA, more algorithms could be implemented.