@verana-labs/vs-agent-plugin-openid4vc 2.0.0-dev.82 → 2.0.0-dev.84

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 (38) hide show
  1. package/README.md +44 -22
  2. package/build/index.d.ts +1 -1
  3. package/build/index.js +2 -1
  4. package/build/index.js.map +1 -1
  5. package/build/nestjs/OpenId4VcPlugin.js +7 -0
  6. package/build/nestjs/OpenId4VcPlugin.js.map +1 -1
  7. package/build/nestjs/dto/presentation.dto.d.ts +1 -0
  8. package/build/nestjs/dto/presentation.dto.js +14 -2
  9. package/build/nestjs/dto/presentation.dto.js.map +1 -1
  10. package/build/sdk/setupOpenId4Vc.js +1 -8
  11. package/build/sdk/setupOpenId4Vc.js.map +1 -1
  12. package/build/services/IssuerService.d.ts +18 -0
  13. package/build/services/IssuerService.js +64 -2
  14. package/build/services/IssuerService.js.map +1 -1
  15. package/build/services/VerifierService.d.ts +5 -1
  16. package/build/services/VerifierService.js +73 -33
  17. package/build/services/VerifierService.js.map +1 -1
  18. package/build/services/credentialConfigurationBuilder.d.ts +7 -0
  19. package/build/services/credentialConfigurationBuilder.js +19 -12
  20. package/build/services/credentialConfigurationBuilder.js.map +1 -1
  21. package/build/services/presentationRequest.js +8 -3
  22. package/build/services/presentationRequest.js.map +1 -1
  23. package/build/trust/keyBinding.d.ts +13 -1
  24. package/build/trust/keyBinding.js +25 -13
  25. package/build/trust/keyBinding.js.map +1 -1
  26. package/build/trust/presentedIssuer.d.ts +9 -0
  27. package/build/trust/presentedIssuer.js +23 -0
  28. package/build/trust/presentedIssuer.js.map +1 -0
  29. package/build/trust/trustDecision.d.ts +31 -0
  30. package/build/trust/trustDecision.js +204 -0
  31. package/build/trust/trustDecision.js.map +1 -0
  32. package/build/trust/types.d.ts +3 -1
  33. package/build/trust/types.js +1 -1
  34. package/build/trust/types.js.map +1 -1
  35. package/build/types.d.ts +4 -1
  36. package/build/types.js +2 -1
  37. package/build/types.js.map +1 -1
  38. package/package.json +2 -2
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decidePresentationTrust = decidePresentationTrust;
4
+ const core_1 = require("@credo-ts/core");
5
+ const vs_agent_sdk_1 = require("@verana-labs/vs-agent-sdk");
6
+ const config_1 = require("../config");
7
+ const CertificateService_1 = require("../services/CertificateService");
8
+ const isRecord_1 = require("../utils/isRecord");
9
+ const keyBinding_1 = require("./keyBinding");
10
+ /** The Verifiable Trust resolution reads the DID Document, its linked VPs and the VPR; 5 s is too tight. */
11
+ const TRUST_RESOLUTION_TIMEOUT_MS = 15000;
12
+ // verre answers these codes for a read that failed, not for a rule the DID broke.
13
+ const UNAVAILABLE_RESOLUTION_CODES = [
14
+ vs_agent_sdk_1.TrustErrorCode.INVALID,
15
+ vs_agent_sdk_1.TrustErrorCode.INVALID_REQUEST,
16
+ ];
17
+ /**
18
+ * [VSA-VTI-FLOW-VERIFY-OID] steps 2 to 8 on a credential that passed step 1: credo verified the
19
+ * response, the holder binding, the disclosures, the signature, the validity period and the `status`
20
+ * claim (step 6) before the session reached `ResponseVerified`. Every step fails closed. A step the
21
+ * agent cannot complete answers `RESOLVER_UNAVAILABLE`, which the caller never stores, so the next
22
+ * read retries it.
23
+ */
24
+ async function decidePresentationTrust(credential, request, dependencies) {
25
+ const evidence = {
26
+ did: null,
27
+ trustStatus: null,
28
+ jsonSchemaCredentialId: request.jsonSchemaCredentialId,
29
+ credentialSchemaId: request.credentialSchemaId,
30
+ authorized: null,
31
+ queries: [],
32
+ };
33
+ const verdict = await runSteps(credential, request, dependencies, evidence);
34
+ return {
35
+ cryptographicVerified: true,
36
+ accepted: verdict === 'TRUSTED_AUTHORIZED',
37
+ trust: { verdict, evidence },
38
+ credential: presentedCredential(credential),
39
+ };
40
+ }
41
+ class StepFailure extends Error {
42
+ constructor(verdict, note) {
43
+ super(note);
44
+ this.verdict = verdict;
45
+ this.name = 'StepFailure';
46
+ }
47
+ }
48
+ async function runSteps(credential, request, dependencies, evidence) {
49
+ try {
50
+ const did = issuerDidOf(credential);
51
+ evidence.did = did;
52
+ await assertIssuerKeyBound(credential, did, dependencies, evidence);
53
+ await assertTypeMetadataBound(credential, request.jsonSchemaCredentialId, dependencies, evidence);
54
+ await assertIssuerTrusted(did, dependencies, evidence);
55
+ await assertIssuerAuthorized(did, request.credentialSchemaId, dependencies, evidence);
56
+ return 'TRUSTED_AUTHORIZED';
57
+ }
58
+ catch (error) {
59
+ if (!(error instanceof StepFailure))
60
+ throw error;
61
+ evidence.note = error.message;
62
+ return error.verdict;
63
+ }
64
+ }
65
+ // Step 2, [VT-CRED-SDJWT-6]: `iss` when it is a DID, else the URI SAN of the leaf of `x5c`.
66
+ function issuerDidOf(credential) {
67
+ var _a, _b, _c;
68
+ const issuer = credential.issuer;
69
+ if (issuer.method === 'did')
70
+ return (_b = (_a = (0, core_1.tryParseDid)(issuer.didUrl)) === null || _a === void 0 ? void 0 : _a.did) !== null && _b !== void 0 ? _b : fail('UNTRUSTED', 'the issuer DID URL is no DID');
71
+ const fromIss = typeof credential.payload.iss === 'string' ? (_c = (0, core_1.tryParseDid)(credential.payload.iss)) === null || _c === void 0 ? void 0 : _c.did : undefined;
72
+ if (fromIss)
73
+ return fromIss;
74
+ try {
75
+ return (0, CertificateService_1.didFromValidatedCertificate)(issuer.x5c[0]);
76
+ }
77
+ catch (_d) {
78
+ return fail('UNTRUSTED', 'the credential carries no DID in iss nor in the URI SAN of its leaf certificate');
79
+ }
80
+ }
81
+ // Steps 3 and 4: a well-formed did:web or did:webvh, resolved under the network boundary, whose
82
+ // DID Document authorizes the issuer key under assertionMethod.
83
+ async function assertIssuerKeyBound(credential, did, dependencies, evidence) {
84
+ if (!isDidWeb(did))
85
+ fail('UNTRUSTED', `the issuer DID "${did}" is no did:web nor did:webvh`);
86
+ evidence.queries.push(`resolve ${did}`);
87
+ const didDocument = await (0, keyBinding_1.resolveDidDocument)(dependencies.agent, did);
88
+ if (didDocument === 'unresolvable') {
89
+ fail('RESOLVER_UNAVAILABLE', `the issuer DID "${did}" could not be resolved`);
90
+ }
91
+ if (didDocument === 'other-id') {
92
+ fail('UNTRUSTED', `the DID Document of the issuer DID "${did}" carries another id`);
93
+ }
94
+ const issuer = credential.issuer;
95
+ let issuerKey;
96
+ if (issuer.method === 'x5c') {
97
+ issuerKey = issuer.x5c[0].publicJwk;
98
+ }
99
+ else {
100
+ try {
101
+ issuerKey = (0, core_1.getPublicJwkFromVerificationMethod)(didDocument.dereferenceVerificationMethod(issuer.didUrl));
102
+ }
103
+ catch (_a) {
104
+ return fail('UNTRUSTED', `the issuer DID Document names no key at "${issuer.didUrl}"`);
105
+ }
106
+ }
107
+ if (!(0, keyBinding_1.boundVerificationMethod)(didDocument, issuerKey, ['assertionMethod'])) {
108
+ fail('UNTRUSTED', `the issuer DID Document does not authorize the signing key under assertionMethod`);
109
+ }
110
+ }
111
+ // Step 5, [VT-CRED-SDJWT-3] and [VT-CRED-SDJWT-4]: the Type Metadata document at `vct` hashes to
112
+ // `vct#integrity` and names the VTJSC of the request.
113
+ async function assertTypeMetadataBound(credential, jsonSchemaCredentialId, dependencies, evidence) {
114
+ const { vct, 'vct#integrity': integrity } = credential.payload;
115
+ if (typeof vct !== 'string')
116
+ fail('UNTRUSTED', 'the credential carries no vct');
117
+ if (typeof integrity !== 'string')
118
+ fail('UNTRUSTED', 'the credential carries no vct#integrity');
119
+ evidence.queries.push(`GET ${vct}`);
120
+ let document;
121
+ try {
122
+ document = await dependencies.readTypeMetadata(vct);
123
+ }
124
+ catch (error) {
125
+ return fail('RESOLVER_UNAVAILABLE', `the Type Metadata at "${vct}" could not be read: ${messageOf(error)}`);
126
+ }
127
+ if ((0, vs_agent_sdk_1.digestOfBytes)(document) !== integrity) {
128
+ fail('UNTRUSTED', `the Type Metadata at "${vct}" does not hash to the vct#integrity of the credential`);
129
+ }
130
+ const related = relatedJsonSchemaCredentialIdOf(document);
131
+ if (related !== jsonSchemaCredentialId) {
132
+ fail('UNTRUSTED', `the Type Metadata at "${vct}" names the VTJSC "${related}", not "${jsonSchemaCredentialId}"`);
133
+ }
134
+ }
135
+ // Step 7, first half: the Verifiable Trust resolution answers TRUSTED for the issuer DID.
136
+ async function assertIssuerTrusted(did, dependencies, evidence) {
137
+ var _a;
138
+ evidence.queries.push(`resolveDID ${did}`);
139
+ let resolution;
140
+ try {
141
+ resolution = await (0, keyBinding_1.withTimeout)(dependencies.resolveDidTrust(did), TRUST_RESOLUTION_TIMEOUT_MS, 'the trust resolution timed out');
142
+ }
143
+ catch (error) {
144
+ return fail('RESOLVER_UNAVAILABLE', `the trust resolution of "${did}" failed: ${messageOf(error)}`);
145
+ }
146
+ if (resolution.trusted) {
147
+ evidence.trustStatus = 'TRUSTED';
148
+ return;
149
+ }
150
+ // verre does not throw when a registry or an endpoint does not answer: the outcome is INVALID
151
+ // with a code of a failed read, and the next read of the session retries it
152
+ if (resolution.errorCode && UNAVAILABLE_RESOLUTION_CODES.includes(resolution.errorCode)) {
153
+ fail('RESOLVER_UNAVAILABLE', `the trust resolution of "${did}" could not complete: ${(_a = resolution.errorMessage) !== null && _a !== void 0 ? _a : resolution.errorCode}`);
154
+ }
155
+ evidence.trustStatus = 'UNTRUSTED';
156
+ fail('UNTRUSTED', `the trust resolution of "${did}" answered UNTRUSTED${resolution.errorMessage ? `: ${resolution.errorMessage}` : ''}`);
157
+ }
158
+ // Step 7, second half: an active ISSUER Participant of the issuer DID for the CredentialSchema.
159
+ async function assertIssuerAuthorized(did, credentialSchemaId, dependencies, evidence) {
160
+ evidence.queries.push(`listParticipants did=${did} role=ISSUER schema_id=${credentialSchemaId}`);
161
+ try {
162
+ await dependencies.assertAuthorized({ did, role: vs_agent_sdk_1.ParticipantRole.Issuer, credentialSchemaId });
163
+ }
164
+ catch (error) {
165
+ if (!(error instanceof vs_agent_sdk_1.AnonCredsTrustError))
166
+ throw error;
167
+ if (error.reason === vs_agent_sdk_1.AnonCredsTrustErrorReason.NotAuthorized) {
168
+ evidence.authorized = false;
169
+ fail('TRUSTED_NOT_AUTHORIZED', error.message);
170
+ }
171
+ fail('RESOLVER_UNAVAILABLE', error.message);
172
+ }
173
+ evidence.authorized = true;
174
+ }
175
+ function presentedCredential(credential) {
176
+ const disclosedClaims = Object.fromEntries(Object.entries(credential.prettyClaims).filter(([name]) => !(0, config_1.isReservedClaimName)(name)));
177
+ return { vct: String(credential.payload.vct), disclosedClaims };
178
+ }
179
+ function isDidWeb(did) {
180
+ try {
181
+ return (0, vs_agent_sdk_1.getDidWebHttpsBaseUrl)(did) !== undefined;
182
+ }
183
+ catch (_a) {
184
+ return false;
185
+ }
186
+ }
187
+ function relatedJsonSchemaCredentialIdOf(document) {
188
+ try {
189
+ const parsed = JSON.parse(Buffer.from(document).toString('utf8'));
190
+ return (0, isRecord_1.isRecord)(parsed) && typeof parsed.relatedJsonSchemaCredentialId === 'string'
191
+ ? parsed.relatedJsonSchemaCredentialId
192
+ : undefined;
193
+ }
194
+ catch (_a) {
195
+ return undefined;
196
+ }
197
+ }
198
+ function messageOf(error) {
199
+ return error instanceof Error ? error.message : String(error);
200
+ }
201
+ function fail(verdict, note) {
202
+ throw new StepFailure(verdict, note);
203
+ }
204
+ //# sourceMappingURL=trustDecision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trustDecision.js","sourceRoot":"","sources":["../../src/trust/trustDecision.ts"],"names":[],"mappings":";;AA0DA,0DAoBC;AAxED,yCAAqF;AACrF,4DAOkC;AAElC,sCAA+C;AAC/C,uEAA4E;AAC5E,gDAA4C;AAE5C,6CAAuF;AAEvF,4GAA4G;AAC5G,MAAM,2BAA2B,GAAG,KAAM,CAAA;AAE1C,kFAAkF;AAClF,MAAM,4BAA4B,GAA8B;IAC9D,6BAAc,CAAC,OAAO;IACtB,6BAAc,CAAC,eAAe;CAC/B,CAAA;AAsBD;;;;;;GAMG;AACI,KAAK,UAAU,uBAAuB,CAC3C,UAAmB,EACnB,OAAiC,EACjC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,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC;AAED,SAAS,IAAI,CAAC,OAAyB,EAAE,IAAY;IACnD,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtC,CAAC"}
@@ -1,12 +1,14 @@
1
1
  export declare const TRUST_VERDICT_NAMES: readonly ["TRUSTED_AUTHORIZED", "TRUSTED_NOT_AUTHORIZED", "UNTRUSTED", "RESOLVER_UNAVAILABLE"];
