# `AttestoClient.Wallet.Presentation.CertificateTrust`
[🔗](https://github.com/XukuLLC/attesto_client/blob/v2.26.0/lib/attesto_client/wallet/presentation/certificate_trust.ex#L1)

Bounded X.509 trust validation for wallet presentation requests and issuer provenance.

This public compatibility module delegates validation to `Attesto.X509`.

`verify/2` accepts a leaf-first DER certificate chain and explicit DER trust
anchors in `:trusted_certificates`. It validates the complete path with OTP's
PKIX implementation, then applies an optional `:certificate_trust` callback
for additional host policy. The callback cannot replace path validation.
Returns the verified leaf public JWK and authority key identifiers from the
validated chain. Hosts still own ecosystem policy and revocation checking.

Every certificate in the path, including the selected anchor, must use a
supported key and signature. RSA keys require at least 2048 bits, each
extension OID may occur once, and a leaf with `cA` set to `TRUE` is eligible
only as the selected anchor. See `Attesto.X509.verify/2` for the supported
keys and signatures.

`:purpose` defaults to `:generic`. The `:mdoc_issuer` purpose recognizes a
critical mdoc document-signer extended key usage on the leaf certificate.
It does not accept that extension on a CA or bypass any path-validation error.

PSS-specific SubjectPublicKeyInfo keys are rejected throughout the selected
path, including its trust anchor, until complete PSS parameter propagation
is supported. `rsaEncryption` parameters must be NULL; absent parameters are
accepted for interoperability. Other parameter values fail closed.

# `decode_x5c`

```elixir
@spec decode_x5c(term()) :: {:ok, [binary()]} | {:error, :invalid_certificate}
```

Decode a bounded JOSE certificate chain using `Attesto.X509.decode_x5c/1`.

# `verify`

```elixir
@spec verify([binary()], [Attesto.X509.option()]) ::
  {:ok, Attesto.X509.verified()} | {:error, Attesto.X509.verify_error()}
```

Validate a leaf-first DER chain using `Attesto.X509.verify/2`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
