.. index:: single: jwt_jwk
.. _jwt_jwk/0:

.. rst-class:: right

**object**

``jwt_jwk``
===========

JSON Web Key normalization and key material helpers.

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

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

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


| **Imports:**
|    ``public`` :ref:`jwt_helpers <jwt_helpers/0>`
| **Uses:**
|    :ref:`jwt_der <jwt_der/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:: public_key_pem/2
.. _jwt_jwk/0::public_key_pem/2:

``public_key_pem/2``
^^^^^^^^^^^^^^^^^^^^

Converts a supported JWK public key into PEM SubjectPublicKeyInfo text.

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

| **Template:**
|    ``public_key_pem(Key,PEM)``
| **Mode and number of proofs:**
|    ``public_key_pem(+term,-atom)`` - ``one_or_error``

| **Exceptions:**
|    ``Key`` is not a supported RSA or P-256 EC public JWK:
|        ``domain_error(jwt_jwk_public_key,Key)``
|    ``Key`` contains Base64URL data with characters outside the Base64URL alphabet:
|        ``representation_error(base64)``


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

.. index:: symmetric_key_bytes/2
.. _jwt_jwk/0::symmetric_key_bytes/2:

``symmetric_key_bytes/2``
^^^^^^^^^^^^^^^^^^^^^^^^^

Extracts symmetric key bytes from an atom, byte wrapper, or octet JWK.

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

| **Template:**
|    ``symmetric_key_bytes(Key,Bytes)``
| **Mode and number of proofs:**
|    ``symmetric_key_bytes(+term,-list(byte))`` - ``one_or_error``

| **Exceptions:**
|    ``Key`` is not an atom, byte wrapper, or octet JWK with Base64URL key material:
|        ``domain_error(jwt_symmetric_key,Key)``
|    ``Key`` contains Base64URL data with characters outside the Base64URL alphabet:
|        ``representation_error(base64)``


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

.. index:: compatible_key/2
.. _jwt_jwk/0::compatible_key/2:

``compatible_key/2``
^^^^^^^^^^^^^^^^^^^^

Succeeds when a key is compatible with the requested JWT algorithm.

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

| **Template:**
|    ``compatible_key(Key,Algorithm)``
| **Mode and number of proofs:**
|    ``compatible_key(+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)