2
2
  export type TrustVerdictName = (typeof TRUST_VERDICT_NAMES)[number];
3
- export declare const VERANA_TRUST_STATUSES: readonly ["TRUSTED", "PARTIAL", "UNTRUSTED"];
3
+ export declare const VERANA_TRUST_STATUSES: readonly ["TRUSTED", "UNTRUSTED"];
4
4
  export type VeranaTrustStatus = (typeof VERANA_TRUST_STATUSES)[number];
5
5
  export type KeyBindingResult = 'bound' | 'unbound' | 'unresolvable';
6
6
  export interface TrustEvidence {
7
7
  did: string | null;
8
8
  trustStatus: VeranaTrustStatus | null;
9
9
  jsonSchemaCredentialId: string | null;
10
+ /** The `CredentialSchema` the session stored, which the `authorized` read names. */
11
+ credentialSchemaId: number | null;
10
12
  authorized: boolean | null;
11
13
  queries: string[];
12
14
  note?: string;
@@ -7,5 +7,5 @@ exports.TRUST_VERDICT_NAMES = [
7
7
  'UNTRUSTED',
8
8
  'RESOLVER_UNAVAILABLE',
9
9
  ];
10
- exports.VERANA_TRUST_STATUSES = ['TRUSTED', 'PARTIAL', 'UNTRUSTED'];
10
+ exports.VERANA_TRUST_STATUSES = ['TRUSTED', 'UNTRUSTED'];
11
11
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/trust/types.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;IACjC,oBAAoB;IACpB,wBAAwB;IACxB,WAAW;IACX,sBAAsB;CACd,CAAA;AAIG,QAAA,qBAAqB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAU,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/trust/types.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;IACjC,oBAAoB;IACpB,wBAAwB;IACxB,WAAW;IACX,sBAAsB;CACd,CAAA;AAIG,QAAA,qBAAqB,GAAG,CAAC,SAAS,EAAE,WAAW,CAAU,CAAA"}
package/build/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { OpenId4VcIssuerRequestMapper } from './sdk/setupOpenId4Vc';
2
2
  import type { Kms, X509Module } from '@credo-ts/core';
3
3
  import type { OpenId4VcModule } from '@credo-ts/openid4vc';
4
- import type { BaseAgentModules, VsAgent } from '@verana-labs/vs-agent-sdk';
4
+ import type { BaseAgentModules, VerifiablePublicRegistries, VsAgent } from '@verana-labs/vs-agent-sdk';
5
5
  export type OpenId4VcVsAgentModules = BaseAgentModules & {
6
6
  openId4Vc: OpenId4VcModule<null, null>;
7
7
  x509: X509Module;
@@ -38,6 +38,7 @@ export interface OpenId4VcConfigurationFile {
38
38
  }
39
39
  export declare const OPENID4VC_OPTIONS = "OPENID4VC_OPTIONS";
40
40
  export declare const OPENID4VC_ISSUER_SINK = "OPENID4VC_ISSUER_SINK";
41
+ export declare const OPENID4VC_DID_TRUST_RESOLVER = "OPENID4VC_DID_TRUST_RESOLVER";
41
42
  export interface OpenId4VcIssuerRuntime extends OpenId4VcIssuerRequestMapper {
42
43
  refreshCredentialConfigurations(updatedCredentialSchemaId?: number): Promise<void>;
43
44
  }
@@ -45,4 +46,6 @@ export type OpenId4VcIssuerSink = (service: OpenId4VcIssuerRuntime) => void;
45
46
  export interface OpenId4VcPluginOptions extends OpenId4VcConfigurationFile {
46
47
  publicApiBaseUrl: string;
47
48
  credentialConfigurations: OpenId4VcCredentialConfiguration[];
49
+ /** The VPR the verifier resolves a presented issuer against; absent when the agent has no indexer. */
50
+ verifiablePublicRegistries?: VerifiablePublicRegistries;
48
51
  }
package/build/types.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OPENID4VC_ISSUER_SINK = exports.OPENID4VC_OPTIONS = void 0;
3
+ exports.OPENID4VC_DID_TRUST_RESOLVER = exports.OPENID4VC_ISSUER_SINK = exports.OPENID4VC_OPTIONS = void 0;
4
4
  exports.OPENID4VC_OPTIONS = 'OPENID4VC_OPTIONS';
5
5
  exports.OPENID4VC_ISSUER_SINK = 'OPENID4VC_ISSUER_SINK';
6
+ exports.OPENID4VC_DID_TRUST_RESOLVER = 'OPENID4VC_DID_TRUST_RESOLVER';
6
7
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA6Ca,QAAA,iBAAiB,GAAG,mBAAmB,CAAA;AACvC,QAAA,qBAAqB,GAAG,uBAAuB,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA6Ca,QAAA,iBAAiB,GAAG,mBAAmB,CAAA;AACvC,QAAA,qBAAqB,GAAG,uBAAuB,CAAA;AAC/C,QAAA,4BAA4B,GAAG,8BAA8B,CAAA"}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "default": "./build/index.js"
10
10
  }
11
11
  },
12
- "version": "2.0.0-dev.82",
12
+ "version": "2.0.0-dev.84",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "https://github.com/verana-labs/vs-agent"
@@ -30,7 +30,7 @@
30
30
  "class-transformer": "0.5.1",
31
31
  "class-validator": "0.14.1",
32
32
  "express": "^4.18.1",
33
- "@verana-labs/vs-agent-sdk": "2.0.0-dev.82"
33
+ "@verana-labs/vs-agent-sdk": "2.0.0-dev.84"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@credo-ts/core": "0.7.1-pr-2704-20260909134930"