@verana-labs/vs-agent-plugin-openid4vc 1.12.0-oidc4vc.7 → 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 +5 -22
  44. package/build/services/CertificateService.js +90 -84
  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
@@ -1,202 +1,97 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_DID_RESOLUTION_TIMEOUT_MS = exports.DEFAULT_DID_RESOLUTION_TIMEOUT_MS = void 0;
4
- exports.ownDidResolutionPolicy = ownDidResolutionPolicy;
5
3
  exports.verifyKeyBoundToDid = verifyKeyBoundToDid;
6
4
  exports.findBoundVerificationMethodId = findBoundVerificationMethodId;
7
- exports.blockingBindingVerdict = blockingBindingVerdict;
5
+ exports.boundVerificationMethod = boundVerificationMethod;
6
+ exports.resolveDidDocument = resolveDidDocument;
7
+ exports.withTimeout = withTimeout;
8
8
  const core_1 = require("@credo-ts/core");
9
- const node_net_1 = require("node:net");
10
- exports.DEFAULT_DID_RESOLUTION_TIMEOUT_MS = 5000;
11
- exports.MAX_DID_RESOLUTION_TIMEOUT_MS = 30000;
12
- const NON_PUBLIC_IPS = createNonPublicIpBlockList();
13
- function ownDidResolutionPolicy(did, timeoutMs = exports.DEFAULT_DID_RESOLUTION_TIMEOUT_MS) {
14
- const host = didWebHost(did);
15
- return { allowedWebHosts: host ? [host] : [], timeoutMs };
9
+ const vs_agent_sdk_1 = require("@verana-labs/vs-agent-sdk");
10
+ const DID_RESOLUTION_TIMEOUT_MS = 5000;
11
+ async function verifyKeyBoundToDid(agent, did, certificatePublicJwk, purposes) {
12
+ const lookup = await lookupBoundVerificationMethod(agent, did, certificatePublicJwk, purposes);
13
+ return lookup.result;
16
14
  }
17
- async function verifyKeyBoundToDid(agent, did, certificatePublicJwk, purposes, resolutionPolicy) {
18
- var _a, _b;
15
+ async function findBoundVerificationMethodId(agent, did, certificatePublicJwk, purposes) {
16
+ const lookup = await lookupBoundVerificationMethod(agent, did, certificatePublicJwk, purposes);
17
+ return lookup.result === 'bound' ? lookup.verificationMethodId : null;
18
+ }
19
+ async function lookupBoundVerificationMethod(agent, did, certificatePublicJwk, purposes) {
19
20
  if (!did)
20
- return 'unbound';
21
+ return { result: 'unbound' };
21
22
  let certificateKey;
22
23
  try {
23
24
  certificateKey = core_1.Kms.PublicJwk.fromUnknown(certificatePublicJwk);
24
25
  }
25
- catch (_c) {
26
- return 'unbound';
27
- }
28
- if (!isResolutionAllowed(did, resolutionPolicy))
29
- return 'unresolvable';
30
- let didDocument;
31
- try {
32
- const resolution = await withTimeout(agent.dids.resolve(did, { useCache: false, persistInCache: false }), resolutionPolicy.timeoutMs);
33
- if (((_a = resolution.didResolutionMetadata) === null || _a === void 0 ? void 0 : _a.error) || !resolution.didDocument)
34
- return 'unresolvable';
35
- if (resolution.didDocument.id !== did)
36
- return 'unresolvable';
37
- didDocument = resolution.didDocument;
38
- }
39
- catch (_d) {
40
- return 'unresolvable';
26
+ catch (_a) {
27
+ return { result: 'unbound' };
41
28
  }
42
- for (const purpose of purposes) {
43
- for (const entry of (_b = didDocument[purpose]) !== null && _b !== void 0 ? _b : []) {
44
- let verificationMethod;
45
- try {
46
- verificationMethod =
47
- typeof entry === 'string' ? didDocument.dereferenceVerificationMethod(entry) : entry;
48
- }
49
- catch (_e) {
50
- continue;
51
- }
52
- try {
53
- const methodKey = (0, core_1.getPublicJwkFromVerificationMethod)(verificationMethod);
54
- if (certificateKey.equals(methodKey))
55
- return 'bound';
56
- }
57
- catch (_f) {
58
- continue;
59
- }
29
+ const didDocument = await resolveDidDocument(agent, did);
30
+ if (typeof didDocument === 'string')
31
+ return { result: 'unresolvable' };
32
+ const verificationMethodId = boundVerificationMethod(didDocument, certificateKey, purposes);
33
+ return verificationMethodId ? { result: 'bound', verificationMethodId } : { result: 'unbound' };
34
+ }
35
+ /** The id of the verification method under one of the purposes that carries the key, if any. */
36
+ function boundVerificationMethod(didDocument, key, purposes) {
37
+ for (const verificationMethod of verificationMethodsForPurposes(didDocument, purposes)) {
38
+ try {
39
+ if (key.equals((0, core_1.getPublicJwkFromVerificationMethod)(verificationMethod)))
40
+ return verificationMethod.id;
60
41
  }
42
+ catch (_a) { }
61
43
  }
62
- return 'unbound';
44
+ return undefined;
63
45
  }
64
46
  /**
65
- * The DID URL of the verification method whose key is the signing certificate key, or null when the
66
- * DID does not publish it. Needed to sign an authorization request with `method: 'did'`, which is
67
- * what lets a wallet trust-resolve the verifier by DID rather than by certificate.
47
+ * Resolves a did:web or did:webvh, fresh, within 5 seconds, and only when the document carries the
48
+ * requested DID as its id ([VSA-VTI-FLOW-VERIFY-OID] step 3).
68
49
  */
69
- async function findBoundVerificationMethodId(agent, did, certificatePublicJwk, purposes, resolutionPolicy) {
70
- var _a, _b;
71
- if (!did)
72
- return null;
73
- let certificateKey;
74
- try {
75
- certificateKey = core_1.Kms.PublicJwk.fromUnknown(certificatePublicJwk);
76
- }
77
- catch (_c) {
78
- return null;
79
- }
80
- if (!isResolutionAllowed(did, resolutionPolicy))
81
- return null;
82
- let didDocument;
50
+ async function resolveDidDocument(agent, did) {
51
+ var _a;
52
+ if (!isDidWebTarget(did))
53
+ return 'unresolvable';
83
54
  try {
84
- const resolution = await withTimeout(agent.dids.resolve(did, { useCache: false, persistInCache: false }), resolutionPolicy.timeoutMs);
55
+ const resolution = await withTimeout(agent.dids.resolve(did, { useCache: false, persistInCache: false }), DID_RESOLUTION_TIMEOUT_MS, 'DID resolution timed out');
85
56
  if (((_a = resolution.didResolutionMetadata) === null || _a === void 0 ? void 0 : _a.error) || !resolution.didDocument)
86
- return null;
57
+ return 'unresolvable';
87
58
  if (resolution.didDocument.id !== did)
88
- return null;
89
- didDocument = resolution.didDocument;
59
+ return 'other-id';
60
+ return resolution.didDocument;
90
61
  }
91
- catch (_d) {
92
- return null;
62
+ catch (_b) {
63
+ return 'unresolvable';
93
64
  }
65
+ }
66
+ function* verificationMethodsForPurposes(didDocument, purposes) {
67
+ var _a;
94
68
  for (const purpose of purposes) {
95
- for (const entry of (_b = didDocument[purpose]) !== null && _b !== void 0 ? _b : []) {
69
+ for (const entry of (_a = didDocument[purpose]) !== null && _a !== void 0 ? _a : []) {
96
70
  let verificationMethod;
97
71
  try {
98
72
  verificationMethod =
99
73
  typeof entry === 'string' ? didDocument.dereferenceVerificationMethod(entry) : entry;
100
74
  }
101
- catch (_e) {
102
- continue;
103
- }
104
- try {
105
- if (certificateKey.equals((0, core_1.getPublicJwkFromVerificationMethod)(verificationMethod))) {
106
- return verificationMethod.id;
107
- }
108
- }
109
- catch (_f) {
75
+ catch (_b) {
110
76
  continue;
111
77
  }
78
+ yield verificationMethod;
112
79
  }
113
80
  }
114
- return null;
115
- }
116
- function isResolutionAllowed(did, policy) {
117
- if (!Number.isInteger(policy.timeoutMs) ||
118
- policy.timeoutMs <= 0 ||
119
- policy.timeoutMs > exports.MAX_DID_RESOLUTION_TIMEOUT_MS ||
120
- !Array.isArray(policy.allowedWebHosts)) {
121
- return false;
122
- }
123
- const requestedHost = didWebHost(did);
124
- if (!requestedHost || isNonPublicHost(new URL(`https://${requestedHost}`).hostname))
125
- return false;
126
- return policy.allowedWebHosts.some(allowedHost => canonicalHost(allowedHost) === requestedHost);
127
81
  }
128
- function didWebHost(did) {
129
- const parsed = (0, core_1.tryParseDid)(did);
130
- if (!parsed || parsed.did !== did)
131
- return undefined;
132
- const components = parsed.id.split(':');
133
- const encodedHost = parsed.method === 'web'
134
- ? components[0]
135
- : parsed.method === 'webvh' && components.length >= 2 && components[0]
136
- ? components[1]
137
- : undefined;
138
- if (!encodedHost)
139
- return undefined;
82
+ function isDidWebTarget(did) {
140
83
  try {
141
- return canonicalHost(decodeURIComponent(encodedHost));
84
+ return (0, vs_agent_sdk_1.getDidWebHttpsBaseUrl)(did) !== undefined;
142
85
  }
143
86
  catch (_a) {
144
- return undefined;
145
- }
146
- }
147
- function canonicalHost(value) {
148
- try {
149
- const url = new URL(`https://${value}`);
150
- if (!url.hostname || url.username || url.password || url.pathname !== '/' || url.search || url.hash) {
151
- return undefined;
152
- }
153
- return url.host.toLowerCase();
154
- }
155
- catch (_a) {
156
- return undefined;
157
- }
158
- }
159
- function isNonPublicHost(hostname) {
160
- const normalized = hostname.replace(/^\[|\]$/g, '').toLowerCase();
161
- if (normalized === 'localhost' ||
162
- normalized.endsWith('.localhost') ||
163
- normalized.endsWith('.local') ||
164
- normalized.endsWith('.internal') ||
165
- normalized === 'home.arpa' ||
166
- normalized.endsWith('.home.arpa')) {
167
- return true;
87
+ return false;
168
88
  }
169
- const ipVersion = (0, node_net_1.isIP)(normalized);
170
- return ipVersion === 4
171
- ? NON_PUBLIC_IPS.check(normalized, 'ipv4')
172
- : ipVersion === 6
173
- ? NON_PUBLIC_IPS.check(normalized, 'ipv6')
174
- : false;
175
- }
176
- function createNonPublicIpBlockList() {
177
- const blockList = new node_net_1.BlockList();
178
- blockList.addSubnet('0.0.0.0', 8, 'ipv4');
179
- blockList.addSubnet('10.0.0.0', 8, 'ipv4');
180
- blockList.addSubnet('100.64.0.0', 10, 'ipv4');
181
- blockList.addSubnet('127.0.0.0', 8, 'ipv4');
182
- blockList.addSubnet('169.254.0.0', 16, 'ipv4');
183
- blockList.addSubnet('172.16.0.0', 12, 'ipv4');
184
- blockList.addSubnet('192.0.0.0', 24, 'ipv4');
185
- blockList.addSubnet('192.168.0.0', 16, 'ipv4');
186
- blockList.addSubnet('198.18.0.0', 15, 'ipv4');
187
- blockList.addSubnet('224.0.0.0', 3, 'ipv4');
188
- blockList.addSubnet('::', 128, 'ipv6');
189
- blockList.addSubnet('::1', 128, 'ipv6');
190
- blockList.addSubnet('::ffff:0:0', 96, 'ipv6');
191
- blockList.addSubnet('fc00::', 7, 'ipv6');
192
- blockList.addSubnet('fe80::', 10, 'ipv6');
193
- blockList.addSubnet('ff00::', 8, 'ipv6');
194
- return blockList;
195
89
  }
196
- async function withTimeout(operation, timeoutMs) {
90
+ /** Rejects with `message` when `operation` does not settle within `timeoutMs`. */
91
+ async function withTimeout(operation, timeoutMs, message) {
197
92
  let timeout;
198
93
  const timeoutPromise = new Promise((_resolve, reject) => {
199
- timeout = setTimeout(() => reject(new Error('DID resolution timed out')), timeoutMs);
94
+ timeout = setTimeout(() => reject(new Error(message)), timeoutMs);
200
95
  });
201
96
  try {
202
97
  return await Promise.race([operation, timeoutPromise]);
@@ -206,19 +101,4 @@ async function withTimeout(operation, timeoutMs) {
206
101
  clearTimeout(timeout);
207
102
  }
208
103
  }
209
- function blockingBindingVerdict(did, vtjscId, binding) {
210
- return {
211
- verdict: binding === 'unresolvable' ? 'RESOLVER_UNAVAILABLE' : 'UNTRUSTED',
212
- evidence: {
213
- did,
214
- trustStatus: null,
215
- vtjscId,
216
- authorized: null,
217
- queries: [],
218
- note: binding === 'unresolvable'
219
- ? 'the asserted DID could not be resolved for key binding'
220
- : 'the certificate public key is not authorized by the asserted DID document',
221
- },
222
- };
223
- }
224
104
  //# sourceMappingURL=keyBinding.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyBinding.js","sourceRoot":"","sources":["../../src/trust/keyBinding.ts"],"names":[],"mappings":";;;AAkBA,wDAMC;AAED,kDAmDC;AAOD,sEAoDC;AA0GD,wDAmBC;AAlQD,yCAAqF;AACrF,uCAA0C;AAK7B,QAAA,iCAAiC,GAAG,IAAK,CAAA;AACzC,QAAA,6BAA6B,GAAG,KAAM,CAAA;AACnD,MAAM,cAAc,GAAG,0BAA0B,EAAE,CAAA;AAOnD,SAAgB,sBAAsB,CACpC,GAAW,EACX,SAAS,GAAG,yCAAiC;IAE7C,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;IAC5B,OAAO,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,CAAA;AAC3D,CAAC;AAEM,KAAK,UAAU,mBAAmB,CACvC,KAAuB,EACvB,GAAkB,EAClB,oBAA6B,EAC7B,QAA0B,EAC1B,gBAAqC;;IAErC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAA;IAE1B,IAAI,cAA6B,CAAA;IACjC,IAAI,CAAC;QACH,cAAc,GAAG,UAAG,CAAC,SAAS,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAA;IAClE,CAAC;IAAC,WAAM,CAAC;QAC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,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAA;IACxD,CAAC;YAAS,CAAC;QACT,IAAI,OAAO;YAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { GetTrustedIssuersForVerification, VerificationSigner } from '@credo-ts/core';
2
+ import type { OpenId4VcVerificationTypes } from '@credo-ts/openid4vc';
3
+ /**
4
+ * What credo may trust as the signer of a presented credential, step 1 of
5
+ * [VSA-VTI-FLOW-VERIFY-OID]. The DID Document binds the issuer key (step 4), not a certificate
6
+ * chain, so the leaf certificate the wallet presented is the one anchor credo needs for `x5c`; a
7
+ * DID signer needs none. Every other verification falls through to the next layer.
8
+ */
9
+ export declare const trustedIssuersForPresentation: GetTrustedIssuersForVerification<VerificationSigner, OpenId4VcVerificationTypes>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.trustedIssuersForPresentation = void 0;
4
+ const presentationVerification_1 = require("../services/presentationVerification");
5
+ /**
6
+ * What credo may trust as the signer of a presented credential, step 1 of
7
+ * [VSA-VTI-FLOW-VERIFY-OID]. The DID Document binds the issuer key (step 4), not a certificate
8
+ * chain, so the leaf certificate the wallet presented is the one anchor credo needs for `x5c`; a
9
+ * DID signer needs none. Every other verification falls through to the next layer.
10
+ */
11
+ const trustedIssuersForPresentation = async (_agentContext, { signer, verification }) => {
12
+ if (verification.type !== 'openId4VpCredential')
13
+ return undefined;
14
+ // credo accepts an SD-JWT VC without `exp`; the spec does not
15
+ (0, presentationVerification_1.assertCredentialExpires)(verification.credential);
16
+ if (signer.method !== 'x509')
17
+ return undefined;
18
+ return {
19
+ trustedIssuers: [{ method: 'x509', issuance: [signer.certificateChain[0].toString('base64')] }],
20
+ };
21
+ };
22
+ exports.trustedIssuersForPresentation = trustedIssuersForPresentation;
23
+ //# sourceMappingURL=presentedIssuer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentedIssuer.js","sourceRoot":"","sources":["../../src/trust/presentedIssuer.ts"],"names":[],"mappings":";;;AAGA,mFAA8E;AAE9E;;;;;GAKG;AACI,MAAM,6BAA6B,GAGtC,KAAK,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;IACpD,IAAI,YAAY,CAAC,IAAI,KAAK,qBAAqB;QAAE,OAAO,SAAS,CAAA;IACjE,8DAA8D;IAC9D,IAAA,kDAAuB,EAAC,YAAY,CAAC,UAAU,CAAC,CAAA;IAChD,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,SAAS,CAAA;IAC9C,OAAO;QACL,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;KAChG,CAAA;AACH,CAAC,CAAA;AAXY,QAAA,6BAA6B,iCAWzC"}
@@ -0,0 +1,31 @@
1
+ import type { PresentationDecision } from '../services/presentationVerification';
2
+ import type { DidResolverAgent } from './keyBinding';
3
+ import type { SdJwtVc } from '@credo-ts/core';
4
+ import type { DidTrustResolver } from '@verana-labs/vs-agent-sdk';
5
+ import { ParticipantRole } from '@verana-labs/vs-agent-sdk';
6
+ /** What the verification session stored when it created the request ([VSA-ADM-OID-PR-CREATE]). */
7
+ export interface PresentationTrustRequest {
8
+ jsonSchemaCredentialId: string;
9
+ credentialSchemaId: number;
10
+ }
11
+ export interface PresentationTrustDependencies {
12
+ agent: DidResolverAgent;
13
+ /** Reads the Type Metadata document at a `vct`, under the network boundary of step 3. */
14
+ readTypeMetadata: (vct: string) => Promise<Uint8Array>;
15
+ /** Step 7: the Verifiable Trust resolution of a DID, the one the agent applies to a DIDComm peer. */
16
+ resolveDidTrust: DidTrustResolver;
17
+ /** Step 7: the ISSUER `Participant` check of the agent; throws an `AnonCredsTrustError` otherwise. */
18
+ assertAuthorized: (options: {
19
+ did: string;
20
+ role: ParticipantRole;
21
+ credentialSchemaId: number;
22
+ }) => Promise<void>;
23
+ }
24
+ /**
25
+ * [VSA-VTI-FLOW-VERIFY-OID] steps 2 to 8 on a credential that passed step 1: credo verified the
26
+ * response, the holder binding, the disclosures, the signature, the validity period and the `status`
27
+ * claim (step 6) before the session reached `ResponseVerified`. Every step fails closed. A step the
28
+ * agent cannot complete answers `RESOLVER_UNAVAILABLE`, which the caller never stores, so the next
29
+ * read retries it.
30
+ */
31
+ export declare function decidePresentationTrust(credential: SdJwtVc, request: PresentationTrustRequest, dependencies: PresentationTrustDependencies): Promise<PresentationDecision>;
@@ -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
+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CAAC;AAED,SAAS,+BAA+B,CAAC,QAAoB;IAC3D,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;QAC1E,OAAO,IAAA,mBAAQ,EAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,6BAA6B,KAAK,QAAQ;YACjF,CAAC,CAAC,MAAM,CAAC,6BAA6B;YACtC,CAAC,CAAC,SAAS,CAAA;IACf,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,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,19 +1,14 @@
1
- export type TrustVerdictName = 'TRUSTED_AUTHORIZED' | 'TRUSTED_NOT_AUTHORIZED' | 'UNTRUSTED' | 'RESOLVER_UNAVAILABLE';
2
- export type VeranaTrustStatus = 'TRUSTED' | 'PARTIAL' | 'UNTRUSTED';
3
- export type TrustResolution = {
4
- status: 'ok';
5
- trustStatus: VeranaTrustStatus;
6
- } | {
7
- status: 'not_found';
8
- } | {
9
- status: 'unreachable';
10
- };
11
- export type TrustRole = 'issuer' | 'verifier';
1
+ export declare const TRUST_VERDICT_NAMES: readonly ["TRUSTED_AUTHORIZED", "TRUSTED_NOT_AUTHORIZED", "UNTRUSTED", "RESOLVER_UNAVAILABLE"];
2
+ export type TrustVerdictName = (typeof TRUST_VERDICT_NAMES)[number];
3
+ export declare const VERANA_TRUST_STATUSES: readonly ["TRUSTED", "UNTRUSTED"];
4
+ export type VeranaTrustStatus = (typeof VERANA_TRUST_STATUSES)[number];
12
5
  export type KeyBindingResult = 'bound' | 'unbound' | 'unresolvable';
13
6
  export interface TrustEvidence {
14
7
  did: string | null;
15
8
  trustStatus: VeranaTrustStatus | null;
16
- vtjscId: string | null;
9
+ jsonSchemaCredentialId: string | null;
10
+ /** The `CredentialSchema` the session stored, which the `authorized` read names. */
11
+ credentialSchemaId: number | null;
17
12
  authorized: boolean | null;
18
13
  queries: string[];
19
14
  note?: string;
@@ -22,7 +17,3 @@ export interface TrustVerdict {
22
17
  verdict: TrustVerdictName;
23
18
  evidence: TrustEvidence;
24
19
  }
25
- export interface TrustClientOptions {
26
- resolverUrl: string;
27
- timeoutMs: number;
28
- }
@@ -1,3 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERANA_TRUST_STATUSES = exports.TRUST_VERDICT_NAMES = void 0;
4
+ exports.TRUST_VERDICT_NAMES = [
5
+ 'TRUSTED_AUTHORIZED',
6
+ 'TRUSTED_NOT_AUTHORIZED',
7
+ 'UNTRUSTED',
8
+ 'RESOLVER_UNAVAILABLE',
9
+ ];
10
+ exports.VERANA_TRUST_STATUSES = ['TRUSTED', 'UNTRUSTED'];
3
11
  //# sourceMappingURL=types.js.map