.. index:: single: open_id_jwks
.. _open_id_jwks/0:

.. rst-class:: right

**object**

``open_id_jwks``
================

JSON Web Key Set parsing and key selection helpers.

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

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

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


| **Imports:**
|    ``public`` :ref:`open_id_helpers <open_id_helpers/0>`
| **Uses:**
|    :ref:`list <list/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:: select_key/3
.. _open_id_jwks/0::select_key/3:

``select_key/3``
^^^^^^^^^^^^^^^^

Selects a matching verification key from a JWK Set for a JWT header.

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

| **Template:**
|    ``select_key(JWKSet,Header,Key)``
| **Mode and number of proofs:**
|    ``select_key(+term,+term,-term)`` - ``one_or_error``

| **Exceptions:**
|    ``JWKSet`` is not a JSON Web Key Set with a ``keys`` list:
|        ``domain_error(open_id_jwks,JWKSet)``
|    ``Header`` does not contain a valid ``alg`` member:
|        ``domain_error(open_id_jwt_header,Header)``
|    No compatible key exists for ``Header``:
|        ``existence_error(open_id_jwk,Header)``


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

.. index:: header_algorithm/2
.. _open_id_jwks/0::header_algorithm/2:

``header_algorithm/2``
^^^^^^^^^^^^^^^^^^^^^^

Extracts and validates the JWT header algorithm.

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

| **Template:**
|    ``header_algorithm(Header,Algorithm)``
| **Mode and number of proofs:**
|    ``header_algorithm(+term,-atom)`` - ``one_or_error``

| **Exceptions:**
|    ``Header`` does not contain a valid ``alg`` member:
|        ``domain_error(open_id_jwt_header,Header)``


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

.. index:: header_key_id/2
.. _open_id_jwks/0::header_key_id/2:

``header_key_id/2``
^^^^^^^^^^^^^^^^^^^

Extracts the optional key identifier from a JWT header.

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

| **Template:**
|    ``header_key_id(Header,KeyId)``
| **Mode and number of proofs:**
|    ``header_key_id(+term,-atom)`` - ``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)

