@verana-labs/vs-agent-plugin-openid4vc 1.12.0-oidc4vc.6 → 2.0.0-dev.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +175 -164
  2. package/build/config.d.ts +19 -3
  3. package/build/config.js +161 -242
  4. package/build/config.js.map +1 -1
  5. package/build/events/openId4VcEvents.d.ts +6 -0
  6. package/build/events/openId4VcEvents.js +17 -0
  7. package/build/events/openId4VcEvents.js.map +1 -0
  8. package/build/index.d.ts +20 -12
  9. package/build/index.js +39 -16
  10. package/build/index.js.map +1 -1
  11. package/build/nestjs/OpenId4VcPlugin.js +27 -43
  12. package/build/nestjs/OpenId4VcPlugin.js.map +1 -1
  13. package/build/nestjs/V2OpenId4VcCredentialExchangesController.d.ts +19 -0
  14. package/build/nestjs/V2OpenId4VcCredentialExchangesController.js +161 -0
  15. package/build/nestjs/V2OpenId4VcCredentialExchangesController.js.map +1 -0
  16. package/build/nestjs/V2OpenId4VcPresentationsController.d.ts +19 -0
  17. package/build/nestjs/V2OpenId4VcPresentationsController.js +147 -0
  18. package/build/nestjs/V2OpenId4VcPresentationsController.js.map +1 -0
  19. package/build/nestjs/V2OpenId4VcSigningCertificatesController.d.ts +17 -0
  20. package/build/nestjs/V2OpenId4VcSigningCertificatesController.js +58 -0
  21. package/build/nestjs/V2OpenId4VcSigningCertificatesController.js.map +1 -0
  22. package/build/nestjs/dto/credential-exchange.dto.d.ts +31 -0
  23. package/build/nestjs/dto/credential-exchange.dto.js +150 -0
  24. package/build/nestjs/dto/credential-exchange.dto.js.map +1 -0
  25. package/build/nestjs/dto/index.d.ts +3 -0
  26. package/build/nestjs/dto/index.js +20 -0
  27. package/build/nestjs/dto/index.js.map +1 -0
  28. package/build/nestjs/dto/presentation.dto.d.ts +57 -0
  29. package/build/nestjs/dto/presentation.dto.js +246 -0
  30. package/build/nestjs/dto/presentation.dto.js.map +1 -0
  31. package/build/nestjs/dto/signing-certificate.dto.d.ts +8 -0
  32. package/build/nestjs/dto/signing-certificate.dto.js +40 -0
  33. package/build/nestjs/dto/signing-certificate.dto.js.map +1 -0
  34. package/build/nestjs/mappers.d.ts +5 -0
  35. package/build/nestjs/mappers.js +31 -0
  36. package/build/nestjs/mappers.js.map +1 -0
  37. package/build/sdk/credentialConfigurationHandlers.d.ts +4 -0
  38. package/build/sdk/credentialConfigurationHandlers.js +57 -0
  39. package/build/sdk/credentialConfigurationHandlers.js.map +1 -0
  40. package/build/sdk/setupOpenId4Vc.d.ts +8 -12
  41. package/build/sdk/setupOpenId4Vc.js +88 -80
  42. package/build/sdk/setupOpenId4Vc.js.map +1 -1
  43. package/build/services/CertificateService.d.ts +6 -22
  44. package/build/services/CertificateService.js +104 -71
  45. package/build/services/CertificateService.js.map +1 -1
  46. package/build/services/IssuerService.d.ts +57 -44
  47. package/build/services/IssuerService.js +284 -103
  48. package/build/services/IssuerService.js.map +1 -1
  49. package/build/services/VerifierService.d.ts +44 -44
  50. package/build/services/VerifierService.js +227 -223
  51. package/build/services/VerifierService.js.map +1 -1
  52. package/build/services/credentialConfigurationBuilder.d.ts +10 -0
  53. package/build/services/credentialConfigurationBuilder.js +88 -0
  54. package/build/services/credentialConfigurationBuilder.js.map +1 -0
  55. package/build/services/presentationRequest.d.ts +51 -0
  56. package/build/services/presentationRequest.js +72 -0
  57. package/build/services/presentationRequest.js.map +1 -0
  58. package/build/services/presentationVerification.d.ts +12 -0
  59. package/build/services/presentationVerification.js +13 -0
  60. package/build/services/presentationVerification.js.map +1 -0
  61. package/build/services/typeMetadataIntegrity.d.ts +6 -0
  62. package/build/services/typeMetadataIntegrity.js +32 -0
  63. package/build/services/typeMetadataIntegrity.js.map +1 -0
  64. package/build/trust/CertificateTrust.d.ts +1 -4
  65. package/build/trust/CertificateTrust.js +10 -15
  66. package/build/trust/CertificateTrust.js.map +1 -1
  67. package/build/trust/keyBinding.d.ts +15 -16
  68. package/build/trust/keyBinding.js +54 -174
  69. package/build/trust/keyBinding.js.map +1 -1
  70. package/build/trust/presentedIssuer.d.ts +9 -0
  71. package/build/trust/presentedIssuer.js +23 -0
  72. package/build/trust/presentedIssuer.js.map +1 -0
  73. package/build/trust/trustDecision.d.ts +31 -0
  74. package/build/trust/trustDecision.js +204 -0
  75. package/build/trust/trustDecision.js.map +1 -0
  76. package/build/trust/types.d.ts +7 -16
  77. package/build/trust/types.js +8 -0
  78. package/build/trust/types.js.map +1 -1
  79. package/build/types.d.ts +29 -51
  80. package/build/types.js +4 -0
  81. package/build/types.js.map +1 -1
  82. package/build/utils/isRecord.d.ts +1 -0
  83. package/build/utils/isRecord.js +7 -0
  84. package/build/utils/isRecord.js.map +1 -0
  85. package/build/utils/serviceDisplay.d.ts +8 -0
  86. package/build/utils/serviceDisplay.js +11 -0
  87. package/build/utils/serviceDisplay.js.map +1 -0
  88. package/package.json +10 -8
  89. package/build/nestjs/CertificatesController.d.ts +0 -11
  90. package/build/nestjs/CertificatesController.js +0 -58
  91. package/build/nestjs/CertificatesController.js.map +0 -1
  92. package/build/nestjs/IssuerController.d.ts +0 -8
  93. package/build/nestjs/IssuerController.js +0 -66
  94. package/build/nestjs/IssuerController.js.map +0 -1
  95. package/build/nestjs/VerifierController.d.ts +0 -8
  96. package/build/nestjs/VerifierController.js +0 -66
  97. package/build/nestjs/VerifierController.js.map +0 -1
  98. package/build/nestjs/dto.d.ts +0 -7
  99. package/build/nestjs/dto.js +0 -34
  100. package/build/nestjs/dto.js.map +0 -1
  101. package/build/services/StatusListService.d.ts +0 -42
  102. package/build/services/StatusListService.js +0 -132
  103. package/build/services/StatusListService.js.map +0 -1
  104. package/build/trust/TrustClient.d.ts +0 -12
  105. package/build/trust/TrustClient.js +0 -120
  106. package/build/trust/TrustClient.js.map +0 -1
  107. package/build/trust/verdict.d.ts +0 -2
  108. package/build/trust/verdict.js +0 -13
  109. package/build/trust/verdict.js.map +0 -1
