object

# `jwt_jws`

JWS signing input construction and signature algorithm dispatch.

Availability:
`logtalk_load(jwt(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-06
Compilation flags:
`static, context_switching_calls`
Imports:
`public` jwt_helpers
Uses:
hmac
jwt_compact
jwt_jwa
jwt_jwk
jwt_openssl
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

### `verify/5`

Verifies a JWS signature for a signing input, algorithm, key, and options.

Compilation flags:
`static`
Template:
`verify(Algorithm,SigningInput,Signature,Key,Options)`
Mode and number of proofs:
`verify(+atom,+atom,+list(byte),+term,+list(compound))` - `zero_or_one_or_error`
Exceptions:
`Algorithm` is unsupported:
`domain_error(jwt_algorithm,Algorithm)`
`Key` is not a valid symmetric key:
`domain_error(jwt_symmetric_key,Key)`
`Key` is not a supported public JWK:
`domain_error(jwt_jwk_public_key,Key)`
`Signature` is not a 64-byte raw ES256 signature:
`domain_error(jwt_es256_signature,Signature)`
The OpenSSL executable does not exist:
`existence_error(os_command,Executable)`

### `sign/5`

Signs claims as a compact JWT using the given header, key, and options.

Compilation flags:
`static`
Template:
`sign(Header,Claims,Key,Token,Options)`
Mode and number of proofs:
`sign(+term,+term,+term,-atom,+list(compound))` - `one_or_error`
Exceptions:
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
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)`
`Header` does not contain a valid `alg` member:
`domain_error(jwt_header,Header)`
The JWT algorithm is unsupported or disallowed:
`domain_error(jwt_algorithm,Algorithm)`
`Header` or `Claims` cannot be encoded as JSON:
`domain_error(json_sink,HeaderOrClaims)`
`Key` is not a valid symmetric key:
`domain_error(jwt_symmetric_key,Key)`
`Algorithm` is not a supported signing algorithm:
`domain_error(jwt_signing_algorithm,Algorithm)`

### `sign_payload/5`

Signs a payload JSON term as a compact JWS using the given header, key, and options.

Compilation flags:
`static`
Template:
`sign_payload(Header,Payload,Key,Token,Options)`
Mode and number of proofs:
`sign_payload(+term,+term,+term,-atom,+list(compound))` - `one_or_error`
Exceptions:
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
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)`
`Header` does not contain a valid `alg` member:
`domain_error(jwt_header,Header)`
The JWT algorithm is unsupported or disallowed:
`domain_error(jwt_algorithm,Algorithm)`
`Header` or `Payload` cannot be encoded as JSON:
`domain_error(json_sink,HeaderOrPayload)`
`Key` is not a valid symmetric key:
`domain_error(jwt_symmetric_key,Key)`
`Algorithm` is not a supported signing algorithm:
`domain_error(jwt_signing_algorithm,Algorithm)`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)