utils/jwt

Types

pub type Jwt {
  Jwt(header: JwtHeader, payload: JwtPayload, signature: String)
}

Constructors

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

pub type JwtPayload {
  JwtPayload(
    identifier: String,
    version: String,
    reset_date: option.Option(birl.Time),
    issued_at: birl.Time,
    subject: String,
  )
}

Constructors

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)
Search Document