Attesto.CredentialIssuerMetadata (Attesto v2.28.0)

Copy Markdown View Source

OID4VCI 1.0 Credential Issuer Metadata (§12.2).

Build the JSON document a wallet fetches from /.well-known/openid-credential-issuer to discover the Credential Issuer's credential endpoint, supported credential configurations, and optional issuance capabilities.

This module is the pure, conn-free, HTTP-free half of that endpoint. It returns a string-keyed map ready to serialise as JSON; serving the document is the host's concern. Nil values are omitted so the document advertises only capabilities the host provides. Unknown options and unknown fields in credential configurations are ignored.

signed/2 produces the optional signed JWT representation of the document (OID4VCI §12.2.3), served when a wallet requests Accept: application/jwt.

Summary

Functions

Build the OID4VCI Credential Issuer Metadata document.

Represent a metadata document as a signed JWT (OID4VCI §12.2.3).

Functions

build(opts)

@spec build(keyword()) :: %{required(String.t()) => term()}

Build the OID4VCI Credential Issuer Metadata document.

Required options:

  • :credential_issuer - the Credential Issuer Identifier URL.
  • :credential_endpoint - the URL of the credential endpoint.
  • :credential_configurations_supported - a non-empty map from credential-configuration IDs to configuration maps.

Optional options are :authorization_servers, :nonce_endpoint, :deferred_credential_endpoint, :notification_endpoint, :credential_request_encryption, :credential_response_encryption, :batch_credential_issuance, and :display. Each is included only when supplied with a non-nil value.

Configuration maps are normalized to the supported OID4VCI members and their nil values are omitted. A format is required for every configuration. vct is additionally required for dc+sd-jwt configurations (draft-ietf-oauth-sd-jwt-vc-26). mso_mdoc requires a non-empty doctype and uses integer COSE identifiers for credential_signing_alg_values_supported; JWT credential formats use string JOSE algorithm names.

Current display and ordered claims descriptions belong in the optional credential_metadata object (§12.2.4 and Appendix B). Atom keys in this object are normalized to strings; JSON extensions and claim paths are preserved. Legacy configuration-level claims and display remain supported for 2.x callers without converting their claim descriptions.

signed(metadata, opts)

@spec signed(
  %{required(String.t()) => term()},
  keyword()
) :: String.t()

Represent a metadata document as a signed JWT (OID4VCI §12.2.3).

Served when a wallet requests signed metadata with Accept: application/jwt. The header carries typ: openidvci-issuer-metadata+jwt and the issuer's public signing key as jwk, so the wallet verifies the signature without a separate key lookup. The claims are the document's members plus iss/sub (the Credential Issuer Identifier) and iat.

metadata is a document from build/1. Exactly one of :pem or :keystore is required; optional :now overrides the iat clock (unix seconds).