package/README.md CHANGED
@@ -1,194 +1,205 @@
1
- # OpenID4VC plugin
2
-
3
- `@verana-labs/vs-agent-plugin-openid4vc` adds an optional OpenID4VCI issuer and OpenID4VP verifier to VS Agent.
4
-
5
- The implemented foundation is deliberately narrow:
6
-
7
- - pre-authorized OpenID4VCI issuance of `dc+sd-jwt` credentials;
8
- - DCQL OpenID4VP requests using `direct_post.jwt` and the `x509_hash` client identifier scheme;
9
- - internal admin routes for creating offers and verification requests and reading their state;
10
- - public wallet protocol and metadata routes only;
11
- - certificate, DID-key, and Verana authorization checks before a presentation is accepted.
12
-
13
- This is implementation groundwork, not EUDI certification or a claim of complete HAIP support. W3C VCDM credentials, ISO mdoc, status lists, authorization-code issuance, and production PKI onboarding are outside this foundation. See [OpenID4VC follow-up scope](../../docs/openid4vc-w3c-follow-up.md).
14
-
15
- ## Configure VS Agent
16
-
17
- Use the `vs-agent-openid4vc` image target. It enables `messaging,chat,openid4vc` and requires `OID4VC_CONFIG_FILE`:
18
-
19
- The commands below explicitly select the Colima Docker context. Omit `--context colima` when the active Docker context already points to the intended engine.
1
+ # OpenID4VC
2
+
3
+ `@verana-labs/vs-agent-plugin-openid4vc` gives VS Agent an OpenID4VCI issuer and an OpenID4VP
4
+ verifier for `dc+sd-jwt` credentials. It ships in every `vs-agent` image and turns on when the
5
+ operator sets `OID4VC_CONFIG_FILE_LOCATION`. Nothing else enables it.
6
+
7
+ What it does:
8
+
9
+ - pre-authorized OpenID4VCI issuance of `dc+sd-jwt` credentials, valid until they expire: the
10
+ agent hosts no status list yet, so a credential carries no `status` claim and the `ttlSeconds`
11
+ of its offer is its only bound;
12
+ - OpenID4VP requests in DCQL (`direct_post.jwt`, `x509_hash` or DID client identifier) or, for a
13
+ wallet that predates DCQL, Presentation Exchange (`direct_post`, `x509_san_dns` or DID client
14
+ identifier, since draft 21 predates `x509_hash`);
15
+ - the `/v2/openid4vc` Administration API scope: create an offer or a request, then list, read
16
+ and delete.
17
+
18
+ Out of scope, and not implied: W3C VCDM credentials, ISO mdoc, authorization-code issuance,
19
+ wallet-attestation trust-list distribution, production PKI onboarding, formal conformance.
20
+
21
+ ## Credential types
22
+
23
+ The configuration file carries no credential type. The agent reads them from the VPR instead: one
24
+ per `CredentialSchema` for which it holds an active ISSUER `Participant`, identified by the
25
+ `jsonSchemaCredentialId` of that schema. Claims come from the `credentialSubject` properties of
26
+ the JSON schema, every one of them selectively disclosable, and the display name from its `title`,
27
+ or from the on-chain reference `vpr:verana:{chainId}:cs:{credentialSchemaId}` when it carries none.
28
+ The `vct` is the Type Metadata URL of the type, `{ecosystem base}/vt/vct/{credentialSchemaId}`.
29
+ A schema the agent cannot resolve is skipped with a warning and the rest of the set still stands.
30
+ A `credentialSubject` property named after an SD-JWT VC envelope claim (`vct`, `vct#integrity`,
31
+ `iat`, `exp`, `nbf`, `iss`, `cnf`, `status`) is no claim of the type: the issuer stamps those itself,
32
+ and an offer that carries one is rejected with `400 INVALID_INPUT`. Neither is `id`: SD-JWT VC binds
33
+ the holder through `cnf`, so an `id` the caller supplies would assert a subject the issuer never
34
+ checked.
35
+
36
+ The set follows the VPR without a restart: a `Participant` or `CredentialSchema` notification
37
+ rebuilds it and re-renders the served issuer metadata. `createCredentialOffer` validates the
38
+ claims against the JSON schema (`400 INVALID_INPUT` with the violations), checks the active
39
+ ISSUER `Participant` through the indexer (`409 NOT_AUTHORIZED`, or `503 RESOLVER_UNAVAILABLE`
40
+ when the indexer cannot answer), and reads the Type Metadata document over `https`, without
41
+ following a redirect, to bind every credential to its `vct#integrity`. It answers
42
+ `503 RESOLVER_UNAVAILABLE` when that document cannot be read.
43
+
44
+ ## Not wired up yet
45
+
46
+ The agent hosts no status list, so `createCredentialOffer` answers `404 UNKNOWN_ID` for every
47
+ `statusListId`. [#713](https://github.com/verana-labs/vs-agent/issues/713) carries it.
48
+
49
+ ## Enable it
20
50
 
21
51
  ```bash
22
- docker --context colima build \
23
- --target vs-agent-openid4vc \
24
- -t vs-agent-openid4vc:dev \
25
- -f apps/vs-agent/Dockerfile .
26
-
27
- docker --context colima run --rm \
52
+ docker run --rm \
28
53
  --env-file ./env-vars \
29
- -e OID4VC_CONFIG_FILE=/run/config/openid4vc.json \
54
+ -e OID4VC_CONFIG_FILE_LOCATION=/run/config/openid4vc.json \
30
55
  -v "$PWD/openid4vc.json:/run/config/openid4vc.json:ro" \
31
- -p 3000:3000 \
32
- -p 3001:3001 \
33
- vs-agent-openid4vc:dev
56
+ -p 3000:3000 -p 3001:3001 \
57
+ veranalabs/vs-agent
34
58
  ```
35
59
 
36
- Run both commands from the monorepo root. `env-vars` must set an HTTPS `PUBLIC_API_BASE_URL`, an `AGENT_PUBLIC_DID`, and the normal VS Agent wallet and deployment settings. The JSON file must not contain `publicApiBaseUrl`; VS Agent injects the trusted value from `PUBLIC_API_BASE_URL`. An HTTPS base path is supported and is used verbatim when composing protocol URLs. URLs containing a username or password are rejected.
60
+ `env-vars` carries the normal VS Agent settings, with an `https://` `PUBLIC_API_BASE_URL`. The
61
+ location can also be an `https://` URL, which the agent fetches once at startup without following
62
+ a redirect. With Helm, put the JSON in `openid4vc.config`.
37
63
 
38
- ### Development configuration
64
+ ## Configuration file
39
65
 
40
- This complete `openid4vc.json` shape passes the current configuration validator. The all-zero fingerprint is intentionally redacted and will trust no real peer. Replace it with the exact lowercase SHA-256 fingerprint of the self-signed issuer leaf before testing presentation:
66
+ The agent reads and validates the file at startup, and refuses to start when it cannot read the
67
+ location or validation fails. Keys are camelCase. Full reference: [[VSA-VTI-CFG-ENV-OID]](https://github.com/verana-labs/verana-spec/blob/main/v4/vs-agent/spec.md#vsa-vti-cfg-env-oid-openid4vc).
41
68
 
42
- ```json
43
- {
44
- "issuer": {
45
- "id": "development-issuer",
46
- "displayName": "Development Issuer",
47
- "signing": {
48
- "development": {
49
- "enabled": true,
50
- "commonName": "Local OpenID4VC Issuer"
51
- }
52
- }
53
- },
54
- "verifier": {
55
- "id": "development-verifier",
56
- "displayName": "Development Verifier",
57
- "signing": {
58
- "development": {
59
- "enabled": true,
60
- "commonName": "Local OpenID4VC Verifier"
61
- }
62
- }
63
- },
64
- "trust": {
65
- "resolverUrl": "https://resolver.example/v1/trust",
66
- "timeoutMs": 5000,
67
- "allowedDidWebHosts": ["issuer.example"],
68
- "credentialIssuerCertificates": [],
69
- "developmentCertificateFingerprints": [
70
- "SHA256:0000000000000000000000000000000000000000000000000000000000000000"
71
- ]
72
- },
73
- "credentialConfigurations": [
74
- {
75
- "id": "employee",
76
- "format": "dc+sd-jwt",
77
- "vct": "https://agent.example/oid4vc/vct/employee",
78
- "name": "Employee credential",
79
- "description": "Development employee credential",
80
- "vtjscId": "https://trust.example/vtjsc/employee",
81
- "claims": ["given_name", "family_name", "role"],
82
- "disclosureFrame": ["given_name", "family_name", "role"],
83
- "ttlSeconds": 3600
84
- }
85
- ],
86
- "verifierPolicies": [
87
- {
88
- "id": "employee-check",
89
- "credentialConfigurationId": "employee",
90
- "requestedClaims": ["given_name", "family_name", "role"]
91
- }
92
- ]
93
- }
94
- ```
69
+ Every key is OPTIONAL and `{}` is a valid file. The agent runs both capabilities whenever
70
+ `OID4VC_CONFIG_FILE_LOCATION` is set; the file only carries what the agent cannot derive by
71
+ itself.
72
+
73
+ | Key | Requirement |
74
+ | --- | --- |
75
+ | `issuer` | OPTIONAL. Holds `signing`, `walletAttestationCertificates` and `keyAttestationCertificates`, each OPTIONAL. |
76
+ | `issuer.walletAttestationCertificates` | X.509 roots of the accepted wallet providers. When non-empty, the agent requires a wallet attestation. |
77
+ | `issuer.keyAttestationCertificates` | Roots for OpenID4VCI key attestations. When non-empty, the issuer metadata requires a key attestation on every proof. Absent, the `attestation` proof type is neither advertised nor accepted. |
78
+ | `verifier` | OPTIONAL. Holds an OPTIONAL `signing`. |
95
79
 
96
- Development signing generates and persists a self-signed P-256 certificate for each role, with a DNS SAN derived from `PUBLIC_API_BASE_URL` and a DID URI SAN derived from `AGENT_PUBLIC_DID`. Before completing startup, the plugin publishes only those development public keys to the agent-owned DID through Credo's DID update API. Issuer keys use `assertionMethod`, verifier keys use `authentication`, and deterministic role-specific method IDs make restarts idempotent. When both roles share one DID, the plugin publishes them sequentially so neither relationship is lost.
80
+ The identifier segment of each capability is fixed: `issuer` and `verifier`, so the public paths
81
+ read `/oid4vci/issuer/...` and `/oid4vp/verifier/...`. The file declares neither, and the agent
82
+ refuses to start on an `issuer.id` or a `verifier.id`, as it does on any other unknown key.
97
83
 
98
- The certificate still requires both bindings:
84
+ The display name and the logo the agent publishes come from the ECS Service credential it holds
85
+ about its own DID; no key of the file overrides them.
99
86
 
100
- - its exact fingerprint must be configured by every verifier that accepts it;
101
- - the auto-published public key must remain present in the DID document under `assertionMethod` for issuance and `authentication` for verifier request signing.
87
+ ### Signing modes
102
88
 
103
- A pin does not replace DID key binding or Verana authorization. Development signing is unsuitable for production and is not a HAIP deployment mode.
89
+ **Development signing** (`signing` absent): the agent generates and persists a self-signed P-256
90
+ certificate for the capability, with a common name and a DNS SAN derived from
91
+ `PUBLIC_API_BASE_URL` and a DID URI SAN with the agent DID, and publishes the public key in its
92
+ DID Document before it completes startup (`assertionMethod` for the issuer, `authentication` for
93
+ the verifier). A peer verifier still has to pin the fingerprint that
94
+ `GET /v2/openid4vc/signing-certificates` returns. Unsuitable for production.
104
95
 
105
- ### Production signing and trust
96
+ **Configured signing** (`signing.configured`): `certificateChain` (a non-self-signed leaf first,
97
+ then the intermediates and the root) and the `privateJwk` P-256 key of the leaf. The leaf must
98
+ carry the agent DID as a URI SAN. The agent never publishes a configured key; the operator
99
+ publishes it under `assertionMethod` or `authentication` before startup. Keep the file out of
100
+ source control, logs and image layers.
106
101
 
107
- Configured signing material uses a non-self-signed leaf, followed by any intermediates and the root. The private JWK must be the P-256 key matching the leaf. The values below are redacted and must be supplied through a secret-managed, read-only configuration file:
102
+ ### Development example
108
103
 
109
104
  ```json
110
- {
111
- "signing": {
112
- "configured": {
113
- "certificateChain": [
114
- "MIIB...REDACTED_LEAF_BASE64...",
115
- "MIIC...REDACTED_INTERMEDIATE_BASE64...",
116
- "MIIC...REDACTED_ROOT_BASE64..."
117
- ],
118
- "privateJwk": {
119
- "kty": "EC",
120
- "crv": "P-256",
121
- "x": "REDACTED",
122
- "y": "REDACTED",
123
- "d": "REDACTED",
124
- "alg": "ES256",
125
- "kid": "issuer-signing-key"
126
- }
127
- }
128
- },
129
- "trust": {
130
- "resolverUrl": "https://resolver.example/v1/trust",
131
- "timeoutMs": 5000,
132
- "allowedDidWebHosts": ["issuer.example"],
133
- "credentialIssuerCertificates": ["MIIC...REDACTED_TRUSTED_ROOT_BASE64..."]
134
- }
135
- }
105
+ {}
136
106
  ```
137
107
 
138
- Apply the `signing` object under `issuer`, `verifier`, or both. Each leaf must contain the agent DID as a URI SAN, and its key must match the relevant DID relationship. The plugin never auto-publishes configured production keys; operators must publish them under `assertionMethod` or `authentication` themselves before startup. `credentialIssuerCertificates` contains verifier trust anchors, not peer-supplied chains. Each entry must parse as a currently valid, self-issued CA root with `keyCertSign`; duplicate roots are rejected. Do not put private JWKs in source control, logs, image layers, or public metadata.
108
+ A file with no key at all runs both capabilities under development signing.
139
109
 
140
- `allowedDidWebHosts` is the explicit network trust boundary for issuer DIDs read from verified certificates. Only exact `did:web` and `did:webvh` hosts on this operator-managed list are resolved. Do not populate it from a peer request or certificate. Credo owns the underlying fetch and redirect behavior, so an allowlisted host must have operator-trusted DNS and redirect behavior. Loopback, private, link-local, and unsupported DID targets are rejected before Credo resolution. Resolution returns after at most `timeoutMs`, which must not exceed 30000 milliseconds. The agent's own DID host is derived from `AGENT_PUBLIC_DID` and does not need to be repeated in this list.
110
+ ## Administration API
141
111
 
142
- ### Configuration reference
112
+ Every method lives under `/v2/openid4vc`, behind the Admin API authentication of the agent, and
113
+ answers in the v2 error envelope. Without `OID4VC_CONFIG_FILE_LOCATION`, every path answers `404`.
143
114
 
144
- | Field | Requirement |
145
- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
146
- | `issuer` | Optional when `verifier` is present. Defines `id`, `displayName`, and exactly one signing mode. |
147
- | `issuer.requireWalletAttestation` | Optional. When `true`, `walletAttestationCertificates` must contain locally configured X.509 roots. Trust-list distribution is not implemented. |
148
- | `verifier` | Optional when `issuer` is present. Defines `id`, `displayName`, and exactly one signing mode. |
149
- | `trust` | Required by the verifier. Defines the HTTPS Verana resolver, a 1–30000 ms resolver timeout, exact allowed issuer DID web hosts, valid issuer CA roots, and optional development leaf fingerprints in `SHA256:` plus 64 lowercase hex format. |
150
- | `credentialConfigurations` | Array of stable IDs, `dc+sd-jwt` format, VCT and VTJSC URLs, display fields, allowed claims, disclosure frame, and a 60–31,536,000 second lifetime. |
151
- | `verifierPolicies` | Array mapping a policy ID to one credential configuration and a subset of its claims. |
115
+ | Method | Path | Notes |
116
+ | --- | --- | --- |
117
+ | `createCredentialOffer` | `POST /credential-offer` | `jsonSchemaCredentialId`, `claims`, `ttlSeconds` (60 to 7776000), optional `statusListId` and `statusListIndex` together. Returns `credentialExchangeId` and `url`. `404 UNKNOWN_ID`, `400 INVALID_INPUT`, `409 NOT_AUTHORIZED`, `503 RESOLVER_UNAVAILABLE`. Answers `UNKNOWN_ID` for every status list until #713. |
118
+ | `listCredentialExchanges` | `GET /credential-exchanges` | Filters `jsonSchemaCredentialId`, `state`. Keyset pagination. |
119
+ | `getCredentialExchange` | `GET /credential-exchanges/{credentialExchangeId}` | `credentialExchangeId`, `jsonSchemaCredentialId`, `state`, `createdAt`, `updatedAt`, `expiresAt`, `errorMessage`. Never the claims, the offer URL or the pre-authorized code. |
120
+ | `deleteCredentialExchange` | `DELETE /credential-exchanges/{credentialExchangeId}` | `204`. Deletes the record only, never a credential that a wallet holds. |
121
+ | `createPresentationRequest` | `POST /presentation-request` | `jsonSchemaCredentialId`, optional `requestedClaims` (defaults to every claim of the type), optional `queryLanguage` (`dcql`, `presentation_exchange`), optional `requestSigner` (`x5c`, `did`). Returns `proofExchangeId` and `url`. `404 UNKNOWN_ID`, `400 INVALID_INPUT`, `409 NOT_AUTHORIZED`, `503 RESOLVER_UNAVAILABLE`, `409 INVALID_STATE`. The agent has to hold an active VERIFIER `Participant` for the `CredentialSchema` of the type. |
122
+ | `listPresentations` | `GET /presentations` | Filters `jsonSchemaCredentialId`, `state`. Keyset pagination. |
123
+ | `getPresentation` | `GET /presentations/{proofExchangeId}` | Adds the stored `jsonSchemaCredentialId` and `requestedClaims` of the request, then `cryptographicVerified`, `accepted`, `trust` and `credential` once the wallet answered. |
124
+ | `deletePresentation` | `DELETE /presentations/{proofExchangeId}` | `204`. |
125
+ | `listSigningCertificates` | `GET /signing-certificates` | Bare array of `role`, `development`, `fingerprint`, `certificateChain`. Never a private key. |
152
126
 
153
- Claims named `vct`, `iat`, `exp`, `iss`, or `cnf` are reserved for the credential envelope and cannot be configured.
127
+ Session states are credo's: `OfferCreated`, `OfferUriRetrieved`, `AuthorizationInitiated`,
128
+ `AuthorizationGranted`, `AccessTokenRequested`, `AccessTokenCreated`, `CredentialRequestReceived`,
129
+ `CredentialsPartiallyIssued`, `Completed`, `Error` for an issuance; `RequestCreated`,
130
+ `RequestUriRetrieved`, `ResponseVerified`, `Error` for a verification.
154
131
 
155
- ## Route ownership
132
+ The agent stores `jsonSchemaCredentialId` and `requestedClaims` on the verification session when
133
+ it creates the request, and never infers either from the response of the wallet. A list never
134
+ decides: it reports the stored decision, and a verified session that nobody read yet shows
135
+ `cryptographicVerified: true` and `accepted: false` without `trust`.
156
136
 
157
- The control and protocol surfaces are intentionally separate.
137
+ ## Public endpoints
158
138
 
159
- | Surface | Method and path | Owner and purpose |
160
- | -------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
161
- | Internal admin | `POST /v1/oid4vc/offers` | Plugin controller. Creates a pre-authorized offer from `credentialConfigurationId` and all configured claims. |
162
- | Internal admin | `GET /v1/oid4vc/offers/:id` | Plugin controller. Returns safe issuance state only. |
163
- | Internal admin | `POST /v1/oid4vc/verifier/requests` | Plugin controller. Creates a request from `policyId`. |
164
- | Internal admin | `GET /v1/oid4vc/verifier/sessions/:id` | Plugin controller. Returns protocol state and the bounded trust result. |
165
- | Internal admin | `GET /v1/oid4vc/certificates` | Plugin controller. Returns the configured roles' public signing certificates: leaf fingerprint (`SHA256:` pin format) and base64 chain. Never returns private keys. |
166
- | Public | `GET /oid4vc/vct/:configurationId` | Plugin route. Returns configured SD-JWT VC type metadata, extended with `relatedJsonSchemaCredentialId` (the ecosystem VTJSC) so wallets can verify schema governance and issuer/verifier accreditation through the Verana resolver. |
167
- | Public | dynamic paths below `/.well-known/*`, `/oid4vci/:issuerId/*`, and `/oid4vp/:verifierId/*` | Pinned Credo router. Serves issuer/OAuth metadata, returned offer and request URIs, and wallet token, credential, authorization-request, and authorization-response traffic. |
139
+ Served on the public listener, without Admin API authentication. A wallet follows the URLs the
140
+ Admin API and the metadata return; it never builds a path itself.
168
141
 
169
- Credo derives protocol paths from its current route configuration and record IDs. Wallets should follow the URIs returned by the admin API and metadata rather than constructing undocumented paths.
170
-
171
- The admin routes have the default `INTERNAL` access mode. They are absent from the public listener and unavailable through the corporation bearer-authenticated listener. The internal listener is network-trusted by default, so production deployments must isolate it or place it behind an authenticated reverse proxy. Credential offers are bearer capabilities and must not be logged or exposed through a public convenience endpoint.
142
+ | Path | Purpose |
143
+ | --- | --- |
144
+ | `/.well-known/openid-credential-issuer`, `/.well-known/oauth-authorization-server`, `/.well-known/jwt-vc-issuer` | Issuer and authorization-server metadata, also at the path-inserted forms. |
145
+ | `/oid4vci/issuer/...` | Token and credential traffic of the issuer capability. |
146
+ | `/oid4vp/verifier/...` | Authorization request and response traffic of the verifier capability. |
172
147
 
173
148
  ## Trust decision
174
149
 
175
- A verifier accepts a presentation only after this sequence succeeds:
176
-
177
- 1. Credo verifies the OpenID4VP response, nonce, audience, holder binding, SD-JWT disclosure, signature, and X.509 chain against configured roots or an exact development leaf pin.
178
- 2. The plugin reads a DID only from a URI SAN after X.509 validation succeeds.
179
- 3. Before network resolution, the DID must be a well-formed `did:web` or `did:webvh` on the operator allowlist, with no loopback, private, or link-local target. The resolved document ID must exactly match the requested DID.
180
- 4. The certificate public key must match a verification method authorized by that DID document under `assertionMethod`. The plugin uses `authentication` for its own verifier request-signing certificate during startup.
181
- 5. The Verana resolver must return `TRUSTED` for the issuer DID and authorize that issuer for the credential configuration's `vtjscId`.
182
- 6. The result is accepted only for the exact `TRUSTED_AUTHORIZED` verdict.
183
-
184
- Missing or invalid chains, SAN errors, key mismatch, unresolvable DIDs, resolver timeout, malformed responses, non-`TRUSTED` status, and missing authorization all fail closed.
185
-
186
- ## Verification evidence
187
-
188
- | Path | Evidence |
189
- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
190
- | Pinned Credo `0.7.1-pr-2704-20260630143332`, in process | Automated issuance and presentation tests cover a pre-authorized offer, holder-bound `dc+sd-jwt`, DCQL, `x509_hash`, `direct_post.jwt`, `TRUSTED_AUTHORIZED` acceptance, DID-key mismatch, unauthorized issuers, resolver failure, and response replay. |
191
- | Android or EUDI wallet | No live result, wallet version, or date is recorded for this foundation branch. |
192
- | Official online interoperability tools | No result is recorded for this foundation branch. |
193
-
194
- The automated path proves behavior between local Credo agents. It is not external-wallet evidence or formal conformance evidence.
150
+ Nothing configures it: no resolver URL, no allowed `did:web` host, no credential-issuer root and no
151
+ development fingerprint. The agent decides on the eight steps of [[VSA-VTI-FLOW-VERIFY-OID]](https://github.com/verana-labs/verana-spec/blob/main/v4/vs-agent/spec.md#vsa-vti-flow-verify-oid-openid4vp-trust-decision),
152
+ on its DID resolver and on the VPR, and fails closed at every one of them.
153
+
154
+ `createPresentationRequest` resolves the `jsonSchemaCredentialId` to its `CredentialSchema`
155
+ through the VTJSC (`404 UNKNOWN_ID` when it binds to none), requires an active VERIFIER
156
+ `Participant` of the agent for that schema (`409 NOT_AUTHORIZED`, `503 RESOLVER_UNAVAILABLE`), and
157
+ stores the type and the requested claims on the session. The wallet then answers, and credo runs
158
+ step 1: the nonce, the audience, the holder binding, the disclosures, the signature, the validity
159
+ period (`exp` is required) and the `status` claim, if the credential carries one. For an `x5c`
160
+ issuer credo trusts the leaf certificate the wallet presented and nothing above it: step 4 binds
161
+ the key through the DID Document, so no certificate authority takes part. A failure of step 1 ends
162
+ the session in `Error`, with `cryptographicVerified: false`.
163
+
164
+ The first `getPresentation` of a `ResponseVerified` session runs the rest and stores the verdict:
165
+
166
+ | Step | Check | Verdict on failure |
167
+ | --- | --- | --- |
168
+ | 2 | issuer DID: `iss` when it is a DID, else the URI SAN of the leaf certificate | `UNTRUSTED` |
169
+ | 3 | a well-formed `did:web` or `did:webvh`, resolved fresh within 5 seconds, with the requested `id` | `UNTRUSTED` (another method, or a document with another `id`), or `RESOLVER_UNAVAILABLE` when the DID does not resolve |
170
+ | 4 | the signing key under `assertionMethod` of that DID Document | `UNTRUSTED` |
171
+ | 5 | the Type Metadata at `vct`, read over `https` without a redirect, hashes to `vct#integrity` and names the VTJSC of the request | `UNTRUSTED`, or `RESOLVER_UNAVAILABLE` when the document cannot be read |
172
+ | 6 | the `status` claim, verified by credo in step 1 against the issuer chain | the session ends in `Error` |
173
+ | 7 | the Verifiable Trust resolution of the issuer DID answers `TRUSTED` within 15 seconds (a positive answer is cached for 5 minutes, as for a DIDComm peer), and the VPR holds an active ISSUER `Participant` of it for the `CredentialSchema` | `UNTRUSTED`, `TRUSTED_NOT_AUTHORIZED`, or `RESOLVER_UNAVAILABLE` when a registry, an endpoint or the indexer does not answer |
174
+ | 8 | `accepted` is `true` for `TRUSTED_AUTHORIZED` only | |
175
+
176
+ `RESOLVER_UNAVAILABLE` is never stored, so the next read retries. `listPresentations` never
177
+ decides: it reports the stored verdict, and a verified session nobody read yet shows
178
+ `cryptographicVerified: true`, `accepted: false` and no `trust`. The `evidence` of a verdict
179
+ carries the issuer `did`, the `trustStatus` of the resolution, the `jsonSchemaCredentialId` and the
180
+ `credentialSchemaId` of the request, `authorized`, the `queries` the agent ran and, when the verdict is not
181
+ `TRUSTED_AUTHORIZED`, a `note` that names the failed step.
182
+
183
+ Credo, not the plugin, runs step 6, and the spec asks for two things credo does not do yet: it
184
+ fetches the Status List Token with its own client, not under the network boundary of step 3, and it
185
+ does not compare the `sub` of the token with the `uri` of the claim.
186
+ [credo-ts#3015](https://github.com/openwallet-foundation/credo-ts/pull/3015) adds the option that
187
+ lets the plugin take the fetch over; [#754](https://github.com/verana-labs/vs-agent/issues/754)
188
+ carries the address ban.
189
+
190
+ ## Wallet accommodations
191
+
192
+ The public router adapts a few responses to specific wallets, each one scoped as narrowly as the
193
+ wallet's behaviour allows: openid4vci-kt (EUDI reference wallet) accept header and
194
+ `key_attestations_required`; swiyu plain-JSON metadata and closed `ProofType` enum; wwWallet
195
+ `scope` and DPoP algorithms; NL Wallet certificate-bound signed metadata; MOSIP Inji EdDSA
196
+ request signing under the parallel did:web and Presentation Exchange details. Each lives next to
197
+ the code it changes, with a one-line note.
198
+
199
+ ## Tests
200
+
201
+ `pnpm --filter @verana-labs/vs-agent-plugin-openid4vc exec vitest run` runs the unit tests and the
202
+ in-process end-to-end tests, which start real credo agents for the issuer, the holder and the
203
+ verifier, drive a pre-authorized issuance through to a stored holder-bound credential, and present
204
+ it back to the verifier through to a stored trust verdict. No external wallet or conformance
205
+ evidence is recorded here; see the Verana Playground for recorded wallet scenarios.
package/build/config.d.ts CHANGED
@@ -1,5 +1,21 @@
1
- import type { OpenId4VcCredentialConfiguration, OpenId4VcPluginOptions, OpenId4VcVerifierPolicy } from './types';
2
- export declare function validateOpenId4VcOptions(options: OpenId4VcPluginOptions): void;
1
+ import type { OpenId4VcConfigurationFile, OpenId4VcCredentialConfiguration, OpenId4VcPluginOptions } from './types';
2
+ import type { SchemaViolation } from '@verana-labs/vs-agent-sdk';
3
+ export declare const ISSUER_CAPABILITY_ID = "issuer";
4
+ export declare const VERIFIER_CAPABILITY_ID = "verifier";
5
+ export declare const OFFER_TTL_SECONDS_MIN = 60;
6
+ export declare const OFFER_TTL_SECONDS_MAX = 7776000;
7
+ export declare function isReservedClaimName(name: string): boolean;
8
+ /** A claim set the credential type refuses, which the Administration API answers as INVALID_INPUT. */
9
+ export declare class OfferClaimsError extends Error {
10
+ readonly violations?: SchemaViolation[] | undefined;
11
+ constructor(message: string, violations?: SchemaViolation[] | undefined);
12
+ }
13
+ /** [VSA-VTI-CFG-ENV-OID] Validation of the OpenID4VC configuration file. */
14
+ export declare function parseOpenId4VcConfiguration(document: unknown): OpenId4VcConfigurationFile;
3
15
  export declare function findCredentialConfiguration(options: Pick<OpenId4VcPluginOptions, 'credentialConfigurations'>, id: string): OpenId4VcCredentialConfiguration | undefined;
4
- export declare function findVerifierPolicy(options: Pick<OpenId4VcPluginOptions, 'verifierPolicies'>, id: string): OpenId4VcVerifierPolicy | undefined;
5
16
  export declare function parseOfferClaims(configuration: OpenId4VcCredentialConfiguration, input: unknown): Record<string, unknown>;
17
+ export declare function parseOfferTtlSeconds(input: unknown): number;
18
+ export declare function parseOfferIssuanceMetadata(configuration: OpenId4VcCredentialConfiguration, input: unknown): {
19
+ claims: Record<string, unknown>;
20
+ ttlSeconds: number;
21
+ };