@interop/wallet-core 0.69.0 → 0.71.0

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 (171) hide show
  1. package/README.md +22 -36
  2. package/dist/clientAnnex/ladder.d.ts +103 -57
  3. package/dist/clientAnnex/ladder.d.ts.map +1 -1
  4. package/dist/clientAnnex/ladder.js +254 -335
  5. package/dist/clientAnnex/ladder.js.map +1 -1
  6. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  7. package/dist/clientAnnex/ladderAnchored.js +10 -5
  8. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  9. package/dist/clientAnnex/recoveryLadderAnchored.d.ts +3 -15
  10. package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
  11. package/dist/clientAnnex/recoveryLadderAnchored.js +22 -3
  12. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  13. package/dist/clientAnnex/selfEnroll.js +1 -1
  14. package/dist/clientAnnex/selfEnroll.js.map +1 -1
  15. package/dist/clientAnnex/zcap.js +1 -1
  16. package/dist/clientAnnex/zcap.js.map +1 -1
  17. package/dist/clients/grantState.d.ts +67 -0
  18. package/dist/clients/grantState.d.ts.map +1 -0
  19. package/dist/clients/grantState.js +72 -0
  20. package/dist/clients/grantState.js.map +1 -0
  21. package/dist/clients/index.d.ts +7 -0
  22. package/dist/clients/index.d.ts.map +1 -1
  23. package/dist/clients/index.js +6 -0
  24. package/dist/clients/index.js.map +1 -1
  25. package/dist/enrollment/connectCode.d.ts +4 -3
  26. package/dist/enrollment/connectCode.d.ts.map +1 -1
  27. package/dist/enrollment/connectCode.js +4 -3
  28. package/dist/enrollment/connectCode.js.map +1 -1
  29. package/dist/enrollment/enrollment.js +1 -1
  30. package/dist/enrollment/enrollment.js.map +1 -1
  31. package/dist/enrollment/index.d.ts +2 -2
  32. package/dist/enrollment/index.js +2 -2
  33. package/dist/enrollment/onboardingInvite.d.ts +1 -1
  34. package/dist/enrollment/onboardingInvite.js +1 -1
  35. package/dist/enrollment/onboardingResponse.js +1 -1
  36. package/dist/index.d.ts +4 -11
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +4 -11
  39. package/dist/index.js.map +1 -1
  40. package/dist/keyring/index.d.ts +1 -1
  41. package/dist/keyring/index.js +1 -1
  42. package/dist/keyring/kdf.d.ts +34 -20
  43. package/dist/keyring/kdf.d.ts.map +1 -1
  44. package/dist/keyring/kdf.js +37 -26
  45. package/dist/keyring/kdf.js.map +1 -1
  46. package/dist/keys/userKey.js +1 -1
  47. package/dist/keys/userKey.js.map +1 -1
  48. package/dist/recovery/continuation.d.ts +5 -4
  49. package/dist/recovery/continuation.d.ts.map +1 -1
  50. package/dist/recovery/continuation.js +14 -13
  51. package/dist/recovery/continuation.js.map +1 -1
  52. package/dist/resourceLog/document.d.ts +10 -2
  53. package/dist/resourceLog/document.d.ts.map +1 -1
  54. package/dist/resourceLog/document.js +1 -2
  55. package/dist/resourceLog/document.js.map +1 -1
  56. package/dist/space/index.d.ts +4 -2
  57. package/dist/space/index.d.ts.map +1 -1
  58. package/dist/space/index.js +4 -2
  59. package/dist/space/index.js.map +1 -1
  60. package/dist/space/wasLink.d.ts +13 -2
  61. package/dist/space/wasLink.d.ts.map +1 -1
  62. package/dist/space/wasLink.js +28 -2
  63. package/dist/space/wasLink.js.map +1 -1
  64. package/dist/unlock/index.d.ts +1 -1
  65. package/dist/unlock/index.d.ts.map +1 -1
  66. package/dist/unlock/index.js.map +1 -1
  67. package/dist/unlock/standingClient.d.ts +1 -1
  68. package/dist/unlock/standingClient.d.ts.map +1 -1
  69. package/dist/unlock/standingClient.js +3 -3
  70. package/dist/unlock/standingClient.js.map +1 -1
  71. package/dist/unlock/standingWebvh.d.ts +81 -19
  72. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  73. package/dist/unlock/standingWebvh.js +170 -30
  74. package/dist/unlock/standingWebvh.js.map +1 -1
  75. package/dist/webvh/did.d.ts +2 -4
  76. package/dist/webvh/did.d.ts.map +1 -1
  77. package/dist/webvh/did.js +2 -4
  78. package/dist/webvh/did.js.map +1 -1
  79. package/dist/webvh/didWebvh.d.ts +3 -2
  80. package/dist/webvh/didWebvh.d.ts.map +1 -1
  81. package/dist/webvh/didWebvh.js +2 -1
  82. package/dist/webvh/didWebvh.js.map +1 -1
  83. package/dist/webvh/index.d.ts +1 -1
  84. package/dist/webvh/index.js +1 -1
  85. package/dist/webvh/revokeClient.d.ts +13 -7
  86. package/dist/webvh/revokeClient.d.ts.map +1 -1
  87. package/dist/webvh/revokeClient.js +14 -7
  88. package/dist/webvh/revokeClient.js.map +1 -1
  89. package/dist/webvh/zcap.js +1 -1
  90. package/dist/webvh/zcap.js.map +1 -1
  91. package/package.json +2 -23
  92. package/dist/identity/agents.d.ts +0 -100
  93. package/dist/identity/agents.d.ts.map +0 -1
  94. package/dist/identity/agents.js +0 -120
  95. package/dist/identity/agents.js.map +0 -1
  96. package/dist/identity/index.d.ts +0 -24
  97. package/dist/identity/index.d.ts.map +0 -1
  98. package/dist/identity/index.js +0 -23
  99. package/dist/identity/index.js.map +0 -1
  100. package/dist/identity/keyResolver.d.ts +0 -30
  101. package/dist/identity/keyResolver.d.ts.map +0 -1
  102. package/dist/identity/keyResolver.js +0 -25
  103. package/dist/identity/keyResolver.js.map +0 -1
  104. package/dist/request/appKey.d.ts +0 -295
  105. package/dist/request/appKey.d.ts.map +0 -1
  106. package/dist/request/appKey.js +0 -516
  107. package/dist/request/appKey.js.map +0 -1
  108. package/dist/request/capabilityRequest.d.ts +0 -41
  109. package/dist/request/capabilityRequest.d.ts.map +0 -1
  110. package/dist/request/capabilityRequest.js +0 -46
  111. package/dist/request/capabilityRequest.js.map +0 -1
  112. package/dist/request/classify.d.ts +0 -226
  113. package/dist/request/classify.d.ts.map +0 -1
  114. package/dist/request/classify.js +0 -416
  115. package/dist/request/classify.js.map +0 -1
  116. package/dist/request/composeVp.d.ts +0 -52
  117. package/dist/request/composeVp.d.ts.map +0 -1
  118. package/dist/request/composeVp.js +0 -176
  119. package/dist/request/composeVp.js.map +0 -1
  120. package/dist/request/ephemeralExchange.d.ts +0 -100
  121. package/dist/request/ephemeralExchange.d.ts.map +0 -1
  122. package/dist/request/ephemeralExchange.js +0 -230
  123. package/dist/request/ephemeralExchange.js.map +0 -1
  124. package/dist/request/exchangeClient.d.ts +0 -142
  125. package/dist/request/exchangeClient.d.ts.map +0 -1
  126. package/dist/request/exchangeClient.js +0 -241
  127. package/dist/request/exchangeClient.js.map +0 -1
  128. package/dist/request/index.d.ts +0 -59
  129. package/dist/request/index.d.ts.map +0 -1
  130. package/dist/request/index.js +0 -59
  131. package/dist/request/index.js.map +0 -1
  132. package/dist/request/interactionRequest.d.ts +0 -23
  133. package/dist/request/interactionRequest.d.ts.map +0 -1
  134. package/dist/request/interactionRequest.js +0 -46
  135. package/dist/request/interactionRequest.js.map +0 -1
  136. package/dist/request/interactionUrl.d.ts +0 -42
  137. package/dist/request/interactionUrl.d.ts.map +0 -1
  138. package/dist/request/interactionUrl.js +0 -104
  139. package/dist/request/interactionUrl.js.map +0 -1
  140. package/dist/request/matching.d.ts +0 -95
  141. package/dist/request/matching.d.ts.map +0 -1
  142. package/dist/request/matching.js +0 -205
  143. package/dist/request/matching.js.map +0 -1
  144. package/dist/request/onboarding.d.ts +0 -94
  145. package/dist/request/onboarding.d.ts.map +0 -1
  146. package/dist/request/onboarding.js +0 -167
  147. package/dist/request/onboarding.js.map +0 -1
  148. package/dist/request/parse.d.ts +0 -63
  149. package/dist/request/parse.d.ts.map +0 -1
  150. package/dist/request/parse.js +0 -153
  151. package/dist/request/parse.js.map +0 -1
  152. package/dist/request/presentationSuite.d.ts +0 -71
  153. package/dist/request/presentationSuite.d.ts.map +0 -1
  154. package/dist/request/presentationSuite.js +0 -143
  155. package/dist/request/presentationSuite.js.map +0 -1
  156. package/dist/request/processRequest.d.ts +0 -45
  157. package/dist/request/processRequest.d.ts.map +0 -1
  158. package/dist/request/processRequest.js +0 -147
  159. package/dist/request/processRequest.js.map +0 -1
  160. package/dist/request/queryPredicates.d.ts +0 -98
  161. package/dist/request/queryPredicates.d.ts.map +0 -1
  162. package/dist/request/queryPredicates.js +0 -107
  163. package/dist/request/queryPredicates.js.map +0 -1
  164. package/dist/request/types.d.ts +0 -257
  165. package/dist/request/types.d.ts.map +0 -1
  166. package/dist/request/types.js +0 -2
  167. package/dist/request/types.js.map +0 -1
  168. package/dist/request/walletInput.d.ts +0 -93
  169. package/dist/request/walletInput.d.ts.map +0 -1
  170. package/dist/request/walletInput.js +0 -179
  171. package/dist/request/walletInput.js.map +0 -1
@@ -1,45 +0,0 @@
1
- import type { IVerifiableCredential, IVPRDetails, PresentationSigner, RequestProcessors, WalletResponse } from './types.js';
2
- /**
3
- * Domain-binding check (VCALM §3.4.3 advisement): a DID-Auth `domain` MUST match
4
- * the channel the request arrived on, otherwise a dishonest verifier could relay
5
- * the challenge from another origin and replay the response.
6
- *
7
- * @param options {object}
8
- * @param options.domain {string} - The `domain` from the request.
9
- * @param [options.origin] {string} - The channel origin (for CHAPI,
10
- * `event.credentialRequestOrigin`).
11
- * @returns {boolean}
12
- */
13
- export declare function domainMatchesOrigin({ domain, origin }: {
14
- domain: string;
15
- origin?: string;
16
- }): boolean;
17
- /**
18
- * Processes a Verifiable Presentation Request and composes the wallet's
19
- * response. Assumes the user has already consented and (for VC sharing) picked
20
- * which credentials to send.
21
- *
22
- * @param options {object}
23
- * @param options.request {IVPRDetails} - The VPR body.
24
- * @param options.presentationSigner {PresentationSigner} - Authentication signer
25
- * and holder DID.
26
- * @param [options.selectedVCs] {IVerifiableCredential[]} - VCs the user chose to
27
- * share (empty for a DID-Auth-only or zcap-only response).
28
- * @param [options.credentialRequestOrigin] {string} - Channel origin, used for
29
- * the domain-binding check and required by the App Connect branch.
30
- * @param [options.processors] {RequestProcessors} - App-side capability /
31
- * App Connect processors.
32
- * @param [options.cryptosuite] {string} - Cryptosuite override; when absent it
33
- * is negotiated from the request's `acceptedCryptosuites`.
34
- * @returns {Promise<WalletResponse>} The response VP (and any granted zcaps), or
35
- * `{}` when there is nothing to send.
36
- */
37
- export declare function processRequest({ request, presentationSigner, selectedVCs, credentialRequestOrigin, processors, cryptosuite }: {
38
- request: IVPRDetails;
39
- presentationSigner: PresentationSigner;
40
- selectedVCs?: IVerifiableCredential[];
41
- credentialRequestOrigin?: string;
42
- processors?: RequestProcessors;
43
- cryptosuite?: string;
44
- }): Promise<WalletResponse>;
45
- //# sourceMappingURL=processRequest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processRequest.d.ts","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EAEX,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAA;AAkBnB;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAOV;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,kBAAkB,EAClB,WAAgB,EAChB,uBAAuB,EACvB,UAAU,EACV,WAAW,EACZ,EAAE;IACD,OAAO,EAAE,WAAW,CAAA;IACpB,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAA;IACrC,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,cAAc,CAAC,CAgF1B"}
@@ -1,147 +0,0 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Framework-agnostic request processing: turns a classified VPR body plus the
6
- * user's VC selection into a {@link WalletResponse} (a possibly-signed VP, plus
7
- * any delegated zcaps). The response channel (CHAPI `respondWith`, an
8
- * exchange-URL POST) stays with the caller -- this function only returns data,
9
- * and assumes the user has already consented and picked which credentials to
10
- * send.
11
- *
12
- * Ported from Freewallet's `src/lib/walletRequest/processRequest.ts` (the pure
13
- * shape). The two app-specific side effects -- capability delegation and the App
14
- * Connect branch -- are injected as {@link RequestProcessors} rather than
15
- * imported, so this layer carries no session / grant-resolution machinery. The
16
- * signer and holder DID are injected as a {@link PresentationSigner}.
17
- */
18
- import { log } from '../log.js';
19
- import { appConnectRequestOf, classifyRequest, queriesOf } from './classify.js';
20
- import { composeVp } from './composeVp.js';
21
- import { negotiateCryptosuite } from './presentationSuite.js';
22
- import { isAppConnectQuery } from './queryPredicates.js';
23
- /**
24
- * Extracts the host (`host:port`) from a value that may be a full URL or a bare
25
- * host / host:port. Returns undefined if it cannot be parsed.
26
- */
27
- function hostOf(value) {
28
- try {
29
- const url = value.includes('://')
30
- ? new URL(value)
31
- : new URL(`https://${value}`);
32
- return url.host;
33
- }
34
- catch (err) {
35
- log.warn('Could not parse host', { value, err });
36
- return undefined;
37
- }
38
- }
39
- /**
40
- * Domain-binding check (VCALM §3.4.3 advisement): a DID-Auth `domain` MUST match
41
- * the channel the request arrived on, otherwise a dishonest verifier could relay
42
- * the challenge from another origin and replay the response.
43
- *
44
- * @param options {object}
45
- * @param options.domain {string} - The `domain` from the request.
46
- * @param [options.origin] {string} - The channel origin (for CHAPI,
47
- * `event.credentialRequestOrigin`).
48
- * @returns {boolean}
49
- */
50
- export function domainMatchesOrigin({ domain, origin }) {
51
- if (!origin) {
52
- return false;
53
- }
54
- const originHost = hostOf(origin);
55
- const domainHost = hostOf(domain);
56
- return !!originHost && originHost === domainHost;
57
- }
58
- /**
59
- * Processes a Verifiable Presentation Request and composes the wallet's
60
- * response. Assumes the user has already consented and (for VC sharing) picked
61
- * which credentials to send.
62
- *
63
- * @param options {object}
64
- * @param options.request {IVPRDetails} - The VPR body.
65
- * @param options.presentationSigner {PresentationSigner} - Authentication signer
66
- * and holder DID.
67
- * @param [options.selectedVCs] {IVerifiableCredential[]} - VCs the user chose to
68
- * share (empty for a DID-Auth-only or zcap-only response).
69
- * @param [options.credentialRequestOrigin] {string} - Channel origin, used for
70
- * the domain-binding check and required by the App Connect branch.
71
- * @param [options.processors] {RequestProcessors} - App-side capability /
72
- * App Connect processors.
73
- * @param [options.cryptosuite] {string} - Cryptosuite override; when absent it
74
- * is negotiated from the request's `acceptedCryptosuites`.
75
- * @returns {Promise<WalletResponse>} The response VP (and any granted zcaps), or
76
- * `{}` when there is nothing to send.
77
- */
78
- export async function processRequest({ request, presentationSigner, selectedVCs = [], credentialRequestOrigin, processors, cryptosuite }) {
79
- const { didAuth, zcapRequests } = classifyRequest(request);
80
- const queries = queriesOf(request);
81
- const { challenge, domain } = request;
82
- // Honor any cryptosuite the verifier asks for (VCALM `acceptedCryptosuites`),
83
- // unless the caller pinned one.
84
- const negotiatedCryptosuite = cryptosuite ?? negotiateCryptosuite(queries);
85
- // Security: never sign an authentication proof bound to a domain the request
86
- // did not actually arrive from. Enforced whenever a `domain` is present,
87
- // including a zcap-only request whose (unsigned) VP still names an origin.
88
- if (domain &&
89
- !domainMatchesOrigin({ domain, origin: credentialRequestOrigin })) {
90
- throw new Error(`DID Auth domain "${domain}" does not match request origin ` +
91
- `"${credentialRequestOrigin}".`);
92
- }
93
- // An App Connect request takes its own single-round branch, handled by the
94
- // injected processor. The requesting origin is what the app key is bound to
95
- // (and what the query's `appUrl` is validated against), so it is required;
96
- // the query itself is validated here (`appConnectRequestOf` throws on a
97
- // malformed `app` block), so the processor only ever sees a well-formed
98
- // request whose `appUrl` is already in serialized form.
99
- const appConnectRequested = queries.some(isAppConnectQuery);
100
- if (appConnectRequested) {
101
- if (!processors?.processAppConnect) {
102
- throw new Error('An App Connect request was received but no processAppConnect ' +
103
- 'processor was provided.');
104
- }
105
- if (!credentialRequestOrigin) {
106
- throw new Error('An App Connect request requires a requesting origin.');
107
- }
108
- const appConnect = appConnectRequestOf({
109
- queries,
110
- origin: credentialRequestOrigin
111
- });
112
- if (!appConnect) {
113
- throw new Error('An AppConnectQuery could not be classified.');
114
- }
115
- return processors.processAppConnect({
116
- request,
117
- appConnect,
118
- origin: credentialRequestOrigin,
119
- challenge,
120
- domain,
121
- didAuthRequested: didAuth,
122
- cryptosuite: negotiatedCryptosuite
123
- });
124
- }
125
- // Delegate the approved capabilities first, then embed them in the VP.
126
- const zcaps = zcapRequests.length > 0 && processors?.processZcaps
127
- ? await processors.processZcaps({ zcapRequests })
128
- : [];
129
- if (!didAuth && selectedVCs.length === 0 && zcaps.length === 0) {
130
- // Nothing to send: no DID Auth, no VCs, and no satisfiable grants.
131
- return {};
132
- }
133
- const verifiablePresentation = await composeVp({
134
- presentationSigner,
135
- selectedVcs: selectedVCs,
136
- challenge,
137
- domain,
138
- didAuthRequested: didAuth,
139
- cryptosuite: negotiatedCryptosuite,
140
- zcaps
141
- });
142
- // Return the delegated capabilities alongside the VP so the caller can log
143
- // exactly what was granted from these objects, rather than reading them back
144
- // off the composed VP.
145
- return { verifiablePresentation, zcaps };
146
- }
147
- //# sourceMappingURL=processRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"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"}
@@ -1,98 +0,0 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Import-free helpers shared by the request classifiers: which VPR query
6
- * type a query object carries, and the parse-and-no-fragment core every URL
7
- * validated straight off a request body layers its own rule on top of. Kept
8
- * in one dependency-light leaf file so `onboarding.ts` can classify a
9
- * `WalletOnboardingQuery` without pulling `classify.ts`'s heavier graph.
10
- */
11
- import type { IVPRQuery, IZcapQuery } from './types.js';
12
- /**
13
- * Whether a query is a standalone capability query, under either type string:
14
- * `AuthorizationCapabilityQuery` (the canonical VCALM spelling) or the legacy
15
- * `ZcapQuery`.
16
- *
17
- * The one reader of that alias pair. Both exclusivity checks and both
18
- * capability extractors ask through here, so retiring or extending the pair
19
- * is one edit rather than four.
20
- *
21
- * @param query {IVPRQuery}
22
- * @returns {boolean}
23
- */
24
- export declare function isZcapQuery(query: IVPRQuery): query is IZcapQuery;
25
- /**
26
- * Whether a query is an `AppConnectQuery`. `AppConnectQuery` extends the spec
27
- * query union rather than being part of it, so it is matched by its `type`
28
- * string and upcast rather than narrowed via a type predicate -- callers
29
- * filtering on this still cast the result to `IAppConnectQuery[]`.
30
- *
31
- * @param query {IVPRQuery}
32
- * @returns {boolean}
33
- */
34
- export declare function isAppConnectQuery(query: IVPRQuery): boolean;
35
- /**
36
- * Whether a query is a `WalletOnboardingQuery`. Matched the same way as
37
- * {@link isAppConnectQuery}.
38
- *
39
- * @param query {IVPRQuery}
40
- * @returns {boolean}
41
- */
42
- export declare function isWalletOnboardingQuery(query: IVPRQuery): boolean;
43
- /**
44
- * The singleton query of a set, under the one-mental-model-per-exchange rule:
45
- * a query type that stands alone in its request. Returns `null` when no query
46
- * of the type is present, the one query when exactly one is, and throws when
47
- * more than one appears or when a query of any mutually exclusive type sits
48
- * beside it. `AppConnectQuery` and `WalletOnboardingQuery` are the two such
49
- * types today, each excluding `QueryByExample`, standalone capability
50
- * queries, and the other; a third is one more call of this with its own
51
- * predicate and exclusion list.
52
- *
53
- * @param options {object}
54
- * @param options.queries {IVPRQuery[]} the request's query set
55
- * @param options.isSingleton {(query: IVPRQuery) => boolean} matches the
56
- * singleton type
57
- * @param options.isExcluded {(query: IVPRQuery) => boolean} matches the
58
- * types that may not accompany it
59
- * @param options.typeName {string} the singleton's type string, for the
60
- * duplicate refusal
61
- * @param options.mixedMessage {string} thrown when an excluded type is
62
- * present
63
- * @returns {IVPRQuery | null}
64
- */
65
- export declare function singletonQueryOf({ queries, isSingleton, isExcluded, typeName, mixedMessage }: {
66
- queries: IVPRQuery[];
67
- isSingleton: (query: IVPRQuery) => boolean;
68
- isExcluded: (query: IVPRQuery) => boolean;
69
- typeName: string;
70
- mixedMessage: string;
71
- }): IVPRQuery | null;
72
- /**
73
- * Parses a wire value as an absolute URL with no fragment: the shared core
74
- * every request field that copies a URL verbatim from an untrusted body
75
- * layers its own rule on top of (an App Connect `appUrl`'s same-origin check,
76
- * a wallet-onboarding `host`'s http(s)-only check). Throws a caller-supplied
77
- * message on a parse failure (with the parse error as `cause`) or on a
78
- * fragment, so each site keeps its own wording while the parse-and-no-
79
- * fragment logic is written once.
80
- *
81
- * The fragment check reads the serialized URL rather than `url.hash`: a bare
82
- * trailing `#` sets an empty (non-null) fragment that `hash` reports as `''`,
83
- * and a percent-encoded `%23` never appears as `#` in the serialization.
84
- *
85
- * @param options {object}
86
- * @param options.value {string} the raw wire value to parse
87
- * @param options.notAbsoluteMessage {string} thrown, with the parse error
88
- * as `cause`, when `value` does not parse as an absolute URL
89
- * @param options.fragmentMessage {string} thrown when the parsed URL
90
- * carries a fragment
91
- * @returns {URL} the parsed URL
92
- */
93
- export declare function parsedAbsoluteUrl({ value, notAbsoluteMessage, fragmentMessage }: {
94
- value: string;
95
- notAbsoluteMessage: string;
96
- fragmentMessage: string;
97
- }): URL;
98
- //# sourceMappingURL=queryPredicates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryPredicates.d.ts","sourceRoot":"","sources":["../../src/request/queryPredicates.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,UAAU,CAIjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAE3D;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEjE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACb,EAAE;IACD,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAA;IAC1C,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAA;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,SAAS,GAAG,IAAI,CAYnB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,kBAAkB,EAClB,eAAe,EAChB,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,kBAAkB,EAAE,MAAM,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,GAAG,CAWN"}
@@ -1,107 +0,0 @@
1
- /**
2
- * Whether a query is a standalone capability query, under either type string:
3
- * `AuthorizationCapabilityQuery` (the canonical VCALM spelling) or the legacy
4
- * `ZcapQuery`.
5
- *
6
- * The one reader of that alias pair. Both exclusivity checks and both
7
- * capability extractors ask through here, so retiring or extending the pair
8
- * is one edit rather than four.
9
- *
10
- * @param query {IVPRQuery}
11
- * @returns {boolean}
12
- */
13
- export function isZcapQuery(query) {
14
- return (query.type === 'AuthorizationCapabilityQuery' || query.type === 'ZcapQuery');
15
- }
16
- /**
17
- * Whether a query is an `AppConnectQuery`. `AppConnectQuery` extends the spec
18
- * query union rather than being part of it, so it is matched by its `type`
19
- * string and upcast rather than narrowed via a type predicate -- callers
20
- * filtering on this still cast the result to `IAppConnectQuery[]`.
21
- *
22
- * @param query {IVPRQuery}
23
- * @returns {boolean}
24
- */
25
- export function isAppConnectQuery(query) {
26
- return query.type === 'AppConnectQuery';
27
- }
28
- /**
29
- * Whether a query is a `WalletOnboardingQuery`. Matched the same way as
30
- * {@link isAppConnectQuery}.
31
- *
32
- * @param query {IVPRQuery}
33
- * @returns {boolean}
34
- */
35
- export function isWalletOnboardingQuery(query) {
36
- return query.type === 'WalletOnboardingQuery';
37
- }
38
- /**
39
- * The singleton query of a set, under the one-mental-model-per-exchange rule:
40
- * a query type that stands alone in its request. Returns `null` when no query
41
- * of the type is present, the one query when exactly one is, and throws when
42
- * more than one appears or when a query of any mutually exclusive type sits
43
- * beside it. `AppConnectQuery` and `WalletOnboardingQuery` are the two such
44
- * types today, each excluding `QueryByExample`, standalone capability
45
- * queries, and the other; a third is one more call of this with its own
46
- * predicate and exclusion list.
47
- *
48
- * @param options {object}
49
- * @param options.queries {IVPRQuery[]} the request's query set
50
- * @param options.isSingleton {(query: IVPRQuery) => boolean} matches the
51
- * singleton type
52
- * @param options.isExcluded {(query: IVPRQuery) => boolean} matches the
53
- * types that may not accompany it
54
- * @param options.typeName {string} the singleton's type string, for the
55
- * duplicate refusal
56
- * @param options.mixedMessage {string} thrown when an excluded type is
57
- * present
58
- * @returns {IVPRQuery | null}
59
- */
60
- export function singletonQueryOf({ queries, isSingleton, isExcluded, typeName, mixedMessage }) {
61
- const matches = queries.filter(isSingleton);
62
- if (matches.length === 0) {
63
- return null;
64
- }
65
- if (matches.length > 1) {
66
- throw new Error(`More than one ${typeName} found, exiting.`);
67
- }
68
- if (queries.some(isExcluded)) {
69
- throw new Error(mixedMessage);
70
- }
71
- return matches[0];
72
- }
73
- /**
74
- * Parses a wire value as an absolute URL with no fragment: the shared core
75
- * every request field that copies a URL verbatim from an untrusted body
76
- * layers its own rule on top of (an App Connect `appUrl`'s same-origin check,
77
- * a wallet-onboarding `host`'s http(s)-only check). Throws a caller-supplied
78
- * message on a parse failure (with the parse error as `cause`) or on a
79
- * fragment, so each site keeps its own wording while the parse-and-no-
80
- * fragment logic is written once.
81
- *
82
- * The fragment check reads the serialized URL rather than `url.hash`: a bare
83
- * trailing `#` sets an empty (non-null) fragment that `hash` reports as `''`,
84
- * and a percent-encoded `%23` never appears as `#` in the serialization.
85
- *
86
- * @param options {object}
87
- * @param options.value {string} the raw wire value to parse
88
- * @param options.notAbsoluteMessage {string} thrown, with the parse error
89
- * as `cause`, when `value` does not parse as an absolute URL
90
- * @param options.fragmentMessage {string} thrown when the parsed URL
91
- * carries a fragment
92
- * @returns {URL} the parsed URL
93
- */
94
- export function parsedAbsoluteUrl({ value, notAbsoluteMessage, fragmentMessage }) {
95
- let url;
96
- try {
97
- url = new URL(value);
98
- }
99
- catch (err) {
100
- throw new Error(notAbsoluteMessage, { cause: err });
101
- }
102
- if (url.href.includes('#')) {
103
- throw new Error(fragmentMessage);
104
- }
105
- return url;
106
- }
107
- //# sourceMappingURL=queryPredicates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryPredicates.js","sourceRoot":"","sources":["../../src/request/queryPredicates.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,8BAA8B,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAC5E,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAgB;IAChD,OAAQ,KAAK,CAAC,IAAe,KAAK,iBAAiB,CAAA;AACrD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAgB;IACtD,OAAQ,KAAK,CAAC,IAAe,KAAK,uBAAuB,CAAA;AAC3D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EAOb;IACC,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,QAAQ,kBAAkB,CAAC,CAAA;IAC9D,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAE,CAAA;AACpB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,kBAAkB,EAClB,eAAe,EAKhB;IACC,IAAI,GAAQ,CAAA;IACZ,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACrD,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IAClC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1,257 +0,0 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * Shared types for the `@interop/wallet-core/request` subpath. The Verifiable
6
- * Presentation Request (VPR) vocabulary itself is owned by
7
- * `@interop/data-integrity-core` (its `VPR` module) and re-exported here so a
8
- * request consumer imports one package; this file adds only the request-local
9
- * types the app sources carried alongside that vocabulary: the CHAPI event
10
- * shapes, the VC-API exchange reply shape, the classified-request profile, and
11
- * the injection-seam types (`PresentationSigner`, `FetchLike`,
12
- * `RequestProcessors`) that keep this layer free of any single app's session /
13
- * network / consent machinery.
14
- *
15
- * Ported from DCW's `app/lib/walletRequestApi.ts` and Freewallet's
16
- * `src/lib/walletRequest/{types,classify}.ts`.
17
- *
18
- * The VPR vocabulary (and the loose-shape guards in `classify` / `matching`) is
19
- * imported from the `@interop/data-integrity-core/vpr` and `/guards` subpaths
20
- * rather than the package root: the vocabulary was added to data-integrity-core
21
- * without a version bump, so the package root can dedup onto an older cached
22
- * build that predates it, whereas the subpath entry points resolve only against
23
- * the current build that defines them.
24
- */
25
- import type { ISigner } from '@interop/data-integrity-core';
26
- import type { IVerifiableCredential, IVerifiablePresentation, IZcap } from '@interop/data-integrity-core';
27
- import type { ICapabilityQueryDetail, IQueryByExample, IVPRDetails as ISpecVPRDetails, WalletResponse } from '@interop/data-integrity-core/vpr';
28
- export type { IVPRequest, IVPOffer, IIssueRequest, IExchangeInvitation, IOid4VCIOffer, IVPRInteract, IVPRQuery, IQueryByExample, ICredentialQuery, IAcceptedCryptosuites, IDIDAuthenticationQuery, IZcapQuery, ICapabilityQueryDetail, IInvocationTarget, IAllowedAction, WalletApiMessage, WalletResponse, IVpRequest, IVpOffer, IVprDetails, IVprQuery, IDidAuthenticationQuery } from '@interop/data-integrity-core/vpr';
29
- export type { IVerifiableCredential, IVerifiablePresentation, IZcap } from '@interop/data-integrity-core';
30
- /**
31
- * The protocol handles a verifier offers alongside a CHAPI request. Only
32
- * `vcapi` (and the newer `interact` meta-protocol) are acted on; `OID4VP` /
33
- * `OID4VCI` are recognized but unused.
34
- */
35
- export interface CHAPIProtocols {
36
- vcapi?: string;
37
- interact?: string;
38
- OID4VP?: string;
39
- OID4VCI?: string;
40
- }
41
- /**
42
- * The body of a Verifiable Presentation Request, widened from the spec
43
- * vocabulary with the wallet-layer `agent` member: the requester's
44
- * self-declared display name on a standalone capability request (an agent
45
- * asking for grants through an interaction URL, where no attested origin
46
- * names it). One member at the VPR root rather than one per query, since a
47
- * single agent sends the whole request. Display only and attacker-controlled,
48
- * like App Connect's `app.name`; `requestingAgentOf` validates it.
49
- */
50
- export type IVPRDetails = ISpecVPRDetails & {
51
- agent?: {
52
- name: string;
53
- };
54
- };
55
- /**
56
- * Raw CHAPI credential-get event. The `VerifiablePresentation` object CHAPI
57
- * hands us *is* the VPR body (`query` / `challenge` / `domain`); classification
58
- * rewraps it as an `IVPRequest`. When the verifier names a `protocols` handle
59
- * it sends that body empty instead, and the VPR must be fetched from the
60
- * protocol exchange (see `exchangeClient.ts`).
61
- */
62
- export interface CHAPIGetEvent {
63
- credentialRequestOrigin: string;
64
- credentialRequestOptions?: {
65
- web?: {
66
- VerifiablePresentation?: IVPRDetails;
67
- protocols?: CHAPIProtocols;
68
- };
69
- };
70
- respondWith(promise: Promise<{
71
- dataType: string;
72
- data: unknown;
73
- } | null>): void;
74
- }
75
- /**
76
- * Raw CHAPI credential-store event. `credential.data` is the offered payload,
77
- * and `credential.dataType` names its shape: issuers may offer either a
78
- * `VerifiablePresentation` wrapping the credential(s), or a bare
79
- * `VerifiableCredential` (what vcplayground.org sends). An issuer that names a
80
- * `protocols` handle in `credential.options` sends `data` empty instead, and
81
- * the offered credentials must be fetched from the protocol exchange (see
82
- * `exchangeClient.ts`).
83
- */
84
- export interface CHAPIStoreEvent {
85
- credentialRequestOrigin?: string;
86
- credential: {
87
- dataType?: string;
88
- data: IVerifiablePresentation | IVerifiableCredential;
89
- options?: {
90
- protocols?: CHAPIProtocols;
91
- recommendedHandlerOrigins?: string[];
92
- };
93
- };
94
- respondWith(promise: Promise<{
95
- dataType: string;
96
- data: unknown;
97
- } | null>): void;
98
- }
99
- /**
100
- * The exchange's reply to either wallet call. A multi-step exchange answers a
101
- * submitted presentation with another `verifiablePresentationRequest`; a
102
- * finished one answers with nothing, or with credentials it issued, or with a
103
- * `redirectUrl` for the user to land on.
104
- */
105
- export interface VCAPIExchangeResponse {
106
- verifiablePresentationRequest?: IVPRDetails;
107
- verifiablePresentation?: IVerifiablePresentation;
108
- redirectUrl?: string;
109
- }
110
- /**
111
- * A VP Request classified on independent axes: whether DID Authentication is
112
- * requested, what credentials are asked for (`vcQueries`), and what capability
113
- * delegations are asked for (`zcapRequests`). Any combination is valid,
114
- * including zcap-only. An app that layers additional query kinds on top (e.g.
115
- * Freewallet's App Connect) extends this shape with its own field.
116
- */
117
- export interface WalletRequestProfile {
118
- didAuth: boolean;
119
- vcQueries: IQueryByExample[];
120
- zcapRequests: ICapabilityQueryDetail[];
121
- /**
122
- * The requester's self-declared display name (the VPR's `agent.name`,
123
- * validated and trimmed), present only when the request carried one.
124
- */
125
- agent?: {
126
- name: string;
127
- };
128
- }
129
- /**
130
- * A capability request entry as an `AppConnectQuery` carries it: the standard
131
- * capability-query detail minus the members the wallet itself fills or refuses
132
- * (`controller` is filled with the app-key subject DID at delegation time;
133
- * `reason` is display-bearing and not accepted from an App Connect request).
134
- */
135
- export type IAppConnectCapabilityQuery = Omit<ICapabilityQueryDetail, 'controller' | 'reason'>;
136
- /**
137
- * The app identity an App Connect request presents: a display `name` for the
138
- * consent surface (attacker-controlled free text, never evidence of identity)
139
- * and the application's canonical `appUrl`, which scopes the app-key identity
140
- * within the requesting origin. Validated by `appConnectRequestOf`: the
141
- * `appUrl` must parse as an absolute URL, carry no fragment, and be
142
- * same-origin with the attested requesting origin.
143
- */
144
- export type IAppConnectApp = {
145
- name: string;
146
- appUrl: string;
147
- };
148
- /**
149
- * "Connect this app to the user's wallet and Space" -- a single-round request
150
- * that combines app-key recovery-or-minting with capability delegation. The
151
- * wallet finds (or self-issues) the app-key credential for the requesting
152
- * origin and `appUrl`, delegates the requested capabilities to its subject
153
- * DID, and returns credential + grants in one signed presentation.
154
- */
155
- export type IAppConnectQuery = {
156
- type: 'AppConnectQuery';
157
- app: IAppConnectApp;
158
- capabilityQuery?: IAppConnectCapabilityQuery | IAppConnectCapabilityQuery[];
159
- };
160
- /**
161
- * An App Connect request as classified and validated by
162
- * `appConnectRequestOf`: the app identity (its `appUrl` already in serialized
163
- * form) plus its capability queries normalized to an array.
164
- */
165
- export type IAppConnectRequest = {
166
- app: IAppConnectApp;
167
- capabilityQueries: IAppConnectCapabilityQuery[];
168
- };
169
- /**
170
- * "Connect a new wallet client to this account" -- the query an already-
171
- * enrolled wallet client (the inviter) puts in the VPR of an ephemeral
172
- * exchange for a fresh wallet (the enrollee) to answer. It carries everything
173
- * the enrollee needs to find the account, so no secret is required of the
174
- * person joining:
175
- *
176
- * - `did` -- the account's stable did:webvh id, whose log is world-readable
177
- * and is where the enrollee verifies its own approval.
178
- * - `spaceId` and `host` -- where the account lives (the WAS server base URL
179
- * and the Space on it); together with `did` these are exactly the account
180
- * pointer a keyring record carries (keyring's `AccountPointer` shape), so
181
- * the inviter passes its session pointer straight in.
182
- * - `controller` -- the account controller did:key, what the enrollee's own
183
- * profile link stores once it has joined.
184
- *
185
- * Discovery only: the query names the account but authorizes nothing. Every
186
- * act on the Space still requires zcaps a holder of the QR or capability URL
187
- * does not have, and nothing is authorized before the ceremony's
188
- * confirmation-code comparison. The enrollee answers off-band of the VPR
189
- * vocabulary, with the onboarding response envelope
190
- * (`@interop/wallet-core/enrollment`), whose payload is an ordinary connect
191
- * code.
192
- */
193
- export type IWalletOnboardingQuery = {
194
- type: 'WalletOnboardingQuery';
195
- host: string;
196
- did: string;
197
- spaceId: string;
198
- controller: string;
199
- };
200
- /**
201
- * A wallet-onboarding request as classified and validated by
202
- * `walletOnboardingRequestOf`: the account's did:webvh `did`, its `spaceId`,
203
- * the `host` already in serialized URL form (the three together being the
204
- * account pointer), and the account controller did:key.
205
- */
206
- export type IWalletOnboardingRequest = {
207
- host: string;
208
- did: string;
209
- spaceId: string;
210
- controller: string;
211
- };
212
- /**
213
- * The authentication signer plus the DID to name as the VP `holder`. Each app
214
- * resolves this from its own key material (DCW from the selected profile's
215
- * `authentication` signer + DID; Freewallet from the KMS did:web key or the
216
- * passphrase-derived root key) before handing it to the shared compose path.
217
- */
218
- export interface PresentationSigner {
219
- signer: ISigner;
220
- holder: string;
221
- }
222
- /**
223
- * Injected network transport. Defaults to `globalThis.fetch`; DCW passes its
224
- * `fetchWithTimeout`, Freewallet its CORS-proxy fetch.
225
- */
226
- export type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
227
- /**
228
- * App-side processors injected into {@link processRequest}. Both are optional:
229
- * a wallet that grants no capabilities omits `processZcaps`, and a wallet
230
- * without an App Connect flow omits `processAppConnect` (the branch is then
231
- * inert).
232
- */
233
- export interface RequestProcessors {
234
- /**
235
- * Delegates the approved capabilities and returns the minted zcaps.
236
- * Freewallet supplies `processZcaps(session)`; DCW supplies a no-op / `[]`.
237
- */
238
- processZcaps?: (args: {
239
- zcapRequests: ICapabilityQueryDetail[];
240
- }) => Promise<IZcap[]>;
241
- /**
242
- * Handles the App Connect single-round branch. Invoked when the request
243
- * carries an `AppConnectQuery`; `appConnect` arrives already validated by
244
- * `appConnectRequestOf` (its `app.appUrl` in serialized form), so the
245
- * processor never sees a malformed app block.
246
- */
247
- processAppConnect?: (args: {
248
- request: IVPRDetails;
249
- appConnect: IAppConnectRequest;
250
- origin: string;
251
- challenge?: string;
252
- domain?: string;
253
- didAuthRequested: boolean;
254
- cryptosuite?: string;
255
- }) => Promise<WalletResponse>;
256
- }
257
- //# sourceMappingURL=types.d.ts.map