category

# `open_id_helpers`

Internal shared helpers for the open_id library.

Availability:
`logtalk_load(open_id(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-06
Compilation flags:
`static`
Extends:
`public` options
Uses:
base64url_no_padding
http_core
list
url(Representation)
user
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`

### `provider_property/3`

Looks up a property in a provider metadata compound term.

Compilation flags:
`static`
Template:
`provider_property(Provider,Name,Value)`
Mode and number of proofs:
`provider_property(+compound,+atom,-term)` - `zero_or_one`

### `provider_property_default/4`

Returns a provider metadata property or a default when the property is absent.

Compilation flags:
`static`
Template:
`provider_property_default(Provider,Name,Default,Value)`
Mode and number of proofs:
`provider_property_default(+compound,+atom,+term,-term)` - `one`

### `normalize_options_term/2`

Normalizes either a direct options list or a named options wrapper term.

Compilation flags:
`static`
Template:
`normalize_options_term(NameOptions,Options)`
Mode and number of proofs:
`normalize_options_term(+term,-list(compound))` - `one`

### `query_atom/2`

Encodes query parameters as a URL query atom.

Compilation flags:
`static`
Template:
`query_atom(Pairs,Query)`
Mode and number of proofs:
`query_atom(+list(pair),-atom)` - `one_or_error`
Exceptions:
The HTTP body sink is a variable:
`instantiation_error`
The HTTP body sink is not a valid sink term:
`domain_error(http_sink,Sink)`
`Pairs` cannot be represented as an HTTP form body:
`domain_error(http_body,Body)`
The HTTP body options are invalid:
`domain_error(http_body_options,Options)`

### `space_atom/2`

Converts an atom or list of atoms into a space-separated atom.

Compilation flags:
`static`
Template:
`space_atom(Value,Atom)`
Mode and number of proofs:
`space_atom(+term,-atom)` - `one_or_error`
Exceptions:
`Value` is neither an atom nor a list of atoms:
`domain_error(open_id_space_separated_atom,Value)`

### `url_scheme/2`

Extracts the scheme from an absolute URL atom.

Compilation flags:
`static`
Template:
`url_scheme(URL,Scheme)`
Mode and number of proofs:
`url_scheme(+atom,-atom)` - `zero_or_one`

### `https_url/1`

Succeeds when the URL uses the https scheme.

Compilation flags:
`static`
Template:
`https_url(URL)`
Mode and number of proofs:
`https_url(+atom)` - `zero_or_one`

### `localhost_http_url/1`

Succeeds when the URL uses http for a localhost or loopback host.

Compilation flags:
`static`
Template:
`localhost_http_url(URL)`
Mode and number of proofs:
`localhost_http_url(+atom)` - `zero_or_one`

### `ensure_absolute_url/2`

Validates that a value is an absolute URL for the given domain label.

Compilation flags:
`static`
Template:
`ensure_absolute_url(Domain,URL)`
Mode and number of proofs:
`ensure_absolute_url(+atom,+atom)` - `one_or_error`
Exceptions:
`URL` is a variable:
`instantiation_error`
`URL` is not an absolute URL atom:
`domain_error(Domain,URL)`

### `ensure_secure_url/3`

Validates that a URL uses https or an allowed localhost exception.

Compilation flags:
`static`
Template:
`ensure_secure_url(Domain,URL,Options)`
Mode and number of proofs:
`ensure_secure_url(+atom,+atom,+list(compound))` - `one_or_error`
Exceptions:
`URL` is a variable:
`instantiation_error`
`URL` is not an absolute URL atom:
`domain_error(Domain,URL)`
`URL` is not secure and is not an allowed localhost HTTP URL:
`domain_error(Domain,URL)`

### `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`

### `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)`

### `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`

### `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`

### `append_query/3`

Appends a query atom to an endpoint URL, preserving any existing query.

Compilation flags:
`static`
Template:
`append_query(Endpoint,Query,URL)`
Mode and number of proofs:
`append_query(+atom,+atom,-atom)` - `one`

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)