utils/jwt
Types
pub type Jwt {
Jwt(header: JwtHeader, payload: JwtPayload, signature: String)
}
Constructors
-
Jwt(header: JwtHeader, payload: JwtPayload, signature: String)
pub type JwtAlgorithm {
HS256
HS384
HS512
RS256
RS384
RS512
ES256
ES384
ES512
PS256
PS384
PS512
None
}
Constructors
-
HS256 -
HS384 -
HS512 -
RS256 -
RS384 -
RS512 -
ES256 -
ES384 -
ES512 -
PS256 -
PS384 -
PS512 -
None
pub type JwtDecodeError {
MissingHeader
MissingPayload
MissingSignature
InvalidHeader
InvalidPayload
InvalidSignature
InvalidExpiration
TokenExpired
TokenNotValidYet
InvalidNotBefore
InvalidAlgorithm
}
Constructors
-
MissingHeader -
MissingPayload -
MissingSignature -
InvalidHeader -
InvalidPayload -
InvalidSignature -
InvalidExpiration -
TokenExpired -
TokenNotValidYet -
InvalidNotBefore -
InvalidAlgorithm
pub type JwtHeader {
JwtHeader(algorithm: JwtAlgorithm, token_type: String)
}
Constructors
-
JwtHeader(algorithm: JwtAlgorithm, token_type: String)
pub type JwtPayload {
JwtPayload(
identifier: String,
version: String,
reset_date: option.Option(birl.Time),
issued_at: birl.Time,
subject: String,
)
}
Constructors
-
JwtPayload( identifier: String, version: String, reset_date: option.Option(birl.Time), issued_at: birl.Time, subject: String, )
Values
pub fn jwt_algorithm_decoder() -> decode.Decoder(JwtAlgorithm)
pub fn parse(token: String) -> Result(Jwt, JwtDecodeError)
pub fn parse_jwt_algorithm(
value: String,
) -> Result(JwtAlgorithm, Nil)