@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.
- package/README.md +175 -164
- package/build/config.d.ts +19 -3
- package/build/config.js +161 -242
- package/build/config.js.map +1 -1
- package/build/events/openId4VcEvents.d.ts +6 -0
- package/build/events/openId4VcEvents.js +17 -0
- package/build/events/openId4VcEvents.js.map +1 -0
- package/build/index.d.ts +20 -12
- package/build/index.js +39 -16
- package/build/index.js.map +1 -1
- package/build/nestjs/OpenId4VcPlugin.js +27 -43
- package/build/nestjs/OpenId4VcPlugin.js.map +1 -1
- package/build/nestjs/V2OpenId4VcCredentialExchangesController.d.ts +19 -0
- package/build/nestjs/V2OpenId4VcCredentialExchangesController.js +161 -0
- package/build/nestjs/V2OpenId4VcCredentialExchangesController.js.map +1 -0
- package/build/nestjs/V2OpenId4VcPresentationsController.d.ts +19 -0
- package/build/nestjs/V2OpenId4VcPresentationsController.js +147 -0
- package/build/nestjs/V2OpenId4VcPresentationsController.js.map +1 -0
- package/build/nestjs/V2OpenId4VcSigningCertificatesController.d.ts +17 -0
- package/build/nestjs/V2OpenId4VcSigningCertificatesController.js +58 -0
- package/build/nestjs/V2OpenId4VcSigningCertificatesController.js.map +1 -0
- package/build/nestjs/dto/credential-exchange.dto.d.ts +31 -0
- package/build/nestjs/dto/credential-exchange.dto.js +150 -0
- package/build/nestjs/dto/credential-exchange.dto.js.map +1 -0
- package/build/nestjs/dto/index.d.ts +3 -0
- package/build/nestjs/dto/index.js +20 -0
- package/build/nestjs/dto/index.js.map +1 -0
- package/build/nestjs/dto/presentation.dto.d.ts +57 -0
- package/build/nestjs/dto/presentation.dto.js +246 -0
- package/build/nestjs/dto/presentation.dto.js.map +1 -0
- package/build/nestjs/dto/signing-certificate.dto.d.ts +8 -0
- package/build/nestjs/dto/signing-certificate.dto.js +40 -0
- package/build/nestjs/dto/signing-certificate.dto.js.map +1 -0
- package/build/nestjs/mappers.d.ts +5 -0
- package/build/nestjs/mappers.js +31 -0
- package/build/nestjs/mappers.js.map +1 -0
- package/build/sdk/credentialConfigurationHandlers.d.ts +4 -0
- package/build/sdk/credentialConfigurationHandlers.js +57 -0
- package/build/sdk/credentialConfigurationHandlers.js.map +1 -0
- package/build/sdk/setupOpenId4Vc.d.ts +8 -12
- package/build/sdk/setupOpenId4Vc.js +88 -80
- package/build/sdk/setupOpenId4Vc.js.map +1 -1
- package/build/services/CertificateService.d.ts +6 -22
- package/build/services/CertificateService.js +104 -71
- package/build/services/CertificateService.js.map +1 -1
- package/build/services/IssuerService.d.ts +57 -44
- package/build/services/IssuerService.js +284 -103
- package/build/services/IssuerService.js.map +1 -1
- package/build/services/VerifierService.d.ts +44 -44
- package/build/services/VerifierService.js +227 -223
- package/build/services/VerifierService.js.map +1 -1
- package/build/services/credentialConfigurationBuilder.d.ts +10 -0
- package/build/services/credentialConfigurationBuilder.js +88 -0
- package/build/services/credentialConfigurationBuilder.js.map +1 -0
- package/build/services/presentationRequest.d.ts +51 -0
- package/build/services/presentationRequest.js +72 -0
- package/build/services/presentationRequest.js.map +1 -0
- package/build/services/presentationVerification.d.ts +12 -0
- package/build/services/presentationVerification.js +13 -0
- package/build/services/presentationVerification.js.map +1 -0
- package/build/services/typeMetadataIntegrity.d.ts +6 -0
- package/build/services/typeMetadataIntegrity.js +32 -0
- package/build/services/typeMetadataIntegrity.js.map +1 -0
- package/build/trust/CertificateTrust.d.ts +1 -4
- package/build/trust/CertificateTrust.js +10 -15
- package/build/trust/CertificateTrust.js.map +1 -1
- package/build/trust/keyBinding.d.ts +15 -16
- package/build/trust/keyBinding.js +54 -174
- package/build/trust/keyBinding.js.map +1 -1
- package/build/trust/presentedIssuer.d.ts +9 -0
- package/build/trust/presentedIssuer.js +23 -0
- package/build/trust/presentedIssuer.js.map +1 -0
- package/build/trust/trustDecision.d.ts +31 -0
- package/build/trust/trustDecision.js +204 -0
- package/build/trust/trustDecision.js.map +1 -0
- package/build/trust/types.d.ts +7 -16
- package/build/trust/types.js +8 -0
- package/build/trust/types.js.map +1 -1
- package/build/types.d.ts +29 -51
- package/build/types.js +4 -0
- package/build/types.js.map +1 -1
- package/build/utils/isRecord.d.ts +1 -0
- package/build/utils/isRecord.js +7 -0
- package/build/utils/isRecord.js.map +1 -0
- package/build/utils/serviceDisplay.d.ts +8 -0
- package/build/utils/serviceDisplay.js +11 -0
- package/build/utils/serviceDisplay.js.map +1 -0
- package/package.json +10 -8
- package/build/nestjs/CertificatesController.d.ts +0 -11
- package/build/nestjs/CertificatesController.js +0 -58
- package/build/nestjs/CertificatesController.js.map +0 -1
- package/build/nestjs/IssuerController.d.ts +0 -8
- package/build/nestjs/IssuerController.js +0 -66
- package/build/nestjs/IssuerController.js.map +0 -1
- package/build/nestjs/VerifierController.d.ts +0 -8
- package/build/nestjs/VerifierController.js +0 -66
- package/build/nestjs/VerifierController.js.map +0 -1
- package/build/nestjs/dto.d.ts +0 -7
- package/build/nestjs/dto.js +0 -34
- package/build/nestjs/dto.js.map +0 -1
- package/build/services/StatusListService.d.ts +0 -42
- package/build/services/StatusListService.js +0 -132
- package/build/services/StatusListService.js.map +0 -1
- package/build/trust/TrustClient.d.ts +0 -12
- package/build/trust/TrustClient.js +0 -120
- package/build/trust/TrustClient.js.map +0 -1
- package/build/trust/verdict.d.ts +0 -2
- package/build/trust/verdict.js +0 -13
- package/build/trust/verdict.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,194 +1,205 @@
|
|
|
1
|
-
# OpenID4VC
|
|
2
|
-
|
|
3
|
-
`@verana-labs/vs-agent-plugin-openid4vc`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 --
|
|
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
|
|
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
|
-
-
|
|
33
|
-
vs-agent-openid4vc:dev
|
|
56
|
+
-p 3000:3000 -p 3001:3001 \
|
|
57
|
+
veranalabs/vs-agent
|
|
34
58
|
```
|
|
35
59
|
|
|
36
|
-
|
|
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
|
-
|
|
64
|
+
## Configuration file
|
|
39
65
|
|
|
40
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
108
|
+
A file with no key at all runs both capabilities under development signing.
|
|
139
109
|
|
|
140
|
-
|
|
110
|
+
## Administration API
|
|
141
111
|
|
|
142
|
-
|
|
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
|
-
|
|
|
145
|
-
|
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
137
|
+
## Public endpoints
|
|
158
138
|
|
|
159
|
-
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
194
|
-
|
|
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
|
|
2
|
-
|
|
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
|
+
};
|