Metadata-Version: 2.4
Name: mintid-verifier-sdk
Version: 0.10.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Rust
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: boto3>=1.35 ; extra == 'kms'
Requires-Dist: cryptography>=42 ; extra == 'software-signer'
Provides-Extra: kms
Provides-Extra: software-signer
License-File: LICENSE
License-File: NOTICE
Summary: MintID Verifier SDK: presentation verification for the relying party's own verifier, with the pinned Rust proof engine compiled in
Keywords: mintid,identity,verifier,verifiable-credentials,zero-knowledge,openid4vp
Author-email: Marc Molas <marc@mintid.net>
License-Expression: Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/02-python-sdk.md
Project-URL: Homepage, https://mintid.net
Project-URL: Issues, https://gitlab.com/mintid/mintid/-/issues
Project-URL: Repository, https://gitlab.com/mintid/mintid
Project-URL: Security, https://gitlab.com/mintid/mintid/-/blob/main/SECURITY.md
Project-URL: Source, https://gitlab.com/mintid/mintid/-/tree/main/verifier-core

# mintid-verifier-sdk

The MintID Verifier SDK (import name `verifier_core`): the single verifying
core of MintID, for the relying party's own verifier. It validates a holder's
presentation against the challenge it answers, either in your own process
(embedded) or behind a thin HTTP service you deploy yourself next to your
backend (service mode, which the TypeScript client and the MCP server talk
to). The Rust proof engine is compiled in at a pinned version, so a supported
install cannot end up with a substituted engine.

## Where it fits

MintID is a network for verifiable, human-backed identity. Accepted issuers
verify people and issue the credentials; the chain publishes their status
roots, their bonds and the registries; each verifier decides on its own
service. MintID itself issues nothing, certifies nothing and verifies nobody.

The verifier is your own service, and the decision is yours: nothing else
validates a presentation, and pointing a client at somebody else's verifier
service would delegate the decision itself. Installing the SDK does not make
you a verifier: your verifier is registered on the chain, with its exact
origins and its request-signing keys, before any presentation can be
accepted (see
[becoming a verifier](https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/10-becoming-a-verifier.md)).

What the SDK enforces, as constants and closed types rather than settings:
every acceptance condition runs in full and in order on every presentation;
a presentation lives 30 seconds; chain reads are proven or they do not count;
and the only thing kept is a minimal decision record, into which proof bytes,
claim values and personal data do not fit.

## Install

```bash
pip install mintid-verifier-sdk   # Python 3.12 or later, no runtime dependencies
```

Where no wheel matches your platform, pip builds it from the source
distribution, which needs a Rust toolchain. Version 0.10.0, published from the
main repository, https://gitlab.com/mintid/mintid (`verifier-core`).

**New in 0.10 (breaking).** The engine pin is `proof-core 0.7.0`:
presentations of format version 4 only, one encoding each, living 30 seconds
(`PRESENTATION_LIFETIME_SECONDS`, reported by `GET /v1/build-info` as
`presentation_lifetime_seconds`; verifier contract 1.11.0), and the dispute
presentation digest computed by verification. The MintID Foundation's
dispute key record is accepted on an active admission key's signature,
checked against the service's own chain view; no custody entry is taken or
needed (the custodian's co-signature, ADR-0051, comes with a later
regeneration of the chain). Binding
references in the signed request (contract 1.9.0): the session binding of
bIP-0002 §5 (`--bound-challenges` with the operator token) and the payment
binding of bIP-0006 (`verifier_core.payment_binding`, x402 version 2 in the
vendor middleware). The x402 middleware asks for a bound challenge for every
Web Bot Auth signed challenge request, in `bind` mode as in `require`: in
front of a service without bound challenges, or without its operator token,
it answers a signed agent `502` with the service's `operator_token_required`,
and only unsigned agents get a challenge (`bind`). `verifier_core.dispute_claim` holds the claim schema v1
and its commitment, the payment evidence a claim commits to for the arbiter
only (`payment_evidence`, `check_payment_evidence`), and
`ChainClient.get_dispute_claim` the proven read of a recorded claim. Every policy asks `unexpired` (verifier contract
1.11.0): an identity policy without it is refused with `unexpired_required`
at the challenge and at validation, and the x402 identity leg and the OAuth
bridge refuse it when configured. A presentation answers a policy with one
credential (verifier contract 1.11.0): `same_credential_required` stays in
the request, fixed to `true`, and a challenge or a request asking `false` is
refused with `single_credential_required`, whatever the profile; a signed
request without the member, with a member that is not a boolean, or
without `issuer_policy` is `request_malformed`. A recognition retention
above 90 days is refused; on a chain that governs the claim window the
service reads it with its proof and refuses `--dispute-claim-window-days`,
and on a chain that does not the flag accepts 30 to 180 days (90 when it is
not given) and the service refuses to start on any other value. A dispute
retention store or a payment projection store built without a claim-window
source keeps nothing until its embedder chooses one (`ChainClaimWindow`
over a proven chain reader, or a fixed window of 30 to 180 days): an agent presentation
against it is refused with `dispute_retention_unavailable`, and a bound
payment of the x402 leg, whose default store is such a store, with
`payment_binding_unavailable`. The service pins the body of the first Foundation key record it accepts
for each key version, and the same body signed by another active
admission key passes the pin.

**New in 0.2.** Request signers for the service: every challenge is signed
with your registered request key, held in AWS KMS (extra `[kms]`) or a
software seed file for local stacks (extra `[software-signer]`); holders
refuse unsigned challenges from this release of the holder library on, so a
service that signs nothing is for a devnet only (`--insecure-unsigned-challenges`).
Every decision record names its evidence, the deciding `condition` and its
`vocabulary` (SPEC-1 v3.2, R18); reason codes are unchanged. The engine pin
is `proof-core 0.4.0` (its verifying surface is unchanged from 0.3.0).

**New in 0.4.** The agent profile v2 (verifier contract 1.7.0, ADR-0025):
a challenge may ask for `profile: agent_v2`, whose claim policy is an
agent_v1 one plus at most one `age_over` entry, proven on the agent's
principal age floor. Identity and agent_v1 challenges and decisions are
unchanged. The engine pin is `proof-core 0.5.0`.

**New in 0.5.** The requester side of the agent-to-agent handshake
(`HandshakeClient`) lives in `mintid-agent` (`mintid_agent.handshake`):
`verifier_core.a2a.HandshakeClient` resolves to the same class when
`mintid-agent` is installed, and raises an `ImportError` naming the package
when it is not. The gate (`HandshakeGate`) is unchanged and needs nothing
more. Verification results are unchanged; the engine pin stays
`proof-core 0.5.0`.

**New in 0.5.1.** Faster checks, the same results: the engine's range-proof
generators are built once per process and its Bulletproofs library is
vendored with plain scalar multiplication in the prover (the verifying
surface is unchanged); a presentation is checked in about 60 % of the time.
The engine pin stays `proof-core 0.5.0`.

**New in 0.6.** Additions around the same verification: a refusal can carry
the relying party's onboarding route (`onboarding=OnboardingRoute(…)` on the
x402 middleware and the bridge; bIP-0002 §3.10); the OAuth token-exchange
bridge 0.2.0 (still a draft) carries the agent's pairwise pseudonym with a
`sub` derived per audience, binds a token's life to the status root and
answers `POST /v1/token-introspection`; the service can serve the operator's
usage read (`GET /v1/usage`, behind the operator token, counts only) and its
access line can be switched off (`--no-access-log`; the published image
starts with it off); `verifier_core.domain_validation` checks the
domain-control evidence v1 of bIP-0005 and `verifier_core.verifier_identity`
the issuer's signed verifier identity commitment. The v1 contract, the
decision record and the reason codes are unchanged; the engine pin stays
`proof-core 0.5.0`.

## Example

```python
from verifier_core.build import build_info
from verifier_core.presentation import validate_presentation

print(build_info())  # the pins of this artifact: engine, conformance suite, …

decision = validate_presentation(
    request,            # PresentationRequest — the signed challenge you issued
    envelope,           # PresentationEnvelope — the holder's response
    chain=chain,        # ChainReader        — proven on-chain reads
    nonces=nonces,      # NonceStore         — durable, exactly-once consumption
    proofs=proofs,      # ProofVerifier      — the anonymous-proof engine port
    decisions=log,      # DecisionLog        — the minimal decision sink
    now_unix=now,       # int                — your disciplined clock
)
decision.accepted      # bool
decision.reason_code   # closed vocabulary; a rejection is a decision, not an exception
```

You supply infrastructure (chain access, a nonce store, a decision log, a
clock), never policy.

## Status

The engine is built and in production. An independent audit of its
implementation is scheduled as a milestone; its findings will be published,
and it gates nothing.

## Where to test

On the public testnet and its KYC sandbox, and only there: check the status
line of [its page](https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/17-sandbox-and-testnet.md)
first. Nothing issued on it carries weight. The single-node production chain
is not for third parties and is never a place to test; the local stack of the
main repository runs the same flows on your machine.

## Links

- Documentation: https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/02-python-sdk.md
  (service mode: https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/03-service-mode.md)
- Source: https://gitlab.com/mintid/mintid (`verifier-core`), where issues and
  merge requests go
- Public testnet: https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/17-sandbox-and-testnet.md
- Security: report a vulnerability privately to security@mintid.net, never in
  a public issue; policy: https://gitlab.com/mintid/mintid/-/blob/main/SECURITY.md
- Website: https://mintid.net

## Licence

Apache License 2.0. Author: Marc Molas.

