Skip to content

feat(mso_mdoc): wallet-scoped trust registry, drop FileTrustStore#23

Closed
burdettadam wants to merge 1 commit intofeat/mso-mdoc-newfrom
feat/trust-registry
Closed

feat(mso_mdoc): wallet-scoped trust registry, drop FileTrustStore#23
burdettadam wants to merge 1 commit intofeat/mso-mdoc-newfrom
feat/trust-registry

Conversation

@burdettadam
Copy link
Collaborator

Summary

This PR adds a wallet-scoped trust registry for mso_mdoc credential verification.
Trust anchors are now exclusively stored in the Askar wallet, one registry per sub-wallet (tenant).
The FileTrustStore (filesystem PEM directory) and OID4VC_MDOC_TRUST_STORE_TYPE env var are removed.

Changes

Trust Registry (wallet-scoped)

  • WalletTrustStore: New Askar-backed trust store; built fresh per-request from the calling profile, ensuring each tenant's Askar partition is queried automatically
  • storage/: New module with MdocStorageManager providing CRUD for trust anchors, signing keys, and certificates — all wallet-scoped
  • key_routes.py: REST endpoints: POST/GET/DELETE /mso_mdoc/trust-anchors
  • key_generation.py: Default EC key pair and self-signed certificate generation on startup

Verifier (reimplemented)

  • mdoc/verifier.py: Complete reimplementation with MsoMdocCredVerifier and MsoMdocPresVerifier; verification always uses a fresh WalletTrustStore(profile) — no env var toggle
  • mdoc/utils.py: PEM chain splitting (split_pem_chain) and trust anchor flattening helpers

Credential Processor

  • cred_processor.py: MsoMdocCredProcessor now implements CredVerifier and PresVerifier; verify_credential/verify_presentation delegate to the new verifier classes using WalletTrustStore(profile)

Plugin Setup

  • __init__.py: Registers cred_verifier and pres_verifier on startup; on_startup initializes storage and default keys

Removals

  • FileTrustStore class removed entirely
  • OID4VC_MDOC_TRUST_STORE_TYPE env var removed
  • mso/ subpackage removed (replaced by mdoc/ implementation)
  • x509.py and mdoc/exceptions.py removed (superseded)

Test Updates

  • Remove TestFileTrustStore tests (class is gone)
  • Rewrite test_wallet_trust_store_per_request.py for always-wallet design
  • Remove FileTrustStore imports from test_review_issues.py and test_verifier.py
  • test_pki.py: Use json.dumps() instead of cbor2.dumps() for namespace values

Design

Each sub-wallet (tenant) has its own isolated trust anchor registry. When a verification request arrives, WalletTrustStore(profile) is constructed from the calling profile — never a stale or shared trust store from plugin startup time. This ensures tenant isolation in multi-tenant deployments.

The trust anchor CRUD routes (key_routes.py) allow operators to manage which root CA certificates are trusted per-tenant.

@burdettadam burdettadam force-pushed the feat/trust-registry branch from 96f2c86 to 03f25f9 Compare March 6, 2026 22:21
Trust anchors are now exclusively stored in and retrieved from the Askar
wallet, making the trust registry per-wallet scoped. Sub-wallets maintain
their own trust registry with their own root authority certificates.

- Remove FileTrustStore (filesystem PEM directory) entirely
- Remove OID4VC_MDOC_TRUST_STORE_TYPE env var and create_trust_store()
- verify_credential / verify_presentation always build a fresh
  WalletTrustStore(profile) from the calling profile per-request,
  ensuring each tenant Askar partition is queried correctly
- Remove TestFileTrustStore unit tests (class no longer exists)
- Rewrite test_wallet_trust_store_per_request.py for always-wallet design
- Remove FileTrustStore imports from test_review_issues / test_verifier
- Simplify plugin __init__.py / on_startup (no trust store init at startup)

Depends-on: feat/mso-mdoc-new

Signed-off-by: Adam Burdett <burdettadam@gmail.com>
@burdettadam burdettadam force-pushed the feat/trust-registry branch from 03f25f9 to 9a5d9d8 Compare March 6, 2026 23:00
@burdettadam burdettadam changed the base branch from main to feat/mso-mdoc-new March 6, 2026 23:00
@burdettadam
Copy link
Collaborator Author

Superseded — FileTrustStore removal folded into feat/mso-mdoc-new (PR #22) directly.

@burdettadam burdettadam closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant