@interop/wallet-core 0.23.1 → 0.25.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.
- package/README.md +41 -22
- package/dist/clients/index.d.ts +6 -4
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +5 -3
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/policy.d.ts +11 -3
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +12 -4
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +24 -9
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +23 -10
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +23 -22
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +50 -31
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/acquire.d.ts +4 -1
- package/dist/descriptors/acquire.d.ts.map +1 -1
- package/dist/descriptors/acquire.js +29 -1
- package/dist/descriptors/acquire.js.map +1 -1
- package/dist/descriptors/index.d.ts +9 -1
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +9 -1
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +33 -0
- package/dist/descriptors/logSource.d.ts.map +1 -0
- package/dist/descriptors/logSource.js +49 -0
- package/dist/descriptors/logSource.js.map +1 -0
- package/dist/enrollment/enrollment.d.ts +2 -2
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +15 -10
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/keys/index.d.ts +15 -8
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +14 -8
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +53 -0
- package/dist/keys/rosterLogStore.d.ts.map +1 -0
- package/dist/keys/rosterLogStore.js +134 -0
- package/dist/keys/rosterLogStore.js.map +1 -0
- package/dist/keys/rosterStore.d.ts +20 -6
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +36 -17
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/userKeyCascade.d.ts +14 -7
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +12 -3
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +50 -97
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +44 -145
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/request/appKey.d.ts +255 -0
- package/dist/request/appKey.d.ts.map +1 -0
- package/dist/request/appKey.js +492 -0
- package/dist/request/appKey.js.map +1 -0
- package/dist/request/classify.d.ts +54 -3
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +106 -0
- package/dist/request/classify.js.map +1 -1
- package/dist/request/composeVp.d.ts +6 -7
- package/dist/request/composeVp.d.ts.map +1 -1
- package/dist/request/composeVp.js +44 -55
- package/dist/request/composeVp.js.map +1 -1
- package/dist/request/index.d.ts +4 -0
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +4 -0
- package/dist/request/index.js.map +1 -1
- package/dist/request/processRequest.d.ts +1 -4
- package/dist/request/processRequest.d.ts.map +1 -1
- package/dist/request/processRequest.js +17 -11
- package/dist/request/processRequest.js.map +1 -1
- package/dist/request/types.d.ts +45 -2
- package/dist/request/types.d.ts.map +1 -1
- package/dist/resourceLog/append.d.ts +103 -0
- package/dist/resourceLog/append.d.ts.map +1 -0
- package/dist/resourceLog/append.js +190 -0
- package/dist/resourceLog/append.js.map +1 -0
- package/dist/resourceLog/controller.d.ts +57 -0
- package/dist/resourceLog/controller.d.ts.map +1 -0
- package/dist/resourceLog/controller.js +81 -0
- package/dist/resourceLog/controller.js.map +1 -0
- package/dist/resourceLog/entry.d.ts +68 -0
- package/dist/resourceLog/entry.d.ts.map +1 -0
- package/dist/resourceLog/entry.js +167 -0
- package/dist/resourceLog/entry.js.map +1 -0
- package/dist/resourceLog/errors.d.ts +75 -0
- package/dist/resourceLog/errors.d.ts.map +1 -0
- package/dist/resourceLog/errors.js +76 -0
- package/dist/resourceLog/errors.js.map +1 -0
- package/dist/resourceLog/index.d.ts +26 -0
- package/dist/resourceLog/index.d.ts.map +1 -0
- package/dist/resourceLog/index.js +26 -0
- package/dist/resourceLog/index.js.map +1 -0
- package/dist/resourceLog/pin.d.ts +44 -0
- package/dist/resourceLog/pin.d.ts.map +1 -0
- package/dist/resourceLog/pin.js +32 -0
- package/dist/resourceLog/pin.js.map +1 -0
- package/dist/resourceLog/seal.d.ts +86 -0
- package/dist/resourceLog/seal.d.ts.map +1 -0
- package/dist/resourceLog/seal.js +99 -0
- package/dist/resourceLog/seal.js.map +1 -0
- package/dist/resourceLog/verify.d.ts +95 -0
- package/dist/resourceLog/verify.d.ts.map +1 -0
- package/dist/resourceLog/verify.js +435 -0
- package/dist/resourceLog/verify.js.map +1 -0
- package/dist/space/collections.d.ts +14 -11
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +14 -11
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +2 -2
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +2 -2
- package/dist/space/index.js.map +1 -1
- package/dist/webvh/didWeb.d.ts +4 -6
- package/dist/webvh/didWeb.d.ts.map +1 -1
- package/dist/webvh/didWeb.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +1 -2
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +1 -6
- package/dist/webvh/didWebvh.js.map +1 -1
- package/package.json +11 -4
package/dist/request/classify.js
CHANGED
|
@@ -180,6 +180,112 @@ export function zcapQueriesOf(queries) {
|
|
|
180
180
|
return detailEntries;
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Validates an App Connect `app.appUrl` against the attested requesting origin
|
|
185
|
+
* and returns its serialized form. The value must parse as an absolute URL,
|
|
186
|
+
* must not carry a fragment, and its origin must equal the attested origin;
|
|
187
|
+
* any violation throws (the query is malformed). All storage and comparison
|
|
188
|
+
* downstream uses the returned serialization, so spellings differing only in
|
|
189
|
+
* a default port, percent-encoding case, or dot-segments do not name distinct
|
|
190
|
+
* applications.
|
|
191
|
+
*
|
|
192
|
+
* The fragment check reads the serialized URL rather than `url.hash`: a bare
|
|
193
|
+
* trailing `#` sets an empty (non-null) fragment that `hash` reports as `''`,
|
|
194
|
+
* and a percent-encoded `%23` never appears as `#` in the serialization.
|
|
195
|
+
*
|
|
196
|
+
* @param options {object}
|
|
197
|
+
* @param options.appUrl {string} - The request's `app.appUrl`.
|
|
198
|
+
* @param options.origin {string} - The attested requesting origin.
|
|
199
|
+
* @returns {string} The parsed URL's serialization.
|
|
200
|
+
*/
|
|
201
|
+
export function serializedAppUrl({ appUrl, origin }) {
|
|
202
|
+
let url;
|
|
203
|
+
try {
|
|
204
|
+
url = new URL(appUrl);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
throw new Error(`An AppConnectQuery "appUrl" must be an absolute URL (got "${appUrl}").`, { cause: err });
|
|
208
|
+
}
|
|
209
|
+
if (url.href.includes('#')) {
|
|
210
|
+
throw new Error(`An AppConnectQuery "appUrl" must not carry a fragment (got "${appUrl}").`);
|
|
211
|
+
}
|
|
212
|
+
let attestedOrigin;
|
|
213
|
+
try {
|
|
214
|
+
attestedOrigin = new URL(origin).origin;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
attestedOrigin = origin;
|
|
218
|
+
}
|
|
219
|
+
if (url.origin !== attestedOrigin) {
|
|
220
|
+
throw new Error(`An AppConnectQuery "appUrl" must be same-origin with the requesting ` +
|
|
221
|
+
`origin "${origin}" (got "${appUrl}").`);
|
|
222
|
+
}
|
|
223
|
+
return url.href;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Extracts the App Connect request from a query set, when one is present. An
|
|
227
|
+
* `AppConnectQuery` is one mental model per popup: the request must not also
|
|
228
|
+
* carry `QueryByExample` or standalone zcap queries, at most one
|
|
229
|
+
* `AppConnectQuery` is allowed, and its `app` block must carry the display
|
|
230
|
+
* `name` and the `appUrl` the wallet needs to match or mint the app-key
|
|
231
|
+
* credential -- with the `appUrl` validated against the attested requesting
|
|
232
|
+
* origin and rewritten to its serialized form ({@link serializedAppUrl}).
|
|
233
|
+
* Violations throw; classification-time callers surface the throw as a
|
|
234
|
+
* malformed-request state. The capability queries are normalized to an array
|
|
235
|
+
* (absent means "no grants requested" -- a connect that only recovers the app
|
|
236
|
+
* key is legal), and each entry is rebuilt from an allowlist of the declared
|
|
237
|
+
* fields (`referenceId`, `allowedAction`, `invocationTarget`): the type-level
|
|
238
|
+
* Omit does not bind an actual request body, so any other wire-level field --
|
|
239
|
+
* a smuggled `reason`, an attacker-chosen `controller`, a future
|
|
240
|
+
* display-bearing addition -- is made unrepresentable here, before the entries
|
|
241
|
+
* reach the profile the consent screen and the delegation path read.
|
|
242
|
+
*
|
|
243
|
+
* @param options {object}
|
|
244
|
+
* @param options.queries {IVPRQuery[]}
|
|
245
|
+
* @param options.origin {string} - The attested requesting origin the
|
|
246
|
+
* `appUrl` is validated against.
|
|
247
|
+
* @returns {IAppConnectRequest | null}
|
|
248
|
+
*/
|
|
249
|
+
export function appConnectRequestOf({ queries, origin }) {
|
|
250
|
+
// `AppConnectQuery` extends the spec query union, so it is matched by its
|
|
251
|
+
// `type` string and upcast rather than narrowed via a type predicate.
|
|
252
|
+
const appConnectQueries = queries.filter(query => query.type === 'AppConnectQuery');
|
|
253
|
+
if (appConnectQueries.length === 0) {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
if (appConnectQueries.length > 1) {
|
|
257
|
+
throw new Error('More than one AppConnectQuery found, exiting.');
|
|
258
|
+
}
|
|
259
|
+
const mixed = queries.some(query => query.type === 'QueryByExample' ||
|
|
260
|
+
query.type === 'AuthorizationCapabilityQuery' ||
|
|
261
|
+
query.type === 'ZcapQuery');
|
|
262
|
+
if (mixed) {
|
|
263
|
+
throw new Error('An AppConnectQuery cannot be combined with QueryByExample or ' +
|
|
264
|
+
'standalone capability queries.');
|
|
265
|
+
}
|
|
266
|
+
const { app, capabilityQuery } = appConnectQueries[0];
|
|
267
|
+
if (!app || typeof app.name !== 'string' || typeof app.appUrl !== 'string') {
|
|
268
|
+
throw new Error('An AppConnectQuery is missing its app name / appUrl.');
|
|
269
|
+
}
|
|
270
|
+
const appUrl = serializedAppUrl({ appUrl: app.appUrl, origin });
|
|
271
|
+
const rawQueries = capabilityQuery === undefined
|
|
272
|
+
? []
|
|
273
|
+
: Array.isArray(capabilityQuery)
|
|
274
|
+
? capabilityQuery
|
|
275
|
+
: [capabilityQuery];
|
|
276
|
+
const capabilityQueries = rawQueries.map(detail => {
|
|
277
|
+
if (!detail || typeof detail !== 'object') {
|
|
278
|
+
throw new Error('An AppConnectQuery carries a malformed capabilityQuery entry.');
|
|
279
|
+
}
|
|
280
|
+
const { referenceId, allowedAction, invocationTarget } = detail;
|
|
281
|
+
return {
|
|
282
|
+
...(referenceId !== undefined && { referenceId }),
|
|
283
|
+
...(allowedAction !== undefined && { allowedAction }),
|
|
284
|
+
invocationTarget
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
return { app: { name: app.name, appUrl }, capabilityQueries };
|
|
288
|
+
}
|
|
183
289
|
/**
|
|
184
290
|
* Classifies a VPR body onto the independent axes the consent screen and
|
|
185
291
|
* response assembly work from: whether DID Authentication is requested, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/request/classify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/request/classify.ts"],"names":[],"mappings":"AAkCA,OAA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;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,OAA6B;IACzD,OAAO,CACL,OAAO,CAAC,OAAO;QACf,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;QAC9B,OAAO,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAClC,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAoB;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,mBAAmB,CACnC,CAAA;IACrC,MAAM,eAAe,GAAG,OAAO,EAAE,eAAe,CAAA;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpE,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC,CAAA;AACzE,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { IDocumentLoader } from '@interop/data-integrity-core';
|
|
2
2
|
import type { IVerifiablePresentation, IVerifiableCredential, IZcap, PresentationSigner } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Shared JSON-LD document loader for presentation and credential signing
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Shared JSON-LD document loader for presentation and credential signing: the
|
|
5
|
+
* standard security contexts plus the hosted App Connect context, resolved
|
|
6
|
+
* from the bundled `byoe-context` document so neither signing nor verification
|
|
7
|
+
* fetches it. Exported so single-VC issuance paths reuse the same context
|
|
8
|
+
* resolution the VP compose path uses.
|
|
7
9
|
*/
|
|
8
10
|
export declare const documentLoader: IDocumentLoader;
|
|
9
11
|
/**
|
|
@@ -25,13 +27,11 @@ export declare const documentLoader: IDocumentLoader;
|
|
|
25
27
|
* VP's `zcap` array (before signing, so a DIDAuth proof covers them).
|
|
26
28
|
* @param [options.appConnect] {{ firstRun: boolean }} - App Connect response
|
|
27
29
|
* marker to embed (before signing, like the grants).
|
|
28
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI for the embedded
|
|
29
|
-
* term definitions; defaults to Freewallet's value.
|
|
30
30
|
* @param [options.documentLoader] {IDocumentLoader} - JSON-LD loader; defaults
|
|
31
31
|
* to the shared security loader.
|
|
32
32
|
* @returns {Promise<IVerifiablePresentation>}
|
|
33
33
|
*/
|
|
34
|
-
export declare function composeVp({ presentationSigner, selectedVcs, challenge, domain, didAuthRequested, cryptosuite, zcaps, appConnect,
|
|
34
|
+
export declare function composeVp({ presentationSigner, selectedVcs, challenge, domain, didAuthRequested, cryptosuite, zcaps, appConnect, documentLoader: loader }: {
|
|
35
35
|
presentationSigner?: PresentationSigner;
|
|
36
36
|
selectedVcs?: IVerifiableCredential[];
|
|
37
37
|
challenge?: string;
|
|
@@ -42,7 +42,6 @@ export declare function composeVp({ presentationSigner, selectedVcs, challenge,
|
|
|
42
42
|
appConnect?: {
|
|
43
43
|
firstRun: boolean;
|
|
44
44
|
};
|
|
45
|
-
vocabBaseIri?: string;
|
|
46
45
|
documentLoader?: IDocumentLoader;
|
|
47
46
|
}): Promise<IVerifiablePresentation>;
|
|
48
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeVp.d.ts","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"composeVp.d.ts","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAGnE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,EACL,kBAAkB,EACnB,MAAM,YAAY,CAAA;AAEnB;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,eAMzB,CAAA;AAsFJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,SAAS,CAAC,EAC9B,kBAAkB,EAClB,WAAgB,EAChB,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,KAAU,EACV,UAAU,EACV,cAAc,EAAE,MAAuB,EACxC,EAAE;IACD,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAA;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,OAAO,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,KAAK,EAAE,CAAA;IACf,UAAU,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAA;IAClC,cAAc,CAAC,EAAE,eAAe,CAAA;CACjC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAyDnC;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,kBAAY,CAAA"}
|
|
@@ -18,23 +18,31 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import * as vc from '@interop/vc';
|
|
20
20
|
import { securityLoader } from '@interop/security-document-loader';
|
|
21
|
+
import { contexts as byoeContexts, CONTEXT_URL_V1 } from 'byoe-context';
|
|
21
22
|
import { presentationSuiteFor } from './presentationSuite.js';
|
|
22
23
|
import { presentationVersionFor } from './classify.js';
|
|
23
24
|
/**
|
|
24
|
-
* Shared JSON-LD document loader for presentation and credential signing
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Shared JSON-LD document loader for presentation and credential signing: the
|
|
26
|
+
* standard security contexts plus the hosted App Connect context, resolved
|
|
27
|
+
* from the bundled `byoe-context` document so neither signing nor verification
|
|
28
|
+
* fetches it. Exported so single-VC issuance paths reuse the same context
|
|
29
|
+
* resolution the VP compose path uses.
|
|
27
30
|
*/
|
|
28
|
-
export const documentLoader =
|
|
29
|
-
fetchRemoteContexts: true
|
|
30
|
-
|
|
31
|
+
export const documentLoader = (() => {
|
|
32
|
+
const loader = securityLoader({ fetchRemoteContexts: true });
|
|
33
|
+
for (const [url, context] of byoeContexts) {
|
|
34
|
+
loader.addStatic(url, context);
|
|
35
|
+
}
|
|
36
|
+
return loader.build();
|
|
37
|
+
})();
|
|
31
38
|
/**
|
|
32
|
-
* The
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
39
|
+
* The hosted App Connect context URL appended to the VP `@context` when grants
|
|
40
|
+
* or the App Connect response marker are embedded. The context document
|
|
41
|
+
* defines the `zcap` (`@container: @set`) and `appConnect` (`@type: @json`)
|
|
42
|
+
* terms, which is what lets JSON-LD safe-mode canonicalization include (rather
|
|
43
|
+
* than reject) the members, so the authentication proof genuinely covers them.
|
|
36
44
|
*/
|
|
37
|
-
const
|
|
45
|
+
const APP_CONNECT_CONTEXT_URL = CONTEXT_URL_V1;
|
|
38
46
|
/**
|
|
39
47
|
* Reads a presentation's `@context` as a mutable array of entries.
|
|
40
48
|
*/
|
|
@@ -50,58 +58,41 @@ function setContext(presentation, entries) {
|
|
|
50
58
|
presentation['@context'] = entries;
|
|
51
59
|
}
|
|
52
60
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* canonicalization include (rather than reject) the grants, so the
|
|
58
|
-
* authentication proof genuinely covers them.
|
|
59
|
-
*/
|
|
60
|
-
function zcapTermContext(vocabBaseIri) {
|
|
61
|
-
return {
|
|
62
|
-
'@protected': true,
|
|
63
|
-
zcap: { '@id': `${vocabBaseIri}zcap`, '@container': '@set' }
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* The `appConnect` term definition appended to the VP `@context` when an App
|
|
68
|
-
* Connect response marker is embedded. The member is a JSON literal
|
|
69
|
-
* (`@type: '@json'`) so its `firstRun` boolean canonicalizes as one opaque
|
|
70
|
-
* value; embedding happens before signing, so the DIDAuth proof covers the
|
|
71
|
-
* marker the same way it covers the grants.
|
|
61
|
+
* Appends the hosted App Connect context URL to the presentation's `@context`,
|
|
62
|
+
* once: a response carrying both grants and the marker still appends a single
|
|
63
|
+
* entry. Each embedded zcap additionally self-describes via its own
|
|
64
|
+
* `@context`; the profile context defines only the top-level members.
|
|
72
65
|
*/
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
66
|
+
function appendAppConnectContext(presentation) {
|
|
67
|
+
const entries = contextEntries(presentation);
|
|
68
|
+
if (entries.includes(APP_CONNECT_CONTEXT_URL)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setContext(presentation, [...entries, APP_CONNECT_CONTEXT_URL]);
|
|
78
72
|
}
|
|
79
73
|
/**
|
|
80
|
-
* Embeds the delegated capabilities on the presentation and
|
|
81
|
-
* `zcap` term
|
|
74
|
+
* Embeds the delegated capabilities on the presentation and appends the App
|
|
75
|
+
* Connect context that defines the `zcap` term.
|
|
82
76
|
*/
|
|
83
|
-
function embedZcaps(presentation, zcaps
|
|
77
|
+
function embedZcaps(presentation, zcaps) {
|
|
84
78
|
if (zcaps.length === 0) {
|
|
85
79
|
return;
|
|
86
80
|
}
|
|
87
|
-
|
|
88
|
-
...contextEntries(presentation),
|
|
89
|
-
zcapTermContext(vocabBaseIri)
|
|
90
|
-
]);
|
|
81
|
+
appendAppConnectContext(presentation);
|
|
91
82
|
presentation.zcap = zcaps;
|
|
92
83
|
}
|
|
93
84
|
/**
|
|
94
85
|
* Embeds the App Connect response marker (the wallet-provided `firstRun`
|
|
95
|
-
* signal) on the presentation and
|
|
86
|
+
* signal) on the presentation and appends the App Connect context that defines
|
|
87
|
+
* the `appConnect` term (a JSON literal, so its `firstRun` boolean
|
|
88
|
+
* canonicalizes as one opaque value; embedding happens before signing, so the
|
|
89
|
+
* DIDAuth proof covers the marker the same way it covers the grants).
|
|
96
90
|
*/
|
|
97
|
-
function embedAppConnect(presentation, appConnect
|
|
91
|
+
function embedAppConnect(presentation, appConnect) {
|
|
98
92
|
if (!appConnect) {
|
|
99
93
|
return;
|
|
100
94
|
}
|
|
101
|
-
|
|
102
|
-
...contextEntries(presentation),
|
|
103
|
-
appConnectTermContext(vocabBaseIri)
|
|
104
|
-
]);
|
|
95
|
+
appendAppConnectContext(presentation);
|
|
105
96
|
presentation.appConnect = appConnect;
|
|
106
97
|
}
|
|
107
98
|
/**
|
|
@@ -123,13 +114,11 @@ function embedAppConnect(presentation, appConnect, vocabBaseIri) {
|
|
|
123
114
|
* VP's `zcap` array (before signing, so a DIDAuth proof covers them).
|
|
124
115
|
* @param [options.appConnect] {{ firstRun: boolean }} - App Connect response
|
|
125
116
|
* marker to embed (before signing, like the grants).
|
|
126
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI for the embedded
|
|
127
|
-
* term definitions; defaults to Freewallet's value.
|
|
128
117
|
* @param [options.documentLoader] {IDocumentLoader} - JSON-LD loader; defaults
|
|
129
118
|
* to the shared security loader.
|
|
130
119
|
* @returns {Promise<IVerifiablePresentation>}
|
|
131
120
|
*/
|
|
132
|
-
export async function composeVp({ presentationSigner, selectedVcs = [], challenge, domain, didAuthRequested, cryptosuite, zcaps = [], appConnect,
|
|
121
|
+
export async function composeVp({ presentationSigner, selectedVcs = [], challenge, domain, didAuthRequested, cryptosuite, zcaps = [], appConnect, documentLoader: loader = documentLoader }) {
|
|
133
122
|
if (!didAuthRequested && selectedVcs.length === 0 && zcaps.length === 0) {
|
|
134
123
|
throw new Error('A VP requires credentials, capabilities, or a DID Auth request.');
|
|
135
124
|
}
|
|
@@ -147,8 +136,8 @@ export async function composeVp({ presentationSigner, selectedVcs = [], challeng
|
|
|
147
136
|
verify: false,
|
|
148
137
|
version: presentationVersionFor(selectedVcs)
|
|
149
138
|
});
|
|
150
|
-
embedZcaps(presentation, zcaps
|
|
151
|
-
embedAppConnect(presentation, appConnect
|
|
139
|
+
embedZcaps(presentation, zcaps);
|
|
140
|
+
embedAppConnect(presentation, appConnect);
|
|
152
141
|
return presentation;
|
|
153
142
|
}
|
|
154
143
|
if (!presentationSigner) {
|
|
@@ -169,8 +158,8 @@ export async function composeVp({ presentationSigner, selectedVcs = [], challeng
|
|
|
169
158
|
// Embed the grants (and any App Connect marker) before signing so the
|
|
170
159
|
// authentication proof covers them; the grants additionally self-authenticate
|
|
171
160
|
// via their own delegation proofs and carry their own `@context`.
|
|
172
|
-
embedZcaps(presentation, zcaps
|
|
173
|
-
embedAppConnect(presentation, appConnect
|
|
161
|
+
embedZcaps(presentation, zcaps);
|
|
162
|
+
embedAppConnect(presentation, appConnect);
|
|
174
163
|
return (await vc.signPresentation({
|
|
175
164
|
presentation,
|
|
176
165
|
challenge,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeVp.js","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"composeVp.js","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAQtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoB,CAAC,GAAG,EAAE;IACnD,MAAM,MAAM,GAAG,cAAc,CAAC,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MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACrE,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAAA;IAE7C,8DAA8D;IAC9D,yEAAyE;IACzE,6EAA6E;IAC7E,sDAAsD;IACtD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,oBAAoB,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAA;IAExE,MAAM,YAAY,GAAG,EAAE,CAAC,kBAAkB,CAAC;QACzC,MAAM;QACN,oBAAoB,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;QACtE,MAAM,EAAE,KAAK;QACb,OAAO;KACR,CAA0B,CAAA;IAE3B,sEAAsE;IACtE,8EAA8E;IAC9E,kEAAkE;IAClE,UAAU,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;IAC/B,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IAEzC,OAAO,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC;QAChC,YAAY;QACZ,SAAS;QACT,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;QACvC,cAAc,EAAE,MAAM;QACtB,KAAK;KACN,CAAC,CAA4B,CAAA;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAA"}
|
package/dist/request/index.d.ts
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* typed message and dispatch on what it asks for.
|
|
14
14
|
* - `matching` filters stored credentials against a QueryByExample (both the
|
|
15
15
|
* jsonpath deep matcher and the type/issuer matcher).
|
|
16
|
+
* - `appKey` is the App Connect app-key credential module: the wire constants,
|
|
17
|
+
* the matching / minting / legacy re-issue paths, and the store-time
|
|
18
|
+
* refusal policy.
|
|
16
19
|
* - `presentationSuite` negotiates the response cryptosuite; `composeVp` builds
|
|
17
20
|
* the (optionally signed, optionally grant-embedding) response VP.
|
|
18
21
|
* - `exchangeClient` is the fetch-injectable VC-API exchange client;
|
|
@@ -30,6 +33,7 @@ export * from './types.js';
|
|
|
30
33
|
export * from './parse.js';
|
|
31
34
|
export * from './classify.js';
|
|
32
35
|
export * from './matching.js';
|
|
36
|
+
export * from './appKey.js';
|
|
33
37
|
export * from './presentationSuite.js';
|
|
34
38
|
export * from './composeVp.js';
|
|
35
39
|
export * from './exchangeClient.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
package/dist/request/index.js
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* typed message and dispatch on what it asks for.
|
|
14
14
|
* - `matching` filters stored credentials against a QueryByExample (both the
|
|
15
15
|
* jsonpath deep matcher and the type/issuer matcher).
|
|
16
|
+
* - `appKey` is the App Connect app-key credential module: the wire constants,
|
|
17
|
+
* the matching / minting / legacy re-issue paths, and the store-time
|
|
18
|
+
* refusal policy.
|
|
16
19
|
* - `presentationSuite` negotiates the response cryptosuite; `composeVp` builds
|
|
17
20
|
* the (optionally signed, optionally grant-embedding) response VP.
|
|
18
21
|
* - `exchangeClient` is the fetch-injectable VC-API exchange client;
|
|
@@ -30,6 +33,7 @@ export * from './types.js';
|
|
|
30
33
|
export * from './parse.js';
|
|
31
34
|
export * from './classify.js';
|
|
32
35
|
export * from './matching.js';
|
|
36
|
+
export * from './appKey.js';
|
|
33
37
|
export * from './presentationSuite.js';
|
|
34
38
|
export * from './composeVp.js';
|
|
35
39
|
export * from './exchangeClient.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
@@ -31,18 +31,15 @@ export declare function domainMatchesOrigin({ domain, origin }: {
|
|
|
31
31
|
* App Connect processors.
|
|
32
32
|
* @param [options.cryptosuite] {string} - Cryptosuite override; when absent it
|
|
33
33
|
* is negotiated from the request's `acceptedCryptosuites`.
|
|
34
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI passed through to
|
|
35
|
-
* {@link composeVp} for embedded-grant term definitions.
|
|
36
34
|
* @returns {Promise<WalletResponse>} The response VP (and any granted zcaps), or
|
|
37
35
|
* `{}` when there is nothing to send.
|
|
38
36
|
*/
|
|
39
|
-
export declare function processRequest({ request, presentationSigner, selectedVCs, credentialRequestOrigin, processors, cryptosuite
|
|
37
|
+
export declare function processRequest({ request, presentationSigner, selectedVCs, credentialRequestOrigin, processors, cryptosuite }: {
|
|
40
38
|
request: IVPRDetails;
|
|
41
39
|
presentationSigner: PresentationSigner;
|
|
42
40
|
selectedVCs?: IVerifiableCredential[];
|
|
43
41
|
credentialRequestOrigin?: string;
|
|
44
42
|
processors?: RequestProcessors;
|
|
45
43
|
cryptosuite?: string;
|
|
46
|
-
vocabBaseIri?: string;
|
|
47
44
|
}): Promise<WalletResponse>;
|
|
48
45
|
//# sourceMappingURL=processRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processRequest.d.ts","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAoBA,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
|
|
1
|
+
{"version":3,"file":"processRequest.d.ts","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAoBA,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,CAkF1B"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* imported, so this layer carries no session / grant-resolution machinery. The
|
|
16
16
|
* signer and holder DID are injected as a {@link PresentationSigner}.
|
|
17
17
|
*/
|
|
18
|
-
import { classifyRequest, queriesOf } from './classify.js';
|
|
18
|
+
import { appConnectRequestOf, classifyRequest, queriesOf } from './classify.js';
|
|
19
19
|
import { composeVp } from './composeVp.js';
|
|
20
20
|
import { negotiateCryptosuite } from './presentationSuite.js';
|
|
21
21
|
/**
|
|
@@ -70,12 +70,10 @@ export function domainMatchesOrigin({ domain, origin }) {
|
|
|
70
70
|
* App Connect processors.
|
|
71
71
|
* @param [options.cryptosuite] {string} - Cryptosuite override; when absent it
|
|
72
72
|
* is negotiated from the request's `acceptedCryptosuites`.
|
|
73
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI passed through to
|
|
74
|
-
* {@link composeVp} for embedded-grant term definitions.
|
|
75
73
|
* @returns {Promise<WalletResponse>} The response VP (and any granted zcaps), or
|
|
76
74
|
* `{}` when there is nothing to send.
|
|
77
75
|
*/
|
|
78
|
-
export async function processRequest({ request, presentationSigner, selectedVCs = [], credentialRequestOrigin, processors, cryptosuite
|
|
76
|
+
export async function processRequest({ request, presentationSigner, selectedVCs = [], credentialRequestOrigin, processors, cryptosuite }) {
|
|
79
77
|
const { didAuth, zcapRequests } = classifyRequest(request);
|
|
80
78
|
const queries = queriesOf(request);
|
|
81
79
|
const { challenge, domain } = request;
|
|
@@ -90,11 +88,12 @@ export async function processRequest({ request, presentationSigner, selectedVCs
|
|
|
90
88
|
throw new Error(`DID Auth domain "${domain}" does not match request origin ` +
|
|
91
89
|
`"${credentialRequestOrigin}".`);
|
|
92
90
|
}
|
|
93
|
-
// An App Connect request
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
91
|
+
// An App Connect request takes its own single-round branch, handled by the
|
|
92
|
+
// injected processor. The requesting origin is what the app key is bound to
|
|
93
|
+
// (and what the query's `appUrl` is validated against), so it is required;
|
|
94
|
+
// the query itself is validated here (`appConnectRequestOf` throws on a
|
|
95
|
+
// malformed `app` block), so the processor only ever sees a well-formed
|
|
96
|
+
// request whose `appUrl` is already in serialized form.
|
|
98
97
|
const appConnectRequested = queries.some(query => query.type === 'AppConnectQuery');
|
|
99
98
|
if (appConnectRequested) {
|
|
100
99
|
if (!processors?.processAppConnect) {
|
|
@@ -104,8 +103,16 @@ export async function processRequest({ request, presentationSigner, selectedVCs
|
|
|
104
103
|
if (!credentialRequestOrigin) {
|
|
105
104
|
throw new Error('An App Connect request requires a requesting origin.');
|
|
106
105
|
}
|
|
106
|
+
const appConnect = appConnectRequestOf({
|
|
107
|
+
queries,
|
|
108
|
+
origin: credentialRequestOrigin
|
|
109
|
+
});
|
|
110
|
+
if (!appConnect) {
|
|
111
|
+
throw new Error('An AppConnectQuery could not be classified.');
|
|
112
|
+
}
|
|
107
113
|
return processors.processAppConnect({
|
|
108
114
|
request,
|
|
115
|
+
appConnect,
|
|
109
116
|
origin: credentialRequestOrigin,
|
|
110
117
|
challenge,
|
|
111
118
|
domain,
|
|
@@ -128,8 +135,7 @@ export async function processRequest({ request, presentationSigner, selectedVCs
|
|
|
128
135
|
domain,
|
|
129
136
|
didAuthRequested: didAuth,
|
|
130
137
|
cryptosuite: negotiatedCryptosuite,
|
|
131
|
-
zcaps
|
|
132
|
-
...(vocabBaseIri !== undefined && { vocabBaseIri })
|
|
138
|
+
zcaps
|
|
133
139
|
});
|
|
134
140
|
// Return the delegated capabilities alongside the VP so the caller can log
|
|
135
141
|
// exactly what was granted from these objects, rather than reading them back
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAU7D;;;GAGG;AACH,SAAS,MAAM,CAAC,KAAa;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC;YAChB,CAAC,CAAC,IAAI,GAAG,CAAC,WAAW,KAAK,EAAE,CAAC,CAAA;QAC/B,OAAO,GAAG,CAAC,IAAI,CAAA;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,8BAA8B,KAAK,IAAI,EAAE,GAAG,CAAC,CAAA;QAC1D,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EAIP;IACC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IACjC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IACjC,OAAO,C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ACzE,CAAC;QACD,MAAM,UAAU,GAAG,mBAAmB,CAAC;YACrC,OAAO;YACP,MAAM,EAAE,uBAAuB;SAChC,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAChE,CAAC;QACD,OAAO,UAAU,CAAC,iBAAiB,CAAC;YAClC,OAAO;YACP,UAAU;YACV,MAAM,EAAE,uBAAuB;YAC/B,SAAS;YACT,MAAM;YACN,gBAAgB,EAAE,OAAO;YACzB,WAAW,EAAE,qBAAqB;SACnC,CAAC,CAAA;IACJ,CAAC;IAED,uEAAuE;IACvE,MAAM,KAAK,GACT,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,EAAE,YAAY;QACjD,CAAC,CAAC,MAAM,UAAU,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;QACjD,CAAC,CAAC,EAAE,CAAA;IAER,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/D,mEAAmE;QACnE,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC;QAC7C,kBAAkB;QAClB,WAAW,EAAE,WAAW;QACxB,SAAS;QACT,MAAM;QACN,gBAAgB,EAAE,OAAO;QACzB,WAAW,EAAE,qBAAqB;QAClC,KAAK;KACN,CAAC,CAAA;IACF,2EAA2E;IAC3E,6EAA6E;IAC7E,uBAAuB;IACvB,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAA;AAC1C,CAAC"}
|
package/dist/request/types.d.ts
CHANGED
|
@@ -105,6 +105,46 @@ export interface WalletRequestProfile {
|
|
|
105
105
|
vcQueries: IQueryByExample[];
|
|
106
106
|
zcapRequests: ICapabilityQueryDetail[];
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* A capability request entry as an `AppConnectQuery` carries it: the standard
|
|
110
|
+
* capability-query detail minus the members the wallet itself fills or refuses
|
|
111
|
+
* (`controller` is filled with the app-key subject DID at delegation time;
|
|
112
|
+
* `reason` is display-bearing and not accepted from an App Connect request).
|
|
113
|
+
*/
|
|
114
|
+
export type IAppConnectCapabilityQuery = Omit<ICapabilityQueryDetail, 'controller' | 'reason'>;
|
|
115
|
+
/**
|
|
116
|
+
* The app identity an App Connect request presents: a display `name` for the
|
|
117
|
+
* consent surface (attacker-controlled free text, never evidence of identity)
|
|
118
|
+
* and the application's canonical `appUrl`, which scopes the app-key identity
|
|
119
|
+
* within the requesting origin. Validated by `appConnectRequestOf`: the
|
|
120
|
+
* `appUrl` must parse as an absolute URL, carry no fragment, and be
|
|
121
|
+
* same-origin with the attested requesting origin.
|
|
122
|
+
*/
|
|
123
|
+
export type IAppConnectApp = {
|
|
124
|
+
name: string;
|
|
125
|
+
appUrl: string;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* "Connect this app to the user's wallet and Space" -- a single-round request
|
|
129
|
+
* that combines app-key recovery-or-minting with capability delegation. The
|
|
130
|
+
* wallet finds (or self-issues) the app-key credential for the requesting
|
|
131
|
+
* origin and `appUrl`, delegates the requested capabilities to its subject
|
|
132
|
+
* DID, and returns credential + grants in one signed presentation.
|
|
133
|
+
*/
|
|
134
|
+
export type IAppConnectQuery = {
|
|
135
|
+
type: 'AppConnectQuery';
|
|
136
|
+
app: IAppConnectApp;
|
|
137
|
+
capabilityQuery?: IAppConnectCapabilityQuery | IAppConnectCapabilityQuery[];
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* An App Connect request as classified and validated by
|
|
141
|
+
* `appConnectRequestOf`: the app identity (its `appUrl` already in serialized
|
|
142
|
+
* form) plus its capability queries normalized to an array.
|
|
143
|
+
*/
|
|
144
|
+
export type IAppConnectRequest = {
|
|
145
|
+
app: IAppConnectApp;
|
|
146
|
+
capabilityQueries: IAppConnectCapabilityQuery[];
|
|
147
|
+
};
|
|
108
148
|
/**
|
|
109
149
|
* The authentication signer plus the DID to name as the VP `holder`. Each app
|
|
110
150
|
* resolves this from its own key material (DCW from the selected profile's
|
|
@@ -135,11 +175,14 @@ export interface RequestProcessors {
|
|
|
135
175
|
zcapRequests: ICapabilityQueryDetail[];
|
|
136
176
|
}) => Promise<IZcap[]>;
|
|
137
177
|
/**
|
|
138
|
-
* Handles the App Connect single-round branch
|
|
139
|
-
*
|
|
178
|
+
* Handles the App Connect single-round branch. Invoked when the request
|
|
179
|
+
* carries an `AppConnectQuery`; `appConnect` arrives already validated by
|
|
180
|
+
* `appConnectRequestOf` (its `app.appUrl` in serialized form), so the
|
|
181
|
+
* processor never sees a malformed app block.
|
|
140
182
|
*/
|
|
141
183
|
processAppConnect?: (args: {
|
|
142
184
|
request: IVPRDetails;
|
|
185
|
+
appConnect: IAppConnectRequest;
|
|
143
186
|
origin: string;
|
|
144
187
|
challenge?: string;
|
|
145
188
|
domain?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/request/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,EACN,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,cAAc,EACf,MAAM,kCAAkC,CAAA;AAMzC,YAAY,EACV,UAAU,EACV,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV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AE,WAAW,CAAA;IAC3C,sBAAsB,CAAC,EAAE,uBAAuB,CAAA;IAChD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,eAAe,EAAE,CAAA;IAC5B,YAAY,EAAE,sBAAsB,EAAE,CAAA;CACvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACpB,YAAY,EAAE,sBAAsB,EAAE,CAAA;KACvC,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IACtB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/request/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,EACN,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,cAAc,EACf,MAAM,kCAAkC,CAAA;AAMzC,YAAY,EACV,UAAU,EACV,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,sBAAsB,EACtB,iBAA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