anmolitor/protobuf-web-tokens/1.1.0

Formerly andreasewering/protobuf-web-tokens. Search finds this package by either name.

Protobuf.Token

Decode Protobuf Web Tokens (PWT)

type alias TokenData t =
{ validUntil : Posix
, claims : t
}

Claims encoded in the token and some metadata

decode : Decoder t -> String -> Result Error (TokenData t)

Decodes a Protobuf Web Token using the given decoder.

decodeBytes : Decoder t -> Bytes -> Result Error (TokenData t)

Decodes a Protobuf Web Token from the compact byte format using the given decoder.

type Error
= InvalidFormat
| InvalidBase64
| InvalidBytes
| NoValidUntilField

The ways a token decoding can fail

errorToString : Error -> String

Converts an Error to a string representation for debugging or error reporting.