paseto-0.1.0.0: Platform-Agnostic Security Tokens
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Paseto.Token.Parser

Description

Parsers for PASETO tokens according to the message format defined in the specification.

Note that the parsers exported from this module do not perform any kind of token validation, cryptographic or otherwise. These parsers simply ensure that the input looks like a well-formed token.

Synopsis

Token parsers

parseTokenV3Local :: Text -> Either ParseError (Token V3 Local) Source #

Parse a version 3 local PASETO token from human-readable text according to the message format defined in the specification.

Note that this function does not perform any kind of token validation, cryptographic or otherwise. It simply parses the token and ensures that it is well-formed.

parseTokenV3Public :: Text -> Either ParseError (Token V3 Public) Source #

Parse a version 3 public PASETO token from human-readable text according to the message format defined in the specification.

Note that this function does not perform any kind of token validation, cryptographic or otherwise. It simply parses the token and ensures that it is well-formed.

parseTokenV4Local :: Text -> Either ParseError (Token V4 Local) Source #

Parse a version 4 local PASETO token from human-readable text according to the message format defined in the specification.

Note that this function does not perform any kind of token validation, cryptographic or otherwise. It simply parses the token and ensures that it is well-formed.

parseTokenV4Public :: Text -> Either ParseError (Token V4 Public) Source #

Parse a version 4 public PASETO token from human-readable text according to the message format defined in the specification.

Note that this function does not perform any kind of token validation, cryptographic or otherwise. It simply parses the token and ensures that it is well-formed.

parseSomeToken :: Text -> Either ParseError SomeToken Source #

Parse some kind of PASETO token from human-readable text according to the message format defined in the specification.

Note that this function does not perform any kind of token validation, cryptographic or otherwise. It simply parses the token and ensures that it is well-formed.

Parsec parsers

pVersion :: Parser Version Source #

Parse a Version from its string representation.

pVersionV3 :: Parser Version Source #

Parse the Version string v3.

pVersionV4 :: Parser Version Source #

Parse the Version string v4.

pPurpose :: Parser Purpose Source #

Parse a Purpose from its string representation.

pPurposeLocal :: Parser Purpose Source #

Parse the Purpose string local.

pPurposePublic :: Parser Purpose Source #

Parse the Purpose string public.

pPayload :: Parser Payload Source #

Parse a Payload from its string representation.

pFooter :: Parser Footer Source #

Parse a Footer from its string representation.

pPayloadAndFooter :: Parser (Payload, Maybe Footer) Source #

Parse a Payload along with an optional Footer.

pTokenParts Source #

Arguments

:: Parser Version

Parser for the Version part of a token.

-> Parser Purpose

Parser for the Purpose part of a token.

-> Parser (Version, Purpose, Payload, Maybe Footer) 

Parse the parts of a PASETO token: version, purpose, payload, and an optional footer.

pTokenV3Local :: Parser (Token V3 Local) Source #

Parse a version 3 local PASETO token from its string representation.

Accepted token format:

  • Without the optional footer: v3.local.${payload}
  • With the optional footer: v3.local.${payload}.${footer}

Both the payload and optional footer are base64url-encoded values (unpadded).

pTokenV3Public :: Parser (Token V3 Public) Source #

Parse a version 3 public PASETO token from its string representation.

Accepted token format:

  • Without the optional footer: v3.public.${payload}
  • With the optional footer: v3.public.${payload}.${footer}

Both the payload and optional footer are base64url-encoded values (unpadded).

pTokenV4Local :: Parser (Token V4 Local) Source #

Parse a version 4 local PASETO token from its string representation.

Accepted token format:

  • Without the optional footer: v4.local.${payload}
  • With the optional footer: v4.local.${payload}.${footer}

Both the payload and optional footer are base64url-encoded values (unpadded).

pTokenV4Public :: Parser (Token V4 Public) Source #

Parse a version 4 public PASETO token from its string representation.

Accepted token format:

  • Without the optional footer: v4.public.${payload}
  • With the optional footer: v4.public.${payload}.${footer}

Both the payload and optional footer are base64url-encoded values (unpadded).

pSomeToken :: Parser SomeToken Source #

Parse some kind of PASETO token from its string representation.

PASETO token format:

  • Without the optional footer: version.purpose.payload
  • With the optional footer: version.purpose.payload.footer

Acceptable values for version are v3 and v4. v1 and v2 are deprecated, so they're not supported.

Acceptable values for purpose are local and public.

Both the payload and optional footer are base64url-encoded values (unpadded).