SD-JWT-based Verifiable Digital Credentials (SD-JWT VC), draft-ietf-oauth-sd-jwt-vc-26.
The IETF profile of Attesto.SdJwt used by the EUDI wallet stack (and its
High-Assurance Interoperability Profile, HAIP): an SD-JWT whose Issuer-signed
JWT carries a credential type (vct), an issuer (iss), an optional holder
key binding (cnf), an optional Token Status List reference (status), and
the usual temporal claims, typed dc+sd-jwt in the JOSE typ header
(legacy vc+sd-jwt is neither emitted nor accepted).
This module adds the VC-specific claim rules on top of the base SD-JWT
mechanism; the selective-disclosure machinery, recursive verification, and Key
Binding JWT handling all come from Attesto.SdJwt.
issue/2— assemble and sign an SD-JWT VC: setsiss/vct/iat(and optionalexp/nbf/cnf/status/sub), makes the chosen credential claims selectively disclosable, and stamps JOSEtyp("dc+sd-jwt").verify/3— verify the issuer signature (typeddc+sd-jwt/application/dc+sd-jwt), reconstruct the disclosed claims, and enforce the VC claim rules:issandvctnon-empty by default,exp(if present) not passed,nbf(if present) reached. Holder binding is a separate step - pass the returnedcnfkey toAttesto.SdJwt.verify_key_binding/3with the presentation's nonce/audience. Explicit certificate identity mode permits an omittedissafter the caller establishes certificate trust. Alternatively,:trusted_certificatesopts into core path validation and SAN binding to a requirediss.
Conn-free and fail-closed, like the rest of attesto core.
Credential status references are fetched and enforced by default through
Attesto.StatusList.fetch/3 and its bounded verified-token cache. Explicit
resolve_status: false is for offline inspection; it must not be used to
decide whether a credential is acceptable. A custom resolver can replace
the transport while retaining signature and status enforcement.
Summary
Functions
Issue an SD-JWT VC.
Verify an SD-JWT VC presentation and reconstruct the disclosed claims.
Types
@type verify_error() :: Attesto.SdJwt.verify_error() | :missing_iss | :invalid_issuer_identity | :disclosed_registered_claim | :missing_vct | :expired | :not_yet_valid | :invalid_cnf | {:credential_status, non_neg_integer()} | :credential_suspended | :credential_revoked | :invalid_status_reference | :invalid_status_list | :invalid_status_list_signature | :invalid_status_list_token | :status_list_uri_mismatch | :status_index_out_of_range | Attesto.X509.verify_error() | :certificate_issuer_mismatch | term()
Functions
Issue an SD-JWT VC.
Required options:
:iss- the issuer identifier (its.well-known/jwt-vc-issueror DID).:vct- the verifiable credential type (a collision-resistant string/URI).:pem- the issuer signing key (PEM).
Optional:
:claims- the credential subject claims (a map). Defaults to%{}.:disclosable- which of those claim names to make selectively disclosable. Defaults to all of:claims. Registered claims (iss/vct/cnf/status/iat/exp/nbf/sub) are never made disclosable even if listed here - they always remain visible, so a holder cannot strip holder-binding (cnf) or a status reference.:cnf- the holder key-binding confirmation (RFC 7800), e.g.%{"jwk" => holder_public_jwk}. Included for later Key Binding.:status- a Token Status List reference map, typically built withAttesto.StatusList.reference/2. Always visible when present.:iat/:exp/:nbf/:sub- standard claims (unix seconds / string).:now- clock reference for a defaulted:iat.:kid- JOSEkidheader.:sd_alg- SD hashing algorithm.:typ- the SD-JWT VC media type stamped in the JOSEtypheader; must be"dc+sd-jwt"(draft-ietf-oauth-sd-jwt-vc-26). Defaults to"dc+sd-jwt".:x5c- the issuer X.509 certificate chain (RFC 7515 §4.1.6): a non-empty list of base64 DER certificate strings, stamped in the JOSEx5cheader so a verifier can bind the credential to a trusted issuer certificate (HAIP). Omitted when nil.
Returns the SD-JWT VC Issuance string (no Key Binding JWT).
@spec verify(String.t(), map() | [map()] | list() | nil, keyword()) :: {:ok, verified()} | {:error, verify_error()}
Verify an SD-JWT VC presentation and reconstruct the disclosed claims.
jwks is the issuer's JWK Set (or nil with :trusted_certificates). Options
are passed through to Attesto.SdJwt.verify/3 (e.g. :accepted_algs), plus:
:now/:max_age_seconds- clock reference for the temporal checks.:issuer_identity- defaults to:claim, requiring a nonemptyiss. Set:certificateonly after validating the issuer's certificate chain and supplying its verified leaf public key asjwks. This mode permits an omittedisswhen the signed header containsx5c, as in the SD-JWT VC profile referenced by HAIP. A present malformedissstill fails. Without:trusted_certificates, the caller establishes certificate trust; anx5cheader alone is never a trust decision.:trusted_certificates- opt into X.509 key resolution with a nonempty list of DER trust anchors. The protectedx5cchain is validated withAttesto.X509.verify/2; its leaf public key replacesjwksfor signature verification. A required, signedissmust then passAttesto.X509.matches_issuer?/2, including URI SAN precedence. This is the stricter binding policy documented there, not a requirement of all SD-JWT VC revisions. Empty or invalid anchors fail without falling back tojwks. This option also requiresissin:certificateidentity mode.:haip- with:trusted_certificates, defaults totrue: refuse a self-signed leaf or an embedded configured trust anchor (HAIP §6.1.1). Setfalsefor generic X.509 chain handling. The certificate purpose is always:genericfor SD-JWT VC, regardless of any:purposeoption.:certificate_trust- with:trusted_certificates, an optional additional chain policy callback as inAttesto.X509.verify/2. It cannot bypass path validation, signature verification, or issuer binding.:nowaffects credential claims only; OTP uses system time for certificate validity.
Returns {:ok, %{claims:, vct:, iss:, cnf:, key_binding_jwt:, ...}}. Holder
binding is NOT checked here - if cnf is present and the presentation carries
a Key Binding JWT, pass both to Attesto.SdJwt.verify_key_binding/3 with the
verifier's expected nonce/audience.
A presentation is rejected if a supplied disclosure reconstructs one of the registered claims that must have remained visible. A digest does not reveal the name of an omitted disclosure, so a nonconforming issuer-hidden optional claim that the holder omits is indistinguishable from an absent optional claim. Verifiers must therefore trust the issuer to follow the profile's registered-claim visibility rule.