category

# `jwt_helpers`

Internal shared helpers for the jwt library.

Availability:
`logtalk_load(jwt(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-06
Compilation flags:
`static`
Extends:
`public` options
Uses:
base64url_no_padding
list
Remarks:
(none)
Inherited public predicates:
check_option/1 check_options/1 default_option/1 default_options/1 option/2 option/3 valid_option/1 valid_options/1

## Public predicates

(no local declarations; see entity ancestors if any)

## Protected predicates

### `json_member/3`

Enumerates JSON object member values for a given key.

Compilation flags:
`static`
Template:
`json_member(Key,Object,Value)`
Mode and number of proofs:
`json_member(+atom,+term,-term)` - `zero_or_more`

### `json_member_default/4`

Returns a JSON object member value or a default when the key is absent.

Compilation flags:
`static`
Template:
`json_member_default(Key,Object,Default,Value)`
Mode and number of proofs:
`json_member_default(+atom,+term,+term,-term)` - `one`

### `json_object_pairs/2`

Extracts the key-value pairs from a JSON object term.

Compilation flags:
`static`
Template:
`json_object_pairs(Object,Pairs)`
Mode and number of proofs:
`json_object_pairs(+term,-list(compound))` - `zero_or_one`

### `json_object/1`

Validates that a JSON term is an object without duplicate member names.

Compilation flags:
`static`
Template:
`json_object(Object)`
Mode and number of proofs:
`json_object(+term)` - `one_or_error`
Exceptions:
`Object` is not a JSON object or contains duplicate member names:
`domain_error(jwt_json_object,Object)`

### `pair_key_value/3`

Extracts the key and value from a JSON pair compound term.

Compilation flags:
`static`
Template:
`pair_key_value(Pair,Key,Value)`
Mode and number of proofs:
`pair_key_value(+compound,-term,-term)` - `one`

### `base64url_atom_bytes/2`

Converts between unpadded Base64URL atoms and byte lists.

Compilation flags:
`static`
Template:
`base64url_atom_bytes(Atom,Bytes)`
Mode and number of proofs:
`base64url_atom_bytes(+atom,-list(byte))` - `one_or_error`
`base64url_atom_bytes(-atom,+list(byte))` - `one_or_error`
Exceptions:
`Atom` is a variable or the sink is a variable:
`instantiation_error`
`Atom` is neither a variable nor a valid Base64URL source term:
`domain_error(base64url_source,codes(Codes))`
`Bytes` cannot be encoded in the requested Base64URL sink representation:
`domain_error(base64url_sink,codes(Codes))`
`Atom` contains Base64URL data with characters outside the Base64URL alphabet:
`representation_error(base64)`

### `atom_bytes/2`

Converts between an atom and its byte list representation.

Compilation flags:
`static`
Template:
`atom_bytes(Atom,Bytes)`
Mode and number of proofs:
`atom_bytes(+atom,-list(byte))` - `one`
`atom_bytes(-atom,+list(byte))` - `one`

### `bytes_atom/2`

Converts a byte list into an atom.

Compilation flags:
`static`
Template:
`bytes_atom(Bytes,Atom)`
Mode and number of proofs:
`bytes_atom(+list(byte),-atom)` - `one`

### `atom_list/1`

Validates that a list contains only atoms.

Compilation flags:
`static`
Template:
`atom_list(Atoms)`
Mode and number of proofs:
`atom_list(+list(atom))` - `zero_or_one`

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)