Skip to content

feat(oid4vc): add mDOC credential issuance and verification (ISO 18013-5)#22

Open
burdettadam wants to merge 5 commits intomainfrom
feat/mso-mdoc-new
Open

feat(oid4vc): add mDOC credential issuance and verification (ISO 18013-5)#22
burdettadam wants to merge 5 commits intomainfrom
feat/mso-mdoc-new

Conversation

@burdettadam
Copy link
Collaborator

mDOC support via isomdl-uniffi. Depends on #21.

…tion

Implements OID4VCI mso_mdoc credential issuance and OID4VP mDOC
presentation verification using the isomdl-uniffi Rust library.

Key changes:
- Rewrite mso_mdoc credential processor with isomdl-uniffi bindings
- Add mDOC issuer (mdoc/issuer.py) and verifier (mdoc/verifier.py)
- Add MSO issuer/verifier (consolidated from mso/ into mdoc/)
- Add key generation routes for mDOC signing keys
- Add storage layer: trust anchors, certificates, keys, config
- Add x.509 cert chain handling and PEM splitting utilities
- Add trust anchor guard (fail-closed) and cert expiry validation
- Remove superseded mso/ package and x509.py (merged into mdoc/)
- Update Docker/CI to install isomdl-uniffi platform wheel
- Add OID4VC conformance tests GitHub Actions workflow
- Fix ConnectError retry in integration test credo_client fixture

Signed-off-by: Adam Burdett <burdettadam@gmail.com>
The upstream isomdl-uniffi library now exposes issuer_signed_b64() which
serialises directly to an IssuerSigned struct that carries the correct
serde rename attributes for ISO 18013-5 section 8.3 camelCase keys
(issuerAuth, nameSpaces) and array namespace values.

This removes the Python-side _patch_mdoc_keys workaround which had to
decode CBOR, rename keys by hand, and re-encode. The fix is now in the
right layer (Rust serialisation types) rather than a post-processing hack.

Change summary:
- Remove import base64 (only used by _patch_mdoc_keys)
- Remove _patch_mdoc_keys() entirely
- Replace stringify() + _patch_mdoc_keys() call with mdoc.issuer_signed_b64()
- Add test_mdoc_sign_emits_iso_cbor_keys to verify camelCase keys and
  array namespace values end-to-end through isomdl_mdoc_sign()

Signed-off-by: Adam Burdett <burdettadam@gmail.com>
Namespace element values are now passed to Mdoc.create_and_sign() as JSON
strings (stdlib json.dumps) rather than CBOR bytes (cbor2.dumps).

The Rust layer gains a json_to_cbor() converter so it internalises the
CBOR encoding, eliminating the need for callers to own a CBOR library.

Changes:
- mso_mdoc/mdoc/issuer.py: remove `import cbor2`; cbor2.dumps -> json.dumps
  in _prepare_mdl_namespaces and _prepare_generic_namespaces
- integration/tests/mdoc/test_pki.py: namespace inputs updated to json.dumps;
  cbor2 retained (hard import) for the DeviceResponse construction below
- pyproject.toml: cbor2 removed from [dependencies] optional and from
  mso_mdoc extras; added to [tool.poetry.group.dev.dependencies]

Signed-off-by: Adam Burdett <burdettadam@gmail.com>
Signed-off-by: Adam Burdett <burdettadam@gmail.com>
Trust anchors are exclusively stored in and retrieved from the Askar
wallet. 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
- Simplify plugin __init__.py / on_startup (no trust store init at startup)
- 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

Signed-off-by: Adam Burdett <burdettadam@gmail.com>
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