@interop/was-react 0.11.1 → 0.13.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 +23 -25
- package/dist/auth/loginFlow.d.ts +8 -5
- package/dist/auth/loginFlow.d.ts.map +1 -1
- package/dist/auth/loginFlow.js +46 -16
- package/dist/auth/loginFlow.js.map +1 -1
- package/dist/auth/loginRequest.d.ts +27 -81
- package/dist/auth/loginRequest.d.ts.map +1 -1
- package/dist/auth/loginRequest.js +94 -41
- package/dist/auth/loginRequest.js.map +1 -1
- package/dist/auth/verifyResponse.d.ts +3 -3
- package/dist/auth/verifyResponse.d.ts.map +1 -1
- package/dist/auth/verifyResponse.js +16 -13
- package/dist/auth/verifyResponse.js.map +1 -1
- package/dist/auth/walletRequestTypes.d.ts +8 -6
- package/dist/auth/walletRequestTypes.d.ts.map +1 -1
- package/dist/config.d.ts +19 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -0
- package/dist/config.js.map +1 -1
- package/dist/dev/provisionDevGrants.d.ts.map +1 -1
- package/dist/dev/provisionDevGrants.js +7 -12
- package/dist/dev/provisionDevGrants.js.map +1 -1
- package/dist/grants.d.ts +0 -14
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js +0 -13
- package/dist/grants.js.map +1 -1
- package/dist/identity/seedCredential.d.ts +39 -38
- package/dist/identity/seedCredential.d.ts.map +1 -1
- package/dist/identity/seedCredential.js +79 -77
- package/dist/identity/seedCredential.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/react/documentApp.d.ts +6 -6
- package/dist/react/documentApp.d.ts.map +1 -1
- package/dist/react/documentApp.js +7 -6
- package/dist/react/documentApp.js.map +1 -1
- package/dist/react/hooks.d.ts +1 -1
- package/dist/react/hooks.js +1 -1
- package/dist/session/authStore.d.ts +1 -1
- package/dist/session/authStore.js +6 -6
- package/dist/session/authStore.js.map +1 -1
- package/dist/storage/adopt.d.ts +3 -3
- package/dist/storage/adopt.js +5 -5
- package/dist/storage/entityStore.d.ts +1 -1
- package/dist/storage/localStore.d.ts +2 -2
- package/dist/storage/localStore.js +2 -2
- package/dist/storage/storageManager.d.ts +8 -3
- package/dist/storage/storageManager.d.ts.map +1 -1
- package/dist/storage/storageManager.js +19 -12
- package/dist/storage/storageManager.js.map +1 -1
- package/dist/storage/wasRemoteStore.d.ts +1 -1
- package/dist/storage/wasRemoteStore.d.ts.map +1 -1
- package/dist/storage/wasRemoteStore.js +8 -8
- package/dist/storage/wasRemoteStore.js.map +1 -1
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +2 -2
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/lww.d.ts +4 -4
- package/dist/sync/lww.js +7 -7
- package/dist/sync/lwwConflictHandler.d.ts +4 -4
- package/dist/sync/lwwConflictHandler.js +1 -1
- package/dist/sync/types.d.ts +28 -45
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +17 -35
- package/dist/sync/types.js.map +1 -1
- package/dist/sync/wasSyncPort.d.ts +14 -31
- package/dist/sync/wasSyncPort.d.ts.map +1 -1
- package/dist/sync/wasSyncPort.js +27 -169
- package/dist/sync/wasSyncPort.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,18 +1,64 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* RP-side VPR construction for Login With Wallet: the one-popup App Connect
|
|
6
|
+
* request.
|
|
7
|
+
*
|
|
8
|
+
* A single CHAPI `get` carries DIDAuthentication plus an `AppConnectQuery` that
|
|
9
|
+
* names the app (its display name for the wallet's consent screen and the
|
|
10
|
+
* canonical `appUrl` the wallet needs to MATCH an existing app key or MINT a
|
|
11
|
+
* fresh one), and one collection-scoped capabilityQuery per requested
|
|
12
|
+
* collection. The wallet responds -- in the same round -- with the app-key
|
|
13
|
+
* credential and the delegated zcaps embedded in the response VP, so first-run
|
|
14
|
+
* and returning are a single request/response with no store popup and no
|
|
15
|
+
* separate grants popup.
|
|
16
|
+
*
|
|
17
|
+
* Only collection-scoped capabilities are requested (no whole-space grant),
|
|
18
|
+
* and each request stays within the ALLOWED ACTIONS of the descriptor class it
|
|
19
|
+
* uses (the App Connect spec's "Allowed actions" table): both collection
|
|
20
|
+
* classes -- private and public -- allow the full action vocabulary
|
|
21
|
+
* ({@link RW_ACTIONS}), since a published collection is still the app's own
|
|
22
|
+
* data and un-publishing and revision are data management like any other
|
|
23
|
+
* write. A share is read-only ({@link SHARED_ACTIONS}). A configured action set
|
|
24
|
+
* naming an action above a requested collection's allowed set is a
|
|
25
|
+
* configuration error thrown here, at build time -- a conformant wallet can
|
|
26
|
+
* never grant it, so letting it ride would surface later as a failed login
|
|
27
|
+
* instead.
|
|
28
|
+
*
|
|
29
|
+
* A `visibility: 'public'` collection is requested with the distinct descriptor
|
|
30
|
+
* type `https://w3id.org/byoe#public-collection` (the wallet provisions it plaintext with a
|
|
31
|
+
* collection-level public-read policy and renders a world-readable consent
|
|
32
|
+
* warning); wallets that predate the type render it UNSATISFIABLE, which is the
|
|
33
|
+
* intended fail-closed behavior -- an older wallet must not silently provision a
|
|
34
|
+
* private collection the app believes is public. The App Connect query as a
|
|
35
|
+
* whole is likewise unsatisfiable on a wallet that predates it, so an old wallet
|
|
36
|
+
* fails closed rather than degrading into a partial generic flow.
|
|
37
|
+
*
|
|
38
|
+
* A SHARED collection -- one the wallet already owns and encrypts, which the app
|
|
39
|
+
* asks to read and decrypt -- uses the
|
|
40
|
+
* `https://w3id.org/byoe#shared-wallet-collection` descriptor type, and the
|
|
41
|
+
* actions are read-only by construction ({@link SHARED_ACTIONS}):
|
|
42
|
+
* the app never requests writes on a wallet collection. Exactly like
|
|
43
|
+
* `https://w3id.org/byoe#public-collection`, a wallet that predates the type resolves the
|
|
44
|
+
* descriptor UNSATISFIABLE and fails closed -- which is the point here. A share
|
|
45
|
+
* fuses two axes (a read zcap AND an entry in the collection's key-epoch
|
|
46
|
+
* roster), so a wallet that granted only the zcap would hand the app ciphertext
|
|
47
|
+
* it cannot decrypt; that would surface as corrupt data rather than as a wallet
|
|
48
|
+
* that needs updating.
|
|
49
|
+
*
|
|
50
|
+
* `domain` must host-match the CHAPI requesting origin or the wallet refuses
|
|
51
|
+
* to sign; `challenge` must be fresh per request (echoed into the DIDAuth
|
|
52
|
+
* proof and checked in verifyResponse).
|
|
5
53
|
*/
|
|
6
|
-
|
|
54
|
+
import { serializedAppUrl } from '@interop/wallet-core/request';
|
|
7
55
|
/**
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
10
|
-
* collection
|
|
11
|
-
*
|
|
12
|
-
* asked -- and the App Connect spec forbids an application from requiring an
|
|
13
|
-
* action above it.
|
|
56
|
+
* The full WAS action vocabulary, in the order of the App Connect spec's
|
|
57
|
+
* "Allowed actions" table -- also the allowed-action set of BOTH collection
|
|
58
|
+
* classes, `https://w3id.org/byoe#private-collection` and
|
|
59
|
+
* `https://w3id.org/byoe#public-collection`.
|
|
14
60
|
*/
|
|
15
|
-
export const
|
|
61
|
+
export const RW_ACTIONS = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE'];
|
|
16
62
|
/**
|
|
17
63
|
* The actions requested on a SHARED (wallet-owned) collection: read-only, and
|
|
18
64
|
* not configurable. A shared collection belongs to the wallet, so an app never
|
|
@@ -20,18 +66,21 @@ export const PUBLIC_ACTIONS = ['GET', 'HEAD', 'POST'];
|
|
|
20
66
|
*/
|
|
21
67
|
export const SHARED_ACTIONS = ['GET', 'HEAD'];
|
|
22
68
|
/**
|
|
23
|
-
* The
|
|
24
|
-
* (the App Connect spec's "
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
69
|
+
* The allowed actions of the descriptor class a collection is requested with
|
|
70
|
+
* (the App Connect spec's "Allowed actions" table). Both collection classes --
|
|
71
|
+
* public and private -- allow the full action vocabulary: published content is
|
|
72
|
+
* still the application's own data, and un-publishing and revision are data
|
|
73
|
+
* management like any other write, so an app may `PUT` or `DELETE` what it
|
|
74
|
+
* published. Shares have their own fixed {@link SHARED_ACTIONS} and never
|
|
75
|
+
* consult a configured action set.
|
|
29
76
|
*
|
|
30
|
-
* @param [
|
|
77
|
+
* @param [_visibility] {'private' | 'public'}
|
|
31
78
|
* @returns {string[]}
|
|
32
79
|
*/
|
|
33
|
-
export function actionCeiling(
|
|
34
|
-
|
|
80
|
+
export function actionCeiling(_visibility) {
|
|
81
|
+
// Both classes currently allow the full vocabulary; the parameter stays so a
|
|
82
|
+
// future class that DOES bound actions has one place to bound them.
|
|
83
|
+
return RW_ACTIONS;
|
|
35
84
|
}
|
|
36
85
|
/**
|
|
37
86
|
* A fresh nonce for a VPR challenge.
|
|
@@ -41,13 +90,14 @@ export function newChallenge() {
|
|
|
41
90
|
}
|
|
42
91
|
/**
|
|
43
92
|
* The actions to request for one collection: the configured set capped at the
|
|
44
|
-
* collection's
|
|
45
|
-
* the whole
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
93
|
+
* collection class's allowed actions, kept in table order. When no set is
|
|
94
|
+
* configured the whole allowed set is requested; a narrower subset stays legal
|
|
95
|
+
* and is passed through as asked. An EXPLICIT set naming an action OUTSIDE the
|
|
96
|
+
* class's allowed actions is a configuration error thrown here, at request
|
|
97
|
+
* build time: a conformant wallet can never grant it, so silently capping
|
|
98
|
+
* would leave the app believing it asked for more than any correct wallet
|
|
99
|
+
* returns, and the mismatch would surface later as a failed login instead of
|
|
100
|
+
* as the config bug it is.
|
|
51
101
|
*
|
|
52
102
|
* @param options {object}
|
|
53
103
|
* @param options.id {string} the WAS collection id (for error messages)
|
|
@@ -62,8 +112,9 @@ function requestedActions({ id, visibility, actions }) {
|
|
|
62
112
|
}
|
|
63
113
|
const excess = actions.filter(action => !ceiling.includes(action));
|
|
64
114
|
if (excess.length > 0) {
|
|
65
|
-
throw new Error(`Collection "${id}" cannot request action(s)
|
|
66
|
-
|
|
115
|
+
throw new Error(`Collection "${id}" cannot request action(s) outside its class's ` +
|
|
116
|
+
`allowed actions: ${excess.join(', ')} (the allowed actions are ` +
|
|
117
|
+
`${ceiling.join(', ')}).`);
|
|
67
118
|
}
|
|
68
119
|
const capped = ceiling.filter(action => actions.includes(action));
|
|
69
120
|
if (capped.length === 0) {
|
|
@@ -76,9 +127,12 @@ function requestedActions({ id, visibility, actions }) {
|
|
|
76
127
|
/**
|
|
77
128
|
* The one-popup App Connect VPR: DIDAuthentication + a single `AppConnectQuery`.
|
|
78
129
|
*
|
|
79
|
-
* The `app` block names the app
|
|
80
|
-
* the
|
|
81
|
-
*
|
|
130
|
+
* The `app` block names the app -- `name` for the wallet's consent screen, and
|
|
131
|
+
* `appUrl`, the application's canonical URL, which the wallet needs to MATCH an
|
|
132
|
+
* existing app key or MINT a fresh one. The `appUrl` is validated and
|
|
133
|
+
* serialized here against `domain` (this app's own live browser origin): it
|
|
134
|
+
* must be an absolute, fragment-less, same-origin URL, and the serialization is
|
|
135
|
+
* what everything downstream stores and compares. `capabilityQuery` holds one
|
|
82
136
|
* collection-scoped grant request per app collection -- the existing capability
|
|
83
137
|
* shape MINUS `controller` (the wallet fills it with the app-key subject DID)
|
|
84
138
|
* and MINUS `reason` (the App Connect consent screen supersedes per-grant
|
|
@@ -91,8 +145,8 @@ function requestedActions({ id, visibility, actions }) {
|
|
|
91
145
|
* @param options.domain {string}
|
|
92
146
|
* @param options.appName {string} human-readable app name for the consent
|
|
93
147
|
* screen
|
|
94
|
-
* @param options.
|
|
95
|
-
*
|
|
148
|
+
* @param options.appUrl {string} the application's canonical URL, same-origin
|
|
149
|
+
* with `domain` and fragment-less; emitted in its serialized form
|
|
96
150
|
* @param options.collections {GrantRequestCollection[]} the collections to
|
|
97
151
|
* request (WAS collection id + visibility)
|
|
98
152
|
* @param [options.sharedCollections] {string[]} WAS collection ids of
|
|
@@ -100,13 +154,13 @@ function requestedActions({ id, visibility, actions }) {
|
|
|
100
154
|
* a `https://w3id.org/byoe#shared-wallet-collection` descriptor with
|
|
101
155
|
* {@link SHARED_ACTIONS}
|
|
102
156
|
* @param [options.actions] {string[]} the action set to request on each app
|
|
103
|
-
* collection; when omitted each collection requests exactly its class
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
157
|
+
* collection; when omitted each collection requests exactly its class's
|
|
158
|
+
* allowed actions ({@link actionCeiling}). An explicit set naming an action
|
|
159
|
+
* outside them throws (a configuration error, surfaced at build time rather
|
|
160
|
+
* than as a failed login)
|
|
107
161
|
* @returns {IVPRDetails}
|
|
108
162
|
*/
|
|
109
|
-
export function buildAppConnectVpr({ challenge, domain, appName,
|
|
163
|
+
export function buildAppConnectVpr({ challenge, domain, appName, appUrl, collections, sharedCollections = [], actions }) {
|
|
110
164
|
const capabilityQuery = collections.map(({ id, visibility }) => ({
|
|
111
165
|
referenceId: id,
|
|
112
166
|
allowedAction: requestedActions({ id, visibility, actions }),
|
|
@@ -137,8 +191,7 @@ export function buildAppConnectVpr({ challenge, domain, appName, credential, col
|
|
|
137
191
|
type: 'AppConnectQuery',
|
|
138
192
|
app: {
|
|
139
193
|
name: appName,
|
|
140
|
-
|
|
141
|
-
vocabBase: credential.vocabBase
|
|
194
|
+
appUrl: serializedAppUrl({ appUrl, origin: domain })
|
|
142
195
|
},
|
|
143
196
|
capabilityQuery
|
|
144
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginRequest.js","sourceRoot":"","sources":["../../src/auth/loginRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loginRequest.js","sourceRoot":"","sources":["../../src/auth/loginRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;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AE,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;iBACrD;gBACD,eAAe;aAChB;SACF;QACD,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC"}
|
|
@@ -43,10 +43,10 @@ export interface CheckedGrants {
|
|
|
43
43
|
* @param options.controllerDid {string} this app's seed-derived DID
|
|
44
44
|
* @param options.collections {GrantRequestCollection[]} the collections that
|
|
45
45
|
* must be covered (WAS collection id + visibility; the visibility selects
|
|
46
|
-
* the class
|
|
46
|
+
* the class's allowed actions the required actions are capped at)
|
|
47
47
|
* @param [options.requiredActions] {string[]} the actions each collection
|
|
48
|
-
* grant must allow, capped per collection at its class
|
|
49
|
-
* `RW_ACTIONS`, so each collection requires exactly
|
|
48
|
+
* grant must allow, capped per collection at its class's allowed actions
|
|
49
|
+
* (defaults to `RW_ACTIONS`, so each collection requires exactly them)
|
|
50
50
|
* @returns {CheckedGrants}
|
|
51
51
|
*/
|
|
52
52
|
export declare function checkGrants({ grants, controllerDid, collections, requiredActions }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyResponse.d.ts","sourceRoot":"","sources":["../../src/auth/verifyResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verifyResponse.d.ts","sourceRoot":"","sources":["../../src/auth/verifyResponse.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EACV,uBAAuB,EACvB,KAAK,EACN,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAG7D,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAA;AAE1B;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,YAAY,EACZ,SAAS,EACT,MAAM,EACN,cAAc,EACf,EAAE;IACD,YAAY,EAAE,uBAAuB,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,cAAc,CAAA;CAC/B,GAAG,OAAO,CAAC,IAAI,CAAC,CA0EhB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,YAAY,EAAE,uBAAuB,GAAG,KAAK,EAAE,CAMvE;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB;AASD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,aAAa,EACb,WAAW,EACX,eAA4B,EAC7B,EAAE;IACD,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,sBAAsB,EAAE,CAAA;IACrC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B,GAAG,aAAa,CA+ChB"}
|
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
* 2. Manual proof checks verifier-core does not make: `proofPurpose` is
|
|
14
14
|
* `authentication`, `domain` equals what this app sent (its origin), and
|
|
15
15
|
* the `challenge` echoes this request's fresh nonce.
|
|
16
|
-
* 3. Grant structure: every zcap is controlled by OUR seed-derived DID,
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* 3. Grant structure: every zcap is controlled by OUR seed-derived DID, carries
|
|
17
|
+
* a single non-empty string `invocationTarget`, targets a collection (never
|
|
18
|
+
* the Space itself or a reserved sub-endpoint) in a single space on a single
|
|
19
|
+
* WAS host, is unexpired, and the collection set is fully covered with
|
|
20
|
+
* sufficient actions -- where "sufficient" is capped at each collection
|
|
21
|
+
* class's allowed actions (the App Connect spec's "Allowed actions" table).
|
|
22
|
+
* Both collection classes allow the full vocabulary today, so the cap bounds
|
|
23
|
+
* nothing at present; it stays because the spec forbids failing a connection
|
|
24
|
+
* over an action the requested class never allows, which a correct wallet
|
|
25
|
+
* would be obliged to withhold.
|
|
23
26
|
* (Delegation-chain proofs are enforced server-side at invocation; the RP
|
|
24
27
|
* checks structure.)
|
|
25
28
|
*
|
|
@@ -129,10 +132,10 @@ function actionsOf(zcap) {
|
|
|
129
132
|
* @param options.controllerDid {string} this app's seed-derived DID
|
|
130
133
|
* @param options.collections {GrantRequestCollection[]} the collections that
|
|
131
134
|
* must be covered (WAS collection id + visibility; the visibility selects
|
|
132
|
-
* the class
|
|
135
|
+
* the class's allowed actions the required actions are capped at)
|
|
133
136
|
* @param [options.requiredActions] {string[]} the actions each collection
|
|
134
|
-
* grant must allow, capped per collection at its class
|
|
135
|
-
* `RW_ACTIONS`, so each collection requires exactly
|
|
137
|
+
* grant must allow, capped per collection at its class's allowed actions
|
|
138
|
+
* (defaults to `RW_ACTIONS`, so each collection requires exactly them)
|
|
136
139
|
* @returns {CheckedGrants}
|
|
137
140
|
*/
|
|
138
141
|
export function checkGrants({ grants, controllerDid, collections, requiredActions = RW_ACTIONS }) {
|
|
@@ -159,9 +162,9 @@ export function checkGrants({ grants, controllerDid, collections, requiredAction
|
|
|
159
162
|
throw new Error(`No grant covers the "${id}" collection.`);
|
|
160
163
|
}
|
|
161
164
|
const actions = actionsOf(grant);
|
|
162
|
-
// The requirement is capped at the class
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
+
// The requirement is capped at the class's allowed actions: an app must
|
|
166
|
+
// never fail a connection over an action its requested class never allows,
|
|
167
|
+
// since a conformant wallet is obliged to withhold it.
|
|
165
168
|
const required = actionCeiling(visibility).filter(action => requiredActions.includes(action));
|
|
166
169
|
const missing = required.filter(action => !actions.includes(action));
|
|
167
170
|
if (missing.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyResponse.js","sourceRoot":"","sources":["../../src/auth/verifyResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"verifyResponse.js","sourceRoot":"","sources":["../../src/auth/verifyResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAM3D,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EACL,aAAa,EACb,UAAU,EAEX,MAAM,mBAAmB,CAAA;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,EAC5C,YAAY,EACZ,SAAS,EACT,MAAM,EACN,cAAc,EAMf;IACC,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC;QACtC,YAAY;QACZ,SAAS;QACT,UAAU,EAAE,EAAE;QACd,cAAc;KACf,CAAC,CAAA;IACF,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG;YACf,GAAG,MAAM,CAAC,mBAAmB;YAC7B,GAAG,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SACpD,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAChB,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS;YAChC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC5D,CAAC,CAAC,EAAE,CACP,CAAA;QACD,wEAAwE;QACxE,8DAA8D;QAC9D,OAAO,CAAC,KAAK,CACX,wDAAwD,EACxD,IAA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ACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AACpC,CAAC"}
|
|
@@ -68,10 +68,13 @@ export type ICapabilityQueryDetail = {
|
|
|
68
68
|
*/
|
|
69
69
|
export type IAppConnectCapabilityQuery = Omit<ICapabilityQueryDetail, 'controller' | 'reason'>;
|
|
70
70
|
/**
|
|
71
|
-
* The one-popup App Connect query: it names the requesting app
|
|
72
|
-
* screen
|
|
73
|
-
*
|
|
74
|
-
*
|
|
71
|
+
* The one-popup App Connect query: it names the requesting app -- `name` for
|
|
72
|
+
* the consent screen, and `appUrl`, the application's canonical URL (absolute,
|
|
73
|
+
* fragment-less, same-origin with the request `domain`, in serialized form),
|
|
74
|
+
* which the wallet uses to MATCH an existing app key or MINT a fresh one --
|
|
75
|
+
* alongside the collection grants to delegate to that app key's subject DID.
|
|
76
|
+
* The app identity is scoped to the pair (origin, `appUrl`), so applications
|
|
77
|
+
* sharing an origin keep distinct identities. A wallet that predates this type renders it
|
|
75
78
|
* UNSATISFIABLE (the intended fail-closed behavior -- see `verifyResponse` /
|
|
76
79
|
* `loginFlow`), so an older wallet cannot silently degrade the login.
|
|
77
80
|
*
|
|
@@ -81,8 +84,7 @@ export type IAppConnectQuery = {
|
|
|
81
84
|
type: 'AppConnectQuery';
|
|
82
85
|
app: {
|
|
83
86
|
name: string;
|
|
84
|
-
|
|
85
|
-
vocabBase: string;
|
|
87
|
+
appUrl: string;
|
|
86
88
|
};
|
|
87
89
|
capabilityQuery: IAppConnectCapabilityQuery | IAppConnectCapabilityQuery[];
|
|
88
90
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletRequestTypes.d.ts","sourceRoot":"","sources":["../../src/auth/walletRequestTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,EACN,MAAM,8BAA8B,CAAA;AAErC;;;GAGG;A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5
5
|
* The central configuration contract for a WAS-backed local-first app: the app
|
|
6
|
-
* identity/origin, the registry of storage collections, the
|
|
7
|
-
*
|
|
6
|
+
* identity/origin/URL, the registry of storage collections, and the
|
|
7
|
+
* (all-optional) sync/expiry tuning. An app builds one
|
|
8
8
|
* {@link WasAppConfig} and threads it through the auth, storage, and sync
|
|
9
9
|
* layers.
|
|
10
10
|
*
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
* an app special-case a singleton collection (e.g. a current-focus doc) without
|
|
27
27
|
* a rigid CRUD interface.
|
|
28
28
|
*/
|
|
29
|
-
import type { SeedCredentialConfig } from './identity/seedCredential.js';
|
|
30
29
|
/**
|
|
31
30
|
* One storage collection: the logical `key` (app-side / RxDB collection handle)
|
|
32
31
|
* mapped to its WAS collection `id` (the generic, interoperable name).
|
|
@@ -46,7 +45,7 @@ export interface WasCollectionConfig {
|
|
|
46
45
|
* declares a world-readable collection (the wallet provisions it with a
|
|
47
46
|
* public-read policy); public implies PLAINTEXT -- payloads are stored as-is,
|
|
48
47
|
* with no per-collection cipher, and the LWW bookkeeping fields (`updatedAt`,
|
|
49
|
-
* `
|
|
48
|
+
* `writerId`) are world-readable alongside the content (`writerId` is a
|
|
50
49
|
* random per-install attribution label, but still a linkability handle across
|
|
51
50
|
* a user's public documents). Changing a collection's visibility after first
|
|
52
51
|
* use is a data-migration event, not a config tweak: existing rows keep
|
|
@@ -66,7 +65,7 @@ export interface WasCollectionConfig {
|
|
|
66
65
|
/**
|
|
67
66
|
* One SHARED collection: a wallet-owned, already-encrypted collection the app
|
|
68
67
|
* asks the wallet for read-and-decrypt access to (the
|
|
69
|
-
* `https://w3id.org/byoe#shared-collection` grant). It is the mirror image of
|
|
68
|
+
* `https://w3id.org/byoe#shared-wallet-collection` grant). It is the mirror image of
|
|
70
69
|
* {@link WasCollectionConfig}: read-only, NOT replicated into RxDB, NOT written
|
|
71
70
|
* to, and with no local replica. Reads go straight to the server through a
|
|
72
71
|
* `SharedCollectionReader`.
|
|
@@ -128,6 +127,17 @@ export interface WasAppConfig {
|
|
|
128
127
|
* This app's own web origin (the anti-phishing bind on the app key).
|
|
129
128
|
*/
|
|
130
129
|
appOrigin: string;
|
|
130
|
+
/**
|
|
131
|
+
* This app's canonical URL: what identifies this application among the
|
|
132
|
+
* applications served from its origin, so the app identity is scoped to the
|
|
133
|
+
* triple (user, origin, `appUrl`). It MUST be an absolute URL, MUST NOT carry
|
|
134
|
+
* a fragment, and MUST be same-origin with the app's live browser origin.
|
|
135
|
+
* Everything downstream stores and compares the parsed URL's serialization,
|
|
136
|
+
* so spellings differing only in a default port, in percent-encoding case, or
|
|
137
|
+
* in dot-segments do not name distinct applications. An app with a Web App
|
|
138
|
+
* Manifest is well served by using its processed manifest `id` here.
|
|
139
|
+
*/
|
|
140
|
+
appUrl: string;
|
|
131
141
|
/**
|
|
132
142
|
* The CHAPI mediator base URL (the requesting origin is appended).
|
|
133
143
|
*/
|
|
@@ -138,7 +148,7 @@ export interface WasAppConfig {
|
|
|
138
148
|
collections: WasCollectionConfig[];
|
|
139
149
|
/**
|
|
140
150
|
* Wallet-owned collections this app asks to be given READ-AND-DECRYPT access
|
|
141
|
-
* to (the `https://w3id.org/byoe#shared-collection` grant). Read-only by construction: they
|
|
151
|
+
* to (the `https://w3id.org/byoe#shared-wallet-collection` grant). Read-only by construction: they
|
|
142
152
|
* are never replicated into RxDB, never written to, and have no local
|
|
143
153
|
* replica -- reads go straight to the server through a
|
|
144
154
|
* `SharedCollectionReader`. A collection may be app-owned (`collections`) or
|
|
@@ -162,19 +172,15 @@ export interface WasAppConfig {
|
|
|
162
172
|
* undefined`) to keep fixtures out of production local-first apps.
|
|
163
173
|
*/
|
|
164
174
|
seedLocal?: () => Promise<void>;
|
|
165
|
-
/**
|
|
166
|
-
* The seed-credential type name + vocabulary namespace.
|
|
167
|
-
*/
|
|
168
|
-
credential: SeedCredentialConfig;
|
|
169
175
|
/**
|
|
170
176
|
* Base name for the local RxDB database and session IndexedDB naming. Defaults
|
|
171
177
|
* to {@link DEFAULT_DB_NAME}.
|
|
172
178
|
*/
|
|
173
179
|
dbName?: string;
|
|
174
180
|
/**
|
|
175
|
-
* Prefix for this app's `localStorage` keys (e.g. the LWW `
|
|
181
|
+
* Prefix for this app's `localStorage` keys (e.g. the LWW `writerId`).
|
|
176
182
|
* Defaults to {@link DEFAULT_STORAGE_KEY_PREFIX}. Migrating apps should set
|
|
177
|
-
* their prior prefix so an existing per-install
|
|
183
|
+
* their prior prefix so an existing per-install writer id is preserved.
|
|
178
184
|
*/
|
|
179
185
|
storageKeyPrefix?: string;
|
|
180
186
|
/**
|
|
@@ -228,7 +234,7 @@ export declare const DEFAULT_DB_NAME = "was-react";
|
|
|
228
234
|
*/
|
|
229
235
|
export declare const DEFAULT_ONBOARDING = "login-gated";
|
|
230
236
|
/**
|
|
231
|
-
* Default `localStorage` key prefix (e.g. `was-react:
|
|
237
|
+
* Default `localStorage` key prefix (e.g. `was-react:writerId`).
|
|
232
238
|
*/
|
|
233
239
|
export declare const DEFAULT_STORAGE_KEY_PREFIX = "was-react:";
|
|
234
240
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IACjC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,EAA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|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAuOA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAA;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAA;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAA;AAEhD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAkC;IACpE,MAAM,cAAc,GAAG,IAAI,GAAG,EAAgC,CAAA;IAC9D,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAA;IAC7C,KAAK,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,WAAW,EAAE,CAAC;QAC3D,MAAM,SAAS,GAAG,UAAU,IAAI,SAAS,CAAA;QACzC,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CACb,eAAe,GAAG,6BAA6B,MAAM,CAAC,UAAU,CAAC,IAAI;gBACnE,mCAAmC,CACtC,CAAA;QACH,CAAC;QACD,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CACb,kBAAkB,EAAE,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AAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACf,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,0BAA0B,GAAG,qCAAqC;gBAChE,2DAA2D,CAC9D,CAAA;QACH,CAAC;QACD,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACb,yBAAyB,EAAE,oCAAoC;gBAC7D,2DAA2D,CAC9D,CAAA;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,WAAW,EACX,EAAE,EAIH;IACC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAA;AACxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisionDevGrants.d.ts","sourceRoot":"","sources":["../../src/dev/provisionDevGrants.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"provisionDevGrants.d.ts","sourceRoot":"","sources":["../../src/dev/provisionDevGrants.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAalE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,UAIrC,CAAA;AAEF;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE;QACN,UAAU,EAAE,OAAO,CAAA;QACnB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,CAAA;CACF;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,SAAS,EACT,IAAI,EACJ,WAAW,EACX,SAAuB,EACvB,OAAO,EACP,eAA0C,EAC1C,cAAc,EAGd,OAAqC,EACrC,KAAa,EACb,GAAc,EACf,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;IAChB,WAAW,EAAE,KAAK,CAAC,MAAM,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;KAAE,CAAC,CAAA;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,UAAU,CAAA;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;IACvB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAChC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA4HpC"}
|
|
@@ -27,8 +27,8 @@ import { WasClient } from '@interop/was-client';
|
|
|
27
27
|
import { ensureFirstEpoch, ownerRecipient } from '@interop/was-client/edv';
|
|
28
28
|
import { CapabilityAgent } from '@interop/webkms-client';
|
|
29
29
|
import { agentsFromKeyAgent } from '@interop/wallet-core/identity';
|
|
30
|
+
import { collectionPath, rootCapability, spacePath, toUrl } from '@interop/was-client/paths';
|
|
30
31
|
import { deriveIdentity } from '../identity/agents.js';
|
|
31
|
-
import { collectionPath } from '../grants.js';
|
|
32
32
|
import { RW_ACTIONS } from '../auth/loginRequest.js';
|
|
33
33
|
import { errorStatus } from '../sync/index.js';
|
|
34
34
|
/**
|
|
@@ -111,13 +111,11 @@ actions = RW_ACTIONS, probe = false, log = () => { } }) {
|
|
|
111
111
|
// of every `/<collection>/<resource>` and `/<collection>/query` request. A
|
|
112
112
|
// grant rooted at the collection's own root authorizes only the exact
|
|
113
113
|
// collection-description URL, not its resources or the changes feed.
|
|
114
|
-
const spaceUrl =
|
|
115
|
-
const spaceRoot = {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
invocationTarget: spaceUrl
|
|
120
|
-
};
|
|
114
|
+
const spaceUrl = toUrl({ serverUrl, path: spacePath(space.id) });
|
|
115
|
+
const spaceRoot = rootCapability({
|
|
116
|
+
target: spaceUrl,
|
|
117
|
+
controller: provisionerDid
|
|
118
|
+
});
|
|
121
119
|
// `Promise.all` preserves input order, so `grants[i]` still corresponds to
|
|
122
120
|
// `collections[i]` (the probe below relies on that for `[0]`).
|
|
123
121
|
const grants = await Promise.all(collections.map(async (entry) => {
|
|
@@ -173,10 +171,7 @@ actions = RW_ACTIONS, probe = false, log = () => { } }) {
|
|
|
173
171
|
const firstEntry = collections[0];
|
|
174
172
|
const probeCollectionId = typeof firstEntry === 'string' ? firstEntry : firstEntry.id;
|
|
175
173
|
const probeCapability = grants[0];
|
|
176
|
-
const probePath = collectionPath(
|
|
177
|
-
spaceId: space.id,
|
|
178
|
-
collectionId: probeCollectionId
|
|
179
|
-
});
|
|
174
|
+
const probePath = collectionPath(space.id, probeCollectionId);
|
|
180
175
|
log(`\nDescription-write probe on "${probeCollectionId}" (delegated RW zcap):`);
|
|
181
176
|
try {
|
|
182
177
|
const current = await appWas.request({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisionDevGrants.js","sourceRoot":"","sources":["../../src/dev/provisionDevGrants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"provisionDevGrants.js","sourceRoot":"","sources":["../../src/dev/provisionDevGrants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EACL,cAAc,EACd,cAAc,EACd,SAAS,EACT,KAAK,EACN,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAe,IAAI,UAAU,CAAC;IACjE,IAAI,EAAE,IAA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C,GAAG,CAAC,CAAA;QAC/B,MAAM,IAAI,GAAI,GAA0B,CAAC,IAAI,CAAA;QAC7C,GAAG,CAAC,8BAA8B,MAAM,IAAI,KAAK,EAAE,CAAC,CAAA;QACpD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,GAAG,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/C,CAAC;QACD,MAAM,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IAC1D,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/grants.d.ts
CHANGED
|
@@ -12,20 +12,6 @@ export interface ParsedGrants {
|
|
|
12
12
|
*/
|
|
13
13
|
byCollectionId: Record<string, IZcap>;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Builds the server path of a collection, the inverse of the grammar
|
|
17
|
-
* `parseInvocationTarget` reads. Callers append a trailing slash or query
|
|
18
|
-
* string for resource-listing and query endpoints.
|
|
19
|
-
*
|
|
20
|
-
* @param options {object}
|
|
21
|
-
* @param options.spaceId {string}
|
|
22
|
-
* @param options.collectionId {string}
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
export declare function collectionPath({ spaceId, collectionId }: {
|
|
26
|
-
spaceId: string;
|
|
27
|
-
collectionId: string;
|
|
28
|
-
}): string;
|
|
29
15
|
/**
|
|
30
16
|
* Parses a single `invocationTarget` URL into its WAS components: the server
|
|
31
17
|
* origin, the space id, and the collection (every routed grant is
|
package/dist/grants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../src/grants.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAEzD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;CACtC;AAED
|
|
1
|
+
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../src/grants.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAEzD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;CACtC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG;IACrD,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;CACrB,CA0BA;AAiBD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,YAAY,CAgCxD"}
|
package/dist/grants.js
CHANGED
|
@@ -16,19 +16,6 @@
|
|
|
16
16
|
* silently split writes).
|
|
17
17
|
*/
|
|
18
18
|
import { parseSpaceTarget } from '@interop/was-client';
|
|
19
|
-
/**
|
|
20
|
-
* Builds the server path of a collection, the inverse of the grammar
|
|
21
|
-
* `parseInvocationTarget` reads. Callers append a trailing slash or query
|
|
22
|
-
* string for resource-listing and query endpoints.
|
|
23
|
-
*
|
|
24
|
-
* @param options {object}
|
|
25
|
-
* @param options.spaceId {string}
|
|
26
|
-
* @param options.collectionId {string}
|
|
27
|
-
* @returns {string}
|
|
28
|
-
*/
|
|
29
|
-
export function collectionPath({ spaceId, collectionId }) {
|
|
30
|
-
return `/space/${spaceId}/${collectionId}`;
|
|
31
|
-
}
|
|
32
19
|
/**
|
|
33
20
|
* Parses a single `invocationTarget` URL into its WAS components: the server
|
|
34
21
|
* origin, the space id, and the collection (every routed grant is
|