.. index:: single: paseto_claims
.. _paseto_claims/0:

.. rst-class:: right

**object**

``paseto_claims``
=================

PASETO JSON claims lookup and validation predicates.

| **Availability:** 
|    ``logtalk_load(paseto(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-08-08

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`paseto_claims_helpers <paseto_claims_helpers/0>`
| **Uses:**
|    :ref:`list <list/0>`
|    :ref:`os <os/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: validate_claims/3
.. _paseto_claims/0::validate_claims/3:

``validate_claims/3``
^^^^^^^^^^^^^^^^^^^^^

Validates claims using registered-claim defaults, a policy list, and options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``validate_claims(Claims,Policy,Options)``
| **Mode and number of proofs:**
|    ``validate_claims(+term,+list(compound),+list(compound))`` - ``one_or_error``

| **Exceptions:**
|    ``Claims`` is not a JSON object or contains duplicate members:
|        ``domain_error(paseto_json_object,Claims)``
|    ``Claims`` is missing a required claim ``Name``:
|        ``domain_error(paseto_claims,missing(Name))``
|    ``Policy`` contains an invalid claim policy:
|        ``domain_error(paseto_claim_policy,ClaimPolicy)``
|    A time claim has a non-numeric value:
|        ``type_error(time_number,Name-Value)``
|    ``Options`` is a variable:
|        ``instantiation_error``
|    ``Options`` is neither a variable nor a list:
|        ``type_error(list,Options)``
|    An element ``Option`` of the list ``Options`` is a variable:
|        ``instantiation_error``
|    An element ``Option`` of the list ``Options`` is neither a variable nor a compound term:
|        ``type_error(compound,Option)``
|    An element ``Option`` of the list ``Options`` is a compound term but not a valid option:
|        ``domain_error(option,Option)``


------------

.. index:: validate_claim/3
.. _paseto_claims/0::validate_claim/3:

``validate_claim/3``
^^^^^^^^^^^^^^^^^^^^

Validates one claim policy against a claims object.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``validate_claim(Claims,ClaimPolicy,Options)``
| **Meta-predicate template:**
|    ``validate_claim(*,*,*)``
| **Mode and number of proofs:**
|    ``validate_claim(+term,+compound,+list(compound))`` - ``one_or_error``

| **Exceptions:**
|    ``Claims`` is missing the required claim ``Name``:
|        ``domain_error(paseto_claims,missing(Name))``
|    The value of claim ``Name`` does not satisfy the policy:
|        ``domain_error(paseto_claim(Name),Value)``
|    ``ClaimPolicy`` is not a supported claim policy:
|        ``domain_error(paseto_claim_policy,ClaimPolicy)``
|    A time claim has an unknown validation kind:
|        ``domain_error(paseto_time_claim_kind,Kind)``
|    A time claim has a non-numeric value:
|        ``type_error(time_number,Name-Value)``
|    ``Options`` is a variable:
|        ``instantiation_error``
|    ``Options`` is neither a variable nor a list:
|        ``type_error(list,Options)``
|    An element ``Option`` of the list ``Options`` is a variable:
|        ``instantiation_error``
|    An element ``Option`` of the list ``Options`` is neither a variable nor a compound term:
|        ``type_error(compound,Option)``
|    An element ``Option`` of the list ``Options`` is a compound term but not a valid option:
|        ``domain_error(option,Option)``


------------

.. index:: claim/3
.. _paseto_claims/0::claim/3:

``claim/3``
^^^^^^^^^^^

Looks up a claim value by name.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``claim(Claims,Name,Value)``
| **Mode and number of proofs:**
|    ``claim(+term,+atom,-term)`` - ``zero_or_one``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

