.. index:: single: paseto_helpers .. _paseto_helpers/0: .. rst-class:: right **category** ``paseto_helpers`` ================== Protected PASETO v4 framing, PAE, and encoding helpers. | **Availability:** | ``logtalk_load(paseto(loader))`` | **Author:** Paulo Moura | **Version:** 1:0:0 | **Date:** 2026-08-08 | **Compilation flags:** | ``static`` | **Uses:** | :ref:`base64url_no_padding ` | :ref:`list ` | **Remarks:** | (none) | **Inherited public predicates:** | (none) .. contents:: :local: :backlinks: top Public predicates ----------------- (no local declarations; see entity ancestors if any) Protected predicates -------------------- .. index:: pae/2 .. _paseto_helpers/0::pae/2: ``pae/2`` ^^^^^^^^^ Pre-authentication encodes a list of byte-list pieces. | **Compilation flags:** | ``static`` | **Template:** | ``pae(Pieces,Encoding)`` | **Mode and number of proofs:** | ``pae(+list(list(byte)),-list(byte))`` - ``one`` ------------ .. index:: parse_token/4 .. _paseto_helpers/0::parse_token/4: ``parse_token/4`` ^^^^^^^^^^^^^^^^^ Strictly parses a canonical v4 token for Purpose and decodes its body and optional footer. | **Compilation flags:** | ``static`` | **Template:** | ``parse_token(Token,Purpose,Body,Footer)`` | **Mode and number of proofs:** | ``parse_token(+atom,+atom,-list(byte),-list(byte))`` - ``one_or_error`` | **Exceptions:** | ``Token`` is a variable: | ``instantiation_error`` | ``Token`` is neither a variable nor an atom: | ``type_error(atom,Token)`` | ``Token`` is an atom but does not have the expected PASETO v4 header: | ``domain_error(paseto_v4_token,Token)`` | ``Token`` is a PASETO v4 header but has a malformed compact serialization: | ``domain_error(paseto_compact_serialization,malformed)`` | ``Token`` contains non-canonical base64url data: | ``representation_error(base64)`` ------------ .. index:: format_token/4 .. _paseto_helpers/0::format_token/4: ``format_token/4`` ^^^^^^^^^^^^^^^^^^ Formats a canonical v4 token for Purpose from body and footer bytes. | **Compilation flags:** | ``static`` | **Template:** | ``format_token(Purpose,Body,Footer,Token)`` | **Mode and number of proofs:** | ``format_token(+atom,+list(byte),+list(byte),-atom)`` - ``one`` ------------ Private predicates ------------------ (no local declarations; see entity ancestors if any) Operators --------- (none)