@interop/wallet-core 0.68.0 → 0.70.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 +31 -41
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +12 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +9 -2
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +10 -0
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +14 -2
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +103 -57
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +254 -335
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +10 -5
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +19 -4
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +83 -35
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +3 -15
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +22 -3
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +13 -14
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.js +12 -12
- package/dist/clientAnnex/rosterDeliveredEpochs.js.map +1 -1
- package/dist/clients/grantState.d.ts +67 -0
- package/dist/clients/grantState.d.ts.map +1 -0
- package/dist/clients/grantState.js +72 -0
- package/dist/clients/grantState.js.map +1 -0
- package/dist/clients/index.d.ts +7 -0
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +6 -0
- package/dist/clients/index.js.map +1 -1
- package/dist/descriptors/index.d.ts +21 -46
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +21 -45
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +45 -56
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +64 -74
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/connectCode.d.ts +4 -3
- package/dist/enrollment/connectCode.d.ts.map +1 -1
- package/dist/enrollment/connectCode.js +4 -3
- package/dist/enrollment/connectCode.js.map +1 -1
- package/dist/enrollment/index.d.ts +2 -2
- package/dist/enrollment/index.js +2 -2
- package/dist/enrollment/onboardingInvite.d.ts +1 -1
- package/dist/enrollment/onboardingInvite.js +1 -1
- package/dist/enrollment/onboardingResponse.js +1 -1
- package/dist/genesis/accountGenesis.d.ts +13 -1
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +11 -2
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.js +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -8
- package/dist/index.js.map +1 -1
- package/dist/keyring/kdf.d.ts +33 -19
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +36 -25
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keys/collectionLogStore.d.ts +73 -0
- package/dist/keys/collectionLogStore.d.ts.map +1 -0
- package/dist/keys/collectionLogStore.js +60 -0
- package/dist/keys/collectionLogStore.js.map +1 -0
- package/dist/keys/index.d.ts +18 -6
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +18 -6
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +44 -6
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +51 -238
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +2 -1
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +67 -34
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +80 -30
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyCascade.d.ts +26 -1
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +29 -2
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +5 -0
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +5 -0
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts +54 -16
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +50 -22
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/recovery/continuation.d.ts +5 -4
- package/dist/recovery/continuation.d.ts.map +1 -1
- package/dist/recovery/continuation.js +14 -13
- package/dist/recovery/continuation.js.map +1 -1
- package/dist/resourceLog/controller.d.ts +18 -6
- package/dist/resourceLog/controller.d.ts.map +1 -1
- package/dist/resourceLog/controller.js +5 -3
- package/dist/resourceLog/controller.js.map +1 -1
- package/dist/resourceLog/document.d.ts +10 -2
- package/dist/resourceLog/document.d.ts.map +1 -1
- package/dist/resourceLog/document.js +1 -2
- package/dist/resourceLog/document.js.map +1 -1
- package/dist/resourceLog/errors.d.ts +17 -43
- package/dist/resourceLog/errors.d.ts.map +1 -1
- package/dist/resourceLog/errors.js +17 -50
- package/dist/resourceLog/errors.js.map +1 -1
- package/dist/resourceLog/index.d.ts +4 -1
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +4 -1
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/logClass.d.ts +69 -0
- package/dist/resourceLog/logClass.d.ts.map +1 -0
- package/dist/resourceLog/logClass.js +43 -0
- package/dist/resourceLog/logClass.js.map +1 -0
- package/dist/space/collections.d.ts +22 -2
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +18 -0
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +8 -5
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +8 -5
- package/dist/space/index.js.map +1 -1
- package/dist/space/provisioning.d.ts +16 -6
- package/dist/space/provisioning.d.ts.map +1 -1
- package/dist/space/provisioning.js +11 -7
- package/dist/space/provisioning.js.map +1 -1
- package/dist/space/wasLink.d.ts +13 -2
- package/dist/space/wasLink.d.ts.map +1 -1
- package/dist/space/wasLink.js +28 -2
- package/dist/space/wasLink.js.map +1 -1
- package/dist/sync/engine.d.ts +4 -2
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/index.d.ts +9 -6
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -5
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/push.d.ts +0 -29
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +30 -28
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/types.d.ts +39 -21
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +13 -7
- package/dist/sync/types.js.map +1 -1
- package/dist/unlock/index.d.ts +1 -1
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/retire.d.ts +8 -1
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +8 -1
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +81 -19
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +170 -30
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/webvh/did.d.ts +2 -4
- package/dist/webvh/did.d.ts.map +1 -1
- package/dist/webvh/did.js +2 -4
- package/dist/webvh/did.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +3 -2
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +2 -1
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +13 -7
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +14 -7
- package/dist/webvh/revokeClient.js.map +1 -1
- package/package.json +4 -19
- package/dist/descriptors/acquire.d.ts +0 -122
- package/dist/descriptors/acquire.d.ts.map +0 -1
- package/dist/descriptors/acquire.js +0 -100
- package/dist/descriptors/acquire.js.map +0 -1
- package/dist/descriptors/cipher.d.ts +0 -71
- package/dist/descriptors/cipher.d.ts.map +0 -1
- package/dist/descriptors/cipher.js +0 -109
- package/dist/descriptors/cipher.js.map +0 -1
- package/dist/descriptors/errors.d.ts +0 -44
- package/dist/descriptors/errors.d.ts.map +0 -1
- package/dist/descriptors/errors.js +0 -46
- package/dist/descriptors/errors.js.map +0 -1
- package/dist/descriptors/refresh.d.ts +0 -62
- package/dist/descriptors/refresh.d.ts.map +0 -1
- package/dist/descriptors/refresh.js +0 -69
- package/dist/descriptors/refresh.js.map +0 -1
- package/dist/request/appKey.d.ts +0 -295
- package/dist/request/appKey.d.ts.map +0 -1
- package/dist/request/appKey.js +0 -516
- package/dist/request/appKey.js.map +0 -1
- package/dist/request/capabilityRequest.d.ts +0 -41
- package/dist/request/capabilityRequest.d.ts.map +0 -1
- package/dist/request/capabilityRequest.js +0 -46
- package/dist/request/capabilityRequest.js.map +0 -1
- package/dist/request/classify.d.ts +0 -226
- package/dist/request/classify.d.ts.map +0 -1
- package/dist/request/classify.js +0 -416
- package/dist/request/classify.js.map +0 -1
- package/dist/request/composeVp.d.ts +0 -52
- package/dist/request/composeVp.d.ts.map +0 -1
- package/dist/request/composeVp.js +0 -176
- package/dist/request/composeVp.js.map +0 -1
- package/dist/request/ephemeralExchange.d.ts +0 -100
- package/dist/request/ephemeralExchange.d.ts.map +0 -1
- package/dist/request/ephemeralExchange.js +0 -230
- package/dist/request/ephemeralExchange.js.map +0 -1
- package/dist/request/exchangeClient.d.ts +0 -142
- package/dist/request/exchangeClient.d.ts.map +0 -1
- package/dist/request/exchangeClient.js +0 -241
- package/dist/request/exchangeClient.js.map +0 -1
- package/dist/request/index.d.ts +0 -59
- package/dist/request/index.d.ts.map +0 -1
- package/dist/request/index.js +0 -59
- package/dist/request/index.js.map +0 -1
- package/dist/request/interactionRequest.d.ts +0 -23
- package/dist/request/interactionRequest.d.ts.map +0 -1
- package/dist/request/interactionRequest.js +0 -46
- package/dist/request/interactionRequest.js.map +0 -1
- package/dist/request/interactionUrl.d.ts +0 -42
- package/dist/request/interactionUrl.d.ts.map +0 -1
- package/dist/request/interactionUrl.js +0 -104
- package/dist/request/interactionUrl.js.map +0 -1
- package/dist/request/matching.d.ts +0 -95
- package/dist/request/matching.d.ts.map +0 -1
- package/dist/request/matching.js +0 -205
- package/dist/request/matching.js.map +0 -1
- package/dist/request/onboarding.d.ts +0 -94
- package/dist/request/onboarding.d.ts.map +0 -1
- package/dist/request/onboarding.js +0 -167
- package/dist/request/onboarding.js.map +0 -1
- package/dist/request/parse.d.ts +0 -63
- package/dist/request/parse.d.ts.map +0 -1
- package/dist/request/parse.js +0 -153
- package/dist/request/parse.js.map +0 -1
- package/dist/request/presentationSuite.d.ts +0 -71
- package/dist/request/presentationSuite.d.ts.map +0 -1
- package/dist/request/presentationSuite.js +0 -143
- package/dist/request/presentationSuite.js.map +0 -1
- package/dist/request/processRequest.d.ts +0 -45
- package/dist/request/processRequest.d.ts.map +0 -1
- package/dist/request/processRequest.js +0 -147
- package/dist/request/processRequest.js.map +0 -1
- package/dist/request/queryPredicates.d.ts +0 -98
- package/dist/request/queryPredicates.d.ts.map +0 -1
- package/dist/request/queryPredicates.js +0 -107
- package/dist/request/queryPredicates.js.map +0 -1
- package/dist/request/types.d.ts +0 -257
- package/dist/request/types.d.ts.map +0 -1
- package/dist/request/types.js +0 -2
- package/dist/request/types.js.map +0 -1
- package/dist/request/walletInput.d.ts +0 -93
- package/dist/request/walletInput.d.ts.map +0 -1
- package/dist/request/walletInput.js +0 -179
- package/dist/request/walletInput.js.map +0 -1
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Classification of incoming VC API messages: turns a raw CHAPI event (or a QR
|
|
6
|
-
* / pasted payload) into a typed `IVPRequest` / `IVPOffer`, and provides the
|
|
7
|
-
* helpers used to dispatch on what was actually asked for (VC sharing, DID
|
|
8
|
-
* Authentication, capability delegation, or a combination).
|
|
9
|
-
*
|
|
10
|
-
* Ported from Freewallet's `src/lib/walletRequest/classify.ts` (the superset of
|
|
11
|
-
* DCW's `app/lib/exchanges.ts` / `walletRequestApi.ts` dispatch helpers). The
|
|
12
|
-
* shared classifier covers the three VPR-spec query types plus the App Connect
|
|
13
|
-
* `AppConnectQuery` extension (`appConnectRequestOf`), whose `app` block is
|
|
14
|
-
* validated here against the attested requesting origin.
|
|
15
|
-
*/
|
|
16
|
-
import type { CHAPIStoreEvent, IAppConnectRequest, ICapabilityQueryDetail, ICredentialQuery, IQueryByExample, IVPOffer, IVPRequest, IVPRDetails, IVPRQuery, IVerifiableCredential, IVerifiablePresentation, WalletRequestProfile } from './types.js';
|
|
17
|
-
import type { CHAPIGetEvent } from './types.js';
|
|
18
|
-
import { isZcapQuery } from './queryPredicates.js';
|
|
19
|
-
export { isZcapQuery };
|
|
20
|
-
/**
|
|
21
|
-
* The VC data model version a presentation carrying the given credentials must
|
|
22
|
-
* use, so its `@context` stays coherent with what it carries: `2.0` when any
|
|
23
|
-
* credential is a VC 2.0 one, else `1.0`. Shared by the bare-credential
|
|
24
|
-
* wrapping below and by the unsigned branch of `composeVp` (the signed branch
|
|
25
|
-
* takes its version from the negotiated cryptosuite instead).
|
|
26
|
-
*
|
|
27
|
-
* @param credentials {IVerifiableCredential[]}
|
|
28
|
-
* @returns {number}
|
|
29
|
-
*/
|
|
30
|
-
export declare function presentationVersionFor(credentials: IVerifiableCredential[]): number;
|
|
31
|
-
/**
|
|
32
|
-
* The Verifiable Credentials carried by a presentation, normalized to an array.
|
|
33
|
-
*
|
|
34
|
-
* @param presentation {IVerifiablePresentation}
|
|
35
|
-
* @returns {IVerifiableCredential[]}
|
|
36
|
-
*/
|
|
37
|
-
export declare function credentialsOf(presentation: IVerifiablePresentation): IVerifiableCredential[];
|
|
38
|
-
/**
|
|
39
|
-
* Wraps a CHAPI get event as an `IVPRequest`.
|
|
40
|
-
*
|
|
41
|
-
* @param event {CHAPIGetEvent}
|
|
42
|
-
* @returns {IVPRequest}
|
|
43
|
-
*/
|
|
44
|
-
export declare function classifyCHAPIGetEvent(event: CHAPIGetEvent): IVPRequest;
|
|
45
|
-
/**
|
|
46
|
-
* Wraps a CHAPI store event as an `IVPOffer`. A bare offered credential is
|
|
47
|
-
* wrapped in an unsigned presentation, so downstream code always sees a VP.
|
|
48
|
-
*
|
|
49
|
-
* @param event {CHAPIStoreEvent}
|
|
50
|
-
* @returns {IVPOffer}
|
|
51
|
-
*/
|
|
52
|
-
export declare function classifyCHAPIStoreEvent(event: CHAPIStoreEvent): IVPOffer;
|
|
53
|
-
/**
|
|
54
|
-
* Returns true if the query set contains a `DIDAuthentication` query. Throws if
|
|
55
|
-
* more than one is present -- a single DID-Auth proof answers the request.
|
|
56
|
-
*
|
|
57
|
-
* @param options {object}
|
|
58
|
-
* @param options.queries {IVPRQuery[]}
|
|
59
|
-
* @returns {boolean}
|
|
60
|
-
*/
|
|
61
|
-
export declare function isDIDAuthRequested({ queries }: {
|
|
62
|
-
queries: IVPRQuery[];
|
|
63
|
-
}): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Normalizes a VPR's `query` (which may be a single object or an array) to an
|
|
66
|
-
* array, dropping anything that is not a typed query object. A VPR body can
|
|
67
|
-
* legitimately carry no queries at all -- a CHAPI request that names a
|
|
68
|
-
* `protocols` exchange sends an empty body -- so callers get an empty array
|
|
69
|
-
* rather than an array holding `undefined`.
|
|
70
|
-
*
|
|
71
|
-
* @param request {IVPRDetails}
|
|
72
|
-
* @returns {IVPRQuery[]}
|
|
73
|
-
*/
|
|
74
|
-
export declare function queriesOf(request: IVPRDetails): IVPRQuery[];
|
|
75
|
-
/**
|
|
76
|
-
* Normalizes a `QueryByExample`'s `credentialQuery` (a single detail object or
|
|
77
|
-
* an array of them) to an array.
|
|
78
|
-
*
|
|
79
|
-
* @param query {IQueryByExample}
|
|
80
|
-
* @returns {ICredentialQuery[]}
|
|
81
|
-
*/
|
|
82
|
-
export declare function credentialQueriesOf(query: IQueryByExample): ICredentialQuery[];
|
|
83
|
-
/**
|
|
84
|
-
* Collects the requested capabilities from a query set: filters the two zcap
|
|
85
|
-
* query type strings (`AuthorizationCapabilityQuery` canonical, `ZcapQuery`
|
|
86
|
-
* legacy alias), normalizes each `capabilityQuery` (object or array) to an
|
|
87
|
-
* array, and flattens. A zcap query whose `capabilityQuery` is missing or not
|
|
88
|
-
* an object is malformed -- there is nothing to ask consent for -- so it throws
|
|
89
|
-
* rather than letting an `undefined` descriptor reach grant resolution;
|
|
90
|
-
* classification-time callers surface the throw as a malformed-request state.
|
|
91
|
-
*
|
|
92
|
-
* @param queries {IVPRQuery[]}
|
|
93
|
-
* @returns {ICapabilityQueryDetail[]}
|
|
94
|
-
*/
|
|
95
|
-
export declare function zcapQueriesOf(queries: IVPRQuery[]): ICapabilityQueryDetail[];
|
|
96
|
-
/**
|
|
97
|
-
* Validates an App Connect `app.appUrl` against the attested requesting origin
|
|
98
|
-
* and returns its serialized form. The value must parse as an absolute URL,
|
|
99
|
-
* must not carry a fragment, and its origin must equal the attested origin;
|
|
100
|
-
* any violation throws (the query is malformed). All storage and comparison
|
|
101
|
-
* downstream uses the returned serialization, so spellings differing only in
|
|
102
|
-
* a default port, percent-encoding case, or dot-segments do not name distinct
|
|
103
|
-
* applications.
|
|
104
|
-
*
|
|
105
|
-
* The fragment check reads the serialized URL rather than `url.hash`: a bare
|
|
106
|
-
* trailing `#` sets an empty (non-null) fragment that `hash` reports as `''`,
|
|
107
|
-
* and a percent-encoded `%23` never appears as `#` in the serialization.
|
|
108
|
-
*
|
|
109
|
-
* @param options {object}
|
|
110
|
-
* @param options.appUrl {string} - The request's `app.appUrl`.
|
|
111
|
-
* @param options.origin {string} - The attested requesting origin.
|
|
112
|
-
* @returns {string} The parsed URL's serialization.
|
|
113
|
-
*/
|
|
114
|
-
export declare function serializedAppUrl({ appUrl, origin }: {
|
|
115
|
-
appUrl: string;
|
|
116
|
-
origin: string;
|
|
117
|
-
}): string;
|
|
118
|
-
/**
|
|
119
|
-
* Extracts the App Connect request from a query set, when one is present. An
|
|
120
|
-
* `AppConnectQuery` is one mental model per popup: the request must not also
|
|
121
|
-
* carry `QueryByExample` or standalone zcap queries, at most one
|
|
122
|
-
* `AppConnectQuery` is allowed, and its `app` block must carry the display
|
|
123
|
-
* `name` and the `appUrl` the wallet needs to match or mint the app-key
|
|
124
|
-
* credential -- with the `appUrl` validated against the attested requesting
|
|
125
|
-
* origin and rewritten to its serialized form ({@link serializedAppUrl}).
|
|
126
|
-
* Violations throw; classification-time callers surface the throw as a
|
|
127
|
-
* malformed-request state. The capability queries are normalized to an array
|
|
128
|
-
* (absent means "no grants requested" -- a connect that only recovers the app
|
|
129
|
-
* key is legal), and each entry is rebuilt from an allowlist of the declared
|
|
130
|
-
* fields (`referenceId`, `allowedAction`, `invocationTarget`): the type-level
|
|
131
|
-
* Omit does not bind an actual request body, so any other wire-level field --
|
|
132
|
-
* a smuggled `reason`, an attacker-chosen `controller`, a future
|
|
133
|
-
* display-bearing addition -- is made unrepresentable here, before the entries
|
|
134
|
-
* reach the profile the consent screen and the delegation path read.
|
|
135
|
-
*
|
|
136
|
-
* @param options {object}
|
|
137
|
-
* @param options.queries {IVPRQuery[]}
|
|
138
|
-
* @param options.origin {string} - The attested requesting origin the
|
|
139
|
-
* `appUrl` is validated against.
|
|
140
|
-
* @returns {IAppConnectRequest | null}
|
|
141
|
-
*/
|
|
142
|
-
export declare function appConnectRequestOf({ queries, origin }: {
|
|
143
|
-
queries: IVPRQuery[];
|
|
144
|
-
origin: string;
|
|
145
|
-
}): IAppConnectRequest | null;
|
|
146
|
-
/**
|
|
147
|
-
* The longest self-declared agent name a request may carry, after trimming.
|
|
148
|
-
*/
|
|
149
|
-
export declare const AGENT_NAME_MAX_LENGTH = 64;
|
|
150
|
-
/**
|
|
151
|
-
* Normalizes a self-declared agent name to the form the consent surface and
|
|
152
|
-
* the Login activity carry: trimmed, 1 to {@link AGENT_NAME_MAX_LENGTH}
|
|
153
|
-
* characters, with no control characters (C0 or C1, line breaks included).
|
|
154
|
-
* Any Unicode letter is fine -- names are not ASCII-only -- but a name that
|
|
155
|
-
* could spoof layout or sneak past a one-line render is refused. Both the
|
|
156
|
-
* requester side (`composeCapabilityRequest`) and the wallet side
|
|
157
|
-
* (`requestingAgentOf`) run this, so a name the requester could compose is
|
|
158
|
-
* one the wallet accepts.
|
|
159
|
-
*
|
|
160
|
-
* @param options {object}
|
|
161
|
-
* @param options.name {unknown} the raw `agent.name` value
|
|
162
|
-
* @returns {string} the trimmed name
|
|
163
|
-
*/
|
|
164
|
-
export declare function normalizeAgentName({ name }: {
|
|
165
|
-
name: unknown;
|
|
166
|
-
}): string;
|
|
167
|
-
/**
|
|
168
|
-
* Reads the requester's self-declared identity off a VPR body, when present:
|
|
169
|
-
* the root `agent` member, whose `name` is validated and trimmed by
|
|
170
|
-
* {@link normalizeAgentName}. An absent member is fine (the wallet shows the
|
|
171
|
-
* grantee key alone); a present one that is not an object or whose name fails
|
|
172
|
-
* the limits is malformed and throws, so classification-time callers surface
|
|
173
|
-
* it as a malformed-request state rather than rendering an unbounded string.
|
|
174
|
-
*
|
|
175
|
-
* @param request {IVPRDetails}
|
|
176
|
-
* @returns {{ name: string } | undefined}
|
|
177
|
-
*/
|
|
178
|
-
export declare function requestingAgentOf(request: IVPRDetails): {
|
|
179
|
-
name: string;
|
|
180
|
-
} | undefined;
|
|
181
|
-
/**
|
|
182
|
-
* Classifies a VPR body onto the independent axes the consent screen and
|
|
183
|
-
* response assembly work from: whether DID Authentication is requested, and
|
|
184
|
-
* separately the credential (`QueryByExample`) and capability
|
|
185
|
-
* (`AuthorizationCapabilityQuery` / `ZcapQuery`) content asked for, plus the
|
|
186
|
-
* requester's self-declared `agent` name when the body carries one. Any
|
|
187
|
-
* combination is valid, including zcap-only.
|
|
188
|
-
*
|
|
189
|
-
* @param request {IVPRDetails}
|
|
190
|
-
* @returns {WalletRequestProfile}
|
|
191
|
-
*/
|
|
192
|
-
export declare function classifyRequest(request: IVPRDetails): WalletRequestProfile;
|
|
193
|
-
/**
|
|
194
|
-
* Whether a classified request is DID-Authentication *only*: it asks the wallet
|
|
195
|
-
* to prove control of its DID and nothing else (no credential queries, no
|
|
196
|
-
* capability requests). Derived from the profile so a popup's restore fast-path
|
|
197
|
-
* and its render both dispatch on the one predicate.
|
|
198
|
-
*
|
|
199
|
-
* @param profile {WalletRequestProfile}
|
|
200
|
-
* @returns {boolean}
|
|
201
|
-
*/
|
|
202
|
-
export declare function isDidAuthOnly(profile: WalletRequestProfile): boolean;
|
|
203
|
-
/**
|
|
204
|
-
* The DID methods a caller can present a holder for, by bare method name, as
|
|
205
|
-
* `acceptedMethods` states them (`key`, `web`, `webvh`). The default is the
|
|
206
|
-
* one every wallet holds: a session with no promoted account presents its
|
|
207
|
-
* did:key and nothing else.
|
|
208
|
-
*/
|
|
209
|
-
export declare const DEFAULT_PRESENTABLE_DID_METHODS: readonly ["key"];
|
|
210
|
-
/**
|
|
211
|
-
* Returns true if the caller can satisfy the DID method a `DIDAuthentication`
|
|
212
|
-
* query constrains to. `presentableMethods` names the bare DID method names
|
|
213
|
-
* this session can present a holder for; a request that omits
|
|
214
|
-
* `acceptedMethods` entirely, or lists it empty, imposes no constraint and is
|
|
215
|
-
* satisfiable whatever the session holds. A malformed `acceptedMethods` (not
|
|
216
|
-
* an array, or holding non-object entries) is read for the entries it does
|
|
217
|
-
* have rather than dereferenced blindly: an `acceptedMethods` that is not a
|
|
218
|
-
* list of constraints at all imposes none.
|
|
219
|
-
*
|
|
220
|
-
* @param queries {IVPRQuery[]}
|
|
221
|
-
* @param [presentableMethods] {readonly string[]} default
|
|
222
|
-
* {@link DEFAULT_PRESENTABLE_DID_METHODS}
|
|
223
|
-
* @returns {boolean}
|
|
224
|
-
*/
|
|
225
|
-
export declare function didAuthMethodSupported(queries: IVPRQuery[], presentableMethods?: readonly string[]): boolean;
|
|
226
|
-
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/request/classify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EACV,eAAe,EAGf,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAEhB,eAAe,EACf,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EAGL,WAAW,EAGZ,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,CAAA;AAmBtB;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,qBAAqB,EAAE,GACnC,MAAM,CAOR;AA0DD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,YAAY,EAAE,uBAAuB,GACpC,qBAAqB,EAAE,CAQzB;AAED;;;;;GAKG;AACH,wBAAg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AS9B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,oBAAoB,CAW1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAMpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,kBAAmB,CAAA;AAE/D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,EAAE,EACpB,kBAAkB,GAAE,SAAS,MAAM,EAAoC,GACtE,OAAO,CAWT"}
|
package/dist/request/classify.js
DELETED
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import { typeArray } from '@interop/data-integrity-core/guards';
|
|
2
|
-
import { isAppConnectQuery, isWalletOnboardingQuery, isZcapQuery, parsedAbsoluteUrl, singletonQueryOf } from './queryPredicates.js';
|
|
3
|
-
export { isZcapQuery };
|
|
4
|
-
const VC_1_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1';
|
|
5
|
-
const VC_2_CONTEXT_URL = 'https://www.w3.org/ns/credentials/v2';
|
|
6
|
-
/**
|
|
7
|
-
* Narrows an untrusted value to a string-keyed record, or `undefined` when it
|
|
8
|
-
* is not an object.
|
|
9
|
-
*
|
|
10
|
-
* @param value {unknown}
|
|
11
|
-
* @returns {Record<string, unknown> | undefined}
|
|
12
|
-
*/
|
|
13
|
-
function asRecord(value) {
|
|
14
|
-
if (!value || typeof value !== 'object') {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* The VC data model version a presentation carrying the given credentials must
|
|
21
|
-
* use, so its `@context` stays coherent with what it carries: `2.0` when any
|
|
22
|
-
* credential is a VC 2.0 one, else `1.0`. Shared by the bare-credential
|
|
23
|
-
* wrapping below and by the unsigned branch of `composeVp` (the signed branch
|
|
24
|
-
* takes its version from the negotiated cryptosuite instead).
|
|
25
|
-
*
|
|
26
|
-
* @param credentials {IVerifiableCredential[]}
|
|
27
|
-
* @returns {number}
|
|
28
|
-
*/
|
|
29
|
-
export function presentationVersionFor(credentials) {
|
|
30
|
-
const isV2 = credentials.some(credential => {
|
|
31
|
-
const contexts = credential?.['@context'];
|
|
32
|
-
const contextArray = Array.isArray(contexts) ? contexts : [contexts];
|
|
33
|
-
return contextArray.includes(VC_2_CONTEXT_URL);
|
|
34
|
-
});
|
|
35
|
-
return isV2 ? 2.0 : 1.0;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Wraps a bare Verifiable Credential in an unsigned Verifiable Presentation,
|
|
39
|
-
* matching the credential's VC data model version so the presentation's
|
|
40
|
-
* `@context` stays coherent with the credential it carries.
|
|
41
|
-
*
|
|
42
|
-
* @param credential {IVerifiableCredential}
|
|
43
|
-
* @returns {IVerifiablePresentation}
|
|
44
|
-
*/
|
|
45
|
-
function presentationWrapping(credential) {
|
|
46
|
-
const isV2 = presentationVersionFor([credential]) === 2.0;
|
|
47
|
-
return {
|
|
48
|
-
'@context': [isV2 ? VC_2_CONTEXT_URL : VC_1_CONTEXT_URL],
|
|
49
|
-
type: ['VerifiablePresentation'],
|
|
50
|
-
verifiableCredential: [credential]
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* The offered payload as a Verifiable Presentation: passed through when the
|
|
55
|
-
* issuer already offered one, and wrapped when it offered a bare Verifiable
|
|
56
|
-
* Credential. A `data` payload that is not an object at all is unrecognized,
|
|
57
|
-
* and reported with the same descriptive error as an unrecognized object.
|
|
58
|
-
*
|
|
59
|
-
* @param credential {CHAPIStoreEvent['credential']}
|
|
60
|
-
* @returns {IVerifiablePresentation}
|
|
61
|
-
*/
|
|
62
|
-
function offeredPresentation({ dataType, data }) {
|
|
63
|
-
const payload = asRecord(data);
|
|
64
|
-
const types = typeArray(payload?.type);
|
|
65
|
-
const isPresentation = !!payload &&
|
|
66
|
-
(dataType === 'VerifiablePresentation' ||
|
|
67
|
-
types.includes('VerifiablePresentation') ||
|
|
68
|
-
'verifiableCredential' in payload);
|
|
69
|
-
if (isPresentation) {
|
|
70
|
-
return data;
|
|
71
|
-
}
|
|
72
|
-
if (payload &&
|
|
73
|
-
(dataType === 'VerifiableCredential' ||
|
|
74
|
-
types.includes('VerifiableCredential'))) {
|
|
75
|
-
return presentationWrapping(data);
|
|
76
|
-
}
|
|
77
|
-
throw new Error(`CHAPI store event offered an unrecognized payload (dataType: ${dataType ?? 'undefined'}, type: ${JSON.stringify(types)}).`);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* The Verifiable Credentials carried by a presentation, normalized to an array.
|
|
81
|
-
*
|
|
82
|
-
* @param presentation {IVerifiablePresentation}
|
|
83
|
-
* @returns {IVerifiableCredential[]}
|
|
84
|
-
*/
|
|
85
|
-
export function credentialsOf(presentation) {
|
|
86
|
-
const { verifiableCredential } = presentation;
|
|
87
|
-
if (!verifiableCredential) {
|
|
88
|
-
return [];
|
|
89
|
-
}
|
|
90
|
-
return Array.isArray(verifiableCredential)
|
|
91
|
-
? verifiableCredential
|
|
92
|
-
: [verifiableCredential];
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Wraps a CHAPI get event as an `IVPRequest`.
|
|
96
|
-
*
|
|
97
|
-
* @param event {CHAPIGetEvent}
|
|
98
|
-
* @returns {IVPRequest}
|
|
99
|
-
*/
|
|
100
|
-
export function classifyCHAPIGetEvent(event) {
|
|
101
|
-
const verifiablePresentationRequest = event.credentialRequestOptions?.web?.VerifiablePresentation;
|
|
102
|
-
if (!verifiablePresentationRequest) {
|
|
103
|
-
throw new Error('CHAPI get event is missing a VerifiablePresentation request.');
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
verifiablePresentationRequest,
|
|
107
|
-
credentialRequestOrigin: event.credentialRequestOrigin
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Wraps a CHAPI store event as an `IVPOffer`. A bare offered credential is
|
|
112
|
-
* wrapped in an unsigned presentation, so downstream code always sees a VP.
|
|
113
|
-
*
|
|
114
|
-
* @param event {CHAPIStoreEvent}
|
|
115
|
-
* @returns {IVPOffer}
|
|
116
|
-
*/
|
|
117
|
-
export function classifyCHAPIStoreEvent(event) {
|
|
118
|
-
return {
|
|
119
|
-
verifiablePresentation: offeredPresentation(event.credential),
|
|
120
|
-
credentialRequestOrigin: event.credentialRequestOrigin
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Returns true if the query set contains a `DIDAuthentication` query. Throws if
|
|
125
|
-
* more than one is present -- a single DID-Auth proof answers the request.
|
|
126
|
-
*
|
|
127
|
-
* @param options {object}
|
|
128
|
-
* @param options.queries {IVPRQuery[]}
|
|
129
|
-
* @returns {boolean}
|
|
130
|
-
*/
|
|
131
|
-
export function isDIDAuthRequested({ queries }) {
|
|
132
|
-
const didAuthRequests = queries.filter(query => query.type === 'DIDAuthentication');
|
|
133
|
-
if (didAuthRequests.length > 1) {
|
|
134
|
-
throw new Error('More than one DIDAuthentication request found, exiting.');
|
|
135
|
-
}
|
|
136
|
-
return didAuthRequests.length === 1;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Normalizes a VPR's `query` (which may be a single object or an array) to an
|
|
140
|
-
* array, dropping anything that is not a typed query object. A VPR body can
|
|
141
|
-
* legitimately carry no queries at all -- a CHAPI request that names a
|
|
142
|
-
* `protocols` exchange sends an empty body -- so callers get an empty array
|
|
143
|
-
* rather than an array holding `undefined`.
|
|
144
|
-
*
|
|
145
|
-
* @param request {IVPRDetails}
|
|
146
|
-
* @returns {IVPRQuery[]}
|
|
147
|
-
*/
|
|
148
|
-
export function queriesOf(request) {
|
|
149
|
-
const { query } = request;
|
|
150
|
-
const queries = Array.isArray(query) ? query : [query];
|
|
151
|
-
return queries.filter((entry) => !!entry &&
|
|
152
|
-
typeof entry === 'object' &&
|
|
153
|
-
typeof entry.type === 'string');
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Normalizes a `QueryByExample`'s `credentialQuery` (a single detail object or
|
|
157
|
-
* an array of them) to an array.
|
|
158
|
-
*
|
|
159
|
-
* @param query {IQueryByExample}
|
|
160
|
-
* @returns {ICredentialQuery[]}
|
|
161
|
-
*/
|
|
162
|
-
export function credentialQueriesOf(query) {
|
|
163
|
-
const { credentialQuery } = query;
|
|
164
|
-
if (!credentialQuery) {
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
return Array.isArray(credentialQuery) ? credentialQuery : [credentialQuery];
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Collects the requested capabilities from a query set: filters the two zcap
|
|
171
|
-
* query type strings (`AuthorizationCapabilityQuery` canonical, `ZcapQuery`
|
|
172
|
-
* legacy alias), normalizes each `capabilityQuery` (object or array) to an
|
|
173
|
-
* array, and flattens. A zcap query whose `capabilityQuery` is missing or not
|
|
174
|
-
* an object is malformed -- there is nothing to ask consent for -- so it throws
|
|
175
|
-
* rather than letting an `undefined` descriptor reach grant resolution;
|
|
176
|
-
* classification-time callers surface the throw as a malformed-request state.
|
|
177
|
-
*
|
|
178
|
-
* @param queries {IVPRQuery[]}
|
|
179
|
-
* @returns {ICapabilityQueryDetail[]}
|
|
180
|
-
*/
|
|
181
|
-
export function zcapQueriesOf(queries) {
|
|
182
|
-
return queries.filter(isZcapQuery).flatMap(({ type, capabilityQuery }) => {
|
|
183
|
-
const detailEntries = Array.isArray(capabilityQuery)
|
|
184
|
-
? capabilityQuery
|
|
185
|
-
: [capabilityQuery];
|
|
186
|
-
for (const detail of detailEntries) {
|
|
187
|
-
if (!detail || typeof detail !== 'object') {
|
|
188
|
-
throw new Error(`A "${type}" query is missing its capabilityQuery detail.`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return detailEntries;
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Validates an App Connect `app.appUrl` against the attested requesting origin
|
|
196
|
-
* and returns its serialized form. The value must parse as an absolute URL,
|
|
197
|
-
* must not carry a fragment, and its origin must equal the attested origin;
|
|
198
|
-
* any violation throws (the query is malformed). All storage and comparison
|
|
199
|
-
* downstream uses the returned serialization, so spellings differing only in
|
|
200
|
-
* a default port, percent-encoding case, or dot-segments do not name distinct
|
|
201
|
-
* applications.
|
|
202
|
-
*
|
|
203
|
-
* The fragment check reads the serialized URL rather than `url.hash`: a bare
|
|
204
|
-
* trailing `#` sets an empty (non-null) fragment that `hash` reports as `''`,
|
|
205
|
-
* and a percent-encoded `%23` never appears as `#` in the serialization.
|
|
206
|
-
*
|
|
207
|
-
* @param options {object}
|
|
208
|
-
* @param options.appUrl {string} - The request's `app.appUrl`.
|
|
209
|
-
* @param options.origin {string} - The attested requesting origin.
|
|
210
|
-
* @returns {string} The parsed URL's serialization.
|
|
211
|
-
*/
|
|
212
|
-
export function serializedAppUrl({ appUrl, origin }) {
|
|
213
|
-
const url = parsedAbsoluteUrl({
|
|
214
|
-
value: appUrl,
|
|
215
|
-
notAbsoluteMessage: `An AppConnectQuery "appUrl" must be an absolute URL (got "${appUrl}").`,
|
|
216
|
-
fragmentMessage: `An AppConnectQuery "appUrl" must not carry a fragment (got "${appUrl}").`
|
|
217
|
-
});
|
|
218
|
-
let attestedOrigin;
|
|
219
|
-
try {
|
|
220
|
-
attestedOrigin = new URL(origin).origin;
|
|
221
|
-
}
|
|
222
|
-
catch {
|
|
223
|
-
attestedOrigin = origin;
|
|
224
|
-
}
|
|
225
|
-
if (url.origin !== attestedOrigin) {
|
|
226
|
-
throw new Error(`An AppConnectQuery "appUrl" must be same-origin with the requesting ` +
|
|
227
|
-
`origin "${origin}" (got "${appUrl}").`);
|
|
228
|
-
}
|
|
229
|
-
return url.href;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Extracts the App Connect request from a query set, when one is present. An
|
|
233
|
-
* `AppConnectQuery` is one mental model per popup: the request must not also
|
|
234
|
-
* carry `QueryByExample` or standalone zcap queries, at most one
|
|
235
|
-
* `AppConnectQuery` is allowed, and its `app` block must carry the display
|
|
236
|
-
* `name` and the `appUrl` the wallet needs to match or mint the app-key
|
|
237
|
-
* credential -- with the `appUrl` validated against the attested requesting
|
|
238
|
-
* origin and rewritten to its serialized form ({@link serializedAppUrl}).
|
|
239
|
-
* Violations throw; classification-time callers surface the throw as a
|
|
240
|
-
* malformed-request state. The capability queries are normalized to an array
|
|
241
|
-
* (absent means "no grants requested" -- a connect that only recovers the app
|
|
242
|
-
* key is legal), and each entry is rebuilt from an allowlist of the declared
|
|
243
|
-
* fields (`referenceId`, `allowedAction`, `invocationTarget`): the type-level
|
|
244
|
-
* Omit does not bind an actual request body, so any other wire-level field --
|
|
245
|
-
* a smuggled `reason`, an attacker-chosen `controller`, a future
|
|
246
|
-
* display-bearing addition -- is made unrepresentable here, before the entries
|
|
247
|
-
* reach the profile the consent screen and the delegation path read.
|
|
248
|
-
*
|
|
249
|
-
* @param options {object}
|
|
250
|
-
* @param options.queries {IVPRQuery[]}
|
|
251
|
-
* @param options.origin {string} - The attested requesting origin the
|
|
252
|
-
* `appUrl` is validated against.
|
|
253
|
-
* @returns {IAppConnectRequest | null}
|
|
254
|
-
*/
|
|
255
|
-
export function appConnectRequestOf({ queries, origin }) {
|
|
256
|
-
const appConnectQuery = singletonQueryOf({
|
|
257
|
-
queries,
|
|
258
|
-
isSingleton: isAppConnectQuery,
|
|
259
|
-
isExcluded: query => query.type === 'QueryByExample' ||
|
|
260
|
-
isZcapQuery(query) ||
|
|
261
|
-
isWalletOnboardingQuery(query),
|
|
262
|
-
typeName: 'AppConnectQuery',
|
|
263
|
-
mixedMessage: 'An AppConnectQuery cannot be combined with QueryByExample, ' +
|
|
264
|
-
'standalone capability queries, or a WalletOnboardingQuery.'
|
|
265
|
-
});
|
|
266
|
-
if (appConnectQuery === null) {
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
const { app, capabilityQuery } = appConnectQuery;
|
|
270
|
-
if (!app || typeof app.name !== 'string' || typeof app.appUrl !== 'string') {
|
|
271
|
-
throw new Error('An AppConnectQuery is missing its app name / appUrl.');
|
|
272
|
-
}
|
|
273
|
-
const appUrl = serializedAppUrl({ appUrl: app.appUrl, origin });
|
|
274
|
-
const rawQueries = capabilityQuery === undefined
|
|
275
|
-
? []
|
|
276
|
-
: Array.isArray(capabilityQuery)
|
|
277
|
-
? capabilityQuery
|
|
278
|
-
: [capabilityQuery];
|
|
279
|
-
const capabilityQueries = rawQueries.map(detail => {
|
|
280
|
-
if (!detail || typeof detail !== 'object') {
|
|
281
|
-
throw new Error('An AppConnectQuery carries a malformed capabilityQuery entry.');
|
|
282
|
-
}
|
|
283
|
-
const { referenceId, allowedAction, invocationTarget } = detail;
|
|
284
|
-
return {
|
|
285
|
-
...(referenceId !== undefined && { referenceId }),
|
|
286
|
-
...(allowedAction !== undefined && { allowedAction }),
|
|
287
|
-
invocationTarget
|
|
288
|
-
};
|
|
289
|
-
});
|
|
290
|
-
return { app: { name: app.name, appUrl }, capabilityQueries };
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* The longest self-declared agent name a request may carry, after trimming.
|
|
294
|
-
*/
|
|
295
|
-
export const AGENT_NAME_MAX_LENGTH = 64;
|
|
296
|
-
/**
|
|
297
|
-
* Normalizes a self-declared agent name to the form the consent surface and
|
|
298
|
-
* the Login activity carry: trimmed, 1 to {@link AGENT_NAME_MAX_LENGTH}
|
|
299
|
-
* characters, with no control characters (C0 or C1, line breaks included).
|
|
300
|
-
* Any Unicode letter is fine -- names are not ASCII-only -- but a name that
|
|
301
|
-
* could spoof layout or sneak past a one-line render is refused. Both the
|
|
302
|
-
* requester side (`composeCapabilityRequest`) and the wallet side
|
|
303
|
-
* (`requestingAgentOf`) run this, so a name the requester could compose is
|
|
304
|
-
* one the wallet accepts.
|
|
305
|
-
*
|
|
306
|
-
* @param options {object}
|
|
307
|
-
* @param options.name {unknown} the raw `agent.name` value
|
|
308
|
-
* @returns {string} the trimmed name
|
|
309
|
-
*/
|
|
310
|
-
export function normalizeAgentName({ name }) {
|
|
311
|
-
if (typeof name !== 'string') {
|
|
312
|
-
throw new Error('A request\'s "agent.name" must be a string.');
|
|
313
|
-
}
|
|
314
|
-
const trimmed = name.trim();
|
|
315
|
-
if (trimmed.length === 0) {
|
|
316
|
-
throw new Error('A request\'s "agent.name" must not be empty.');
|
|
317
|
-
}
|
|
318
|
-
if (trimmed.length > AGENT_NAME_MAX_LENGTH) {
|
|
319
|
-
throw new Error(`A request's "agent.name" must be at most ${AGENT_NAME_MAX_LENGTH} ` +
|
|
320
|
-
`characters (got ${trimmed.length}).`);
|
|
321
|
-
}
|
|
322
|
-
if (/\p{Cc}/u.test(trimmed)) {
|
|
323
|
-
throw new Error('A request\'s "agent.name" must not contain control characters.');
|
|
324
|
-
}
|
|
325
|
-
return trimmed;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Reads the requester's self-declared identity off a VPR body, when present:
|
|
329
|
-
* the root `agent` member, whose `name` is validated and trimmed by
|
|
330
|
-
* {@link normalizeAgentName}. An absent member is fine (the wallet shows the
|
|
331
|
-
* grantee key alone); a present one that is not an object or whose name fails
|
|
332
|
-
* the limits is malformed and throws, so classification-time callers surface
|
|
333
|
-
* it as a malformed-request state rather than rendering an unbounded string.
|
|
334
|
-
*
|
|
335
|
-
* @param request {IVPRDetails}
|
|
336
|
-
* @returns {{ name: string } | undefined}
|
|
337
|
-
*/
|
|
338
|
-
export function requestingAgentOf(request) {
|
|
339
|
-
const { agent } = request;
|
|
340
|
-
if (agent === undefined) {
|
|
341
|
-
return undefined;
|
|
342
|
-
}
|
|
343
|
-
if (!agent || typeof agent !== 'object' || Array.isArray(agent)) {
|
|
344
|
-
throw new Error('A request\'s "agent" member must be an object.');
|
|
345
|
-
}
|
|
346
|
-
return { name: normalizeAgentName({ name: agent.name }) };
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Classifies a VPR body onto the independent axes the consent screen and
|
|
350
|
-
* response assembly work from: whether DID Authentication is requested, and
|
|
351
|
-
* separately the credential (`QueryByExample`) and capability
|
|
352
|
-
* (`AuthorizationCapabilityQuery` / `ZcapQuery`) content asked for, plus the
|
|
353
|
-
* requester's self-declared `agent` name when the body carries one. Any
|
|
354
|
-
* combination is valid, including zcap-only.
|
|
355
|
-
*
|
|
356
|
-
* @param request {IVPRDetails}
|
|
357
|
-
* @returns {WalletRequestProfile}
|
|
358
|
-
*/
|
|
359
|
-
export function classifyRequest(request) {
|
|
360
|
-
const queries = queriesOf(request);
|
|
361
|
-
const agent = requestingAgentOf(request);
|
|
362
|
-
return {
|
|
363
|
-
didAuth: isDIDAuthRequested({ queries }),
|
|
364
|
-
vcQueries: queries.filter((query) => query.type === 'QueryByExample'),
|
|
365
|
-
zcapRequests: zcapQueriesOf(queries),
|
|
366
|
-
...(agent !== undefined && { agent })
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Whether a classified request is DID-Authentication *only*: it asks the wallet
|
|
371
|
-
* to prove control of its DID and nothing else (no credential queries, no
|
|
372
|
-
* capability requests). Derived from the profile so a popup's restore fast-path
|
|
373
|
-
* and its render both dispatch on the one predicate.
|
|
374
|
-
*
|
|
375
|
-
* @param profile {WalletRequestProfile}
|
|
376
|
-
* @returns {boolean}
|
|
377
|
-
*/
|
|
378
|
-
export function isDidAuthOnly(profile) {
|
|
379
|
-
return (profile.didAuth &&
|
|
380
|
-
profile.vcQueries.length === 0 &&
|
|
381
|
-
profile.zcapRequests.length === 0);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* The DID methods a caller can present a holder for, by bare method name, as
|
|
385
|
-
* `acceptedMethods` states them (`key`, `web`, `webvh`). The default is the
|
|
386
|
-
* one every wallet holds: a session with no promoted account presents its
|
|
387
|
-
* did:key and nothing else.
|
|
388
|
-
*/
|
|
389
|
-
export const DEFAULT_PRESENTABLE_DID_METHODS = ['key'];
|
|
390
|
-
/**
|
|
391
|
-
* Returns true if the caller can satisfy the DID method a `DIDAuthentication`
|
|
392
|
-
* query constrains to. `presentableMethods` names the bare DID method names
|
|
393
|
-
* this session can present a holder for; a request that omits
|
|
394
|
-
* `acceptedMethods` entirely, or lists it empty, imposes no constraint and is
|
|
395
|
-
* satisfiable whatever the session holds. A malformed `acceptedMethods` (not
|
|
396
|
-
* an array, or holding non-object entries) is read for the entries it does
|
|
397
|
-
* have rather than dereferenced blindly: an `acceptedMethods` that is not a
|
|
398
|
-
* list of constraints at all imposes none.
|
|
399
|
-
*
|
|
400
|
-
* @param queries {IVPRQuery[]}
|
|
401
|
-
* @param [presentableMethods] {readonly string[]} default
|
|
402
|
-
* {@link DEFAULT_PRESENTABLE_DID_METHODS}
|
|
403
|
-
* @returns {boolean}
|
|
404
|
-
*/
|
|
405
|
-
export function didAuthMethodSupported(queries, presentableMethods = DEFAULT_PRESENTABLE_DID_METHODS) {
|
|
406
|
-
const didAuth = queries.find(query => query.type === 'DIDAuthentication');
|
|
407
|
-
const acceptedMethods = didAuth?.acceptedMethods;
|
|
408
|
-
if (!Array.isArray(acceptedMethods) || acceptedMethods.length === 0) {
|
|
409
|
-
return true;
|
|
410
|
-
}
|
|
411
|
-
return acceptedMethods.some(entry => {
|
|
412
|
-
const method = asRecord(entry)?.method;
|
|
413
|
-
return typeof method === 'string' && presentableMethods.includes(method);
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
//# sourceMappingURL=classify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/request/classify.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,CAAA;AAEtB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