@interop/was-react 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +103 -3
  2. package/dist/auth/loginFlow.d.ts +4 -2
  3. package/dist/auth/loginFlow.d.ts.map +1 -1
  4. package/dist/auth/loginFlow.js +1 -1
  5. package/dist/auth/loginFlow.js.map +1 -1
  6. package/dist/auth/loginRequest.d.ts +29 -3
  7. package/dist/auth/loginRequest.d.ts.map +1 -1
  8. package/dist/auth/loginRequest.js +12 -4
  9. package/dist/auth/loginRequest.js.map +1 -1
  10. package/dist/config.d.ts +38 -0
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +0 -0
  13. package/dist/config.js.map +1 -1
  14. package/dist/identity/documentLoader.d.ts +2 -8
  15. package/dist/identity/documentLoader.d.ts.map +1 -1
  16. package/dist/identity/documentLoader.js +7 -88
  17. package/dist/identity/documentLoader.js.map +1 -1
  18. package/dist/index.d.ts +5 -4
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +3 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/session/authStore.d.ts.map +1 -1
  23. package/dist/session/authStore.js +21 -9
  24. package/dist/session/authStore.js.map +1 -1
  25. package/dist/storage/entityStore.d.ts +20 -0
  26. package/dist/storage/entityStore.d.ts.map +1 -1
  27. package/dist/storage/entityStore.js +24 -1
  28. package/dist/storage/entityStore.js.map +1 -1
  29. package/dist/storage/localStore.d.ts +30 -13
  30. package/dist/storage/localStore.d.ts.map +1 -1
  31. package/dist/storage/localStore.js +56 -18
  32. package/dist/storage/localStore.js.map +1 -1
  33. package/dist/storage/publicUrl.d.ts +20 -0
  34. package/dist/storage/publicUrl.d.ts.map +1 -0
  35. package/dist/storage/publicUrl.js +33 -0
  36. package/dist/storage/publicUrl.js.map +1 -0
  37. package/dist/storage/storageManager.d.ts +28 -0
  38. package/dist/storage/storageManager.d.ts.map +1 -1
  39. package/dist/storage/storageManager.js +42 -2
  40. package/dist/storage/storageManager.js.map +1 -1
  41. package/dist/storage/wasRemoteStore.d.ts +105 -3
  42. package/dist/storage/wasRemoteStore.d.ts.map +1 -1
  43. package/dist/storage/wasRemoteStore.js +167 -5
  44. package/dist/storage/wasRemoteStore.js.map +1 -1
  45. package/dist/storage/wasSync.d.ts +7 -2
  46. package/dist/storage/wasSync.d.ts.map +1 -1
  47. package/dist/storage/wasSync.js +21 -7
  48. package/dist/storage/wasSync.js.map +1 -1
  49. package/dist/sync/docCipher.d.ts +22 -0
  50. package/dist/sync/docCipher.d.ts.map +1 -1
  51. package/dist/sync/docCipher.js +42 -0
  52. package/dist/sync/docCipher.js.map +1 -1
  53. package/dist/sync/index.d.ts +1 -1
  54. package/dist/sync/index.d.ts.map +1 -1
  55. package/dist/sync/index.js +1 -1
  56. package/dist/sync/index.js.map +1 -1
  57. package/package.json +8 -7
package/README.md CHANGED
@@ -98,6 +98,35 @@ interoperable apps). `credential` names the self-issued seed credential the
98
98
  first-run flow mints. All other fields (`mediatorBase`, `dbName`,
99
99
  `storageKeyPrefix`, `sync`, `expiry`) are optional with documented defaults.
100
100
 
101
+ A collection may also declare `visibility: 'public'`
102
+ (`{ key: 'posts', id: 'microblog-posts', visibility: 'public' }`); the default
103
+ is `'private'`. A public collection is world-readable and therefore PLAINTEXT:
104
+ no per-collection key is derived, payloads are stored as-is locally and
105
+ remotely, and the stored resource id is the payload's own logical `id`, so a
106
+ public document keeps a stable, shareable resource URL across edits. Be aware
107
+ that everything in a public payload is world-readable -- including the LWW
108
+ bookkeeping fields `updatedAt` and `deviceId` (`deviceId` is a random
109
+ per-install identifier, but still a linkability handle across a user's public
110
+ documents). Changing a collection's visibility after first use is a
111
+ data-migration event, not a config tweak: rows written in the other mode stop
112
+ being readable. A registry that maps one WAS collection id to both visibilities
113
+ is rejected at store open. Two payload constraints on public collections: a
114
+ top-level object-valued `jwe` field is reserved (the read path uses it to
115
+ recognize a stray encrypted envelope and refuses the row), and payloads should
116
+ carry the `updatedAt` / `deviceId` LWW fields like any other collection --
117
+ without them a concurrent multi-device edit falls back to server-wins.
118
+
119
+ At login, a public collection is requested from the wallet with the distinct
120
+ `urn:was:public-collection` descriptor type (private collections use
121
+ `urn:was:collection`): the wallet provisions it plaintext with a public-read
122
+ policy, shows a world-readable consent warning, and delegates the usual
123
+ read/write capability (public covers only unauthenticated reads; writes stay
124
+ capability-only). A wallet that predates the descriptor reports the request
125
+ unsatisfiable rather than silently provisioning a private collection, so the
126
+ feature fails closed with older wallets. Publicness is granted at consent time
127
+ by the wallet -- the app itself can never escalate an existing private
128
+ collection to public.
129
+
101
130
  ### 2. Entity stores and the registry
102
131
 
103
132
  ```ts
@@ -210,6 +239,75 @@ stamped on EVERY insert and update: they are the last-write-wins pair that
210
239
  settles concurrent multi-device edits of the same entity. A payload without them
211
240
  loses every sync conflict.
212
241
 
242
+ A public collection can additionally answer server-side equality queries.
243
+ Declare the queryable content attributes in the collection config:
244
+
245
+ ```ts
246
+ { key: 'posts', id: 'microblog-posts', visibility: 'public',
247
+ indexes: ['author', 'inReplyTo'] }
248
+ ```
249
+
250
+ The sync bootstrap announces the declaration in the collection description (the
251
+ server rejects filters on undeclared attributes fail-closed), and the entity
252
+ store's `query` verb runs the query:
253
+
254
+ ```ts
255
+ const page = await usePosts.getState().query({
256
+ equals: { author: 'did:key:z6Mk...' }
257
+ })
258
+ // page.docs: the matching payloads
259
+ // page.hasMore / page.cursor: pass cursor back in to fetch the next page
260
+ ```
261
+
262
+ `query` is a read verb against the server (signed with the granted collection
263
+ capability, so it needs a wallet-connected session), not a sync path: it never
264
+ touches the in-memory Map. Multiple `equals` attributes AND together; values
265
+ are string equality only. On the wire it is the collection list endpoint's
266
+ cacheable `filter[attr]=value` GET form, with filter attributes emitted in
267
+ sorted order so identical queries produce identical URLs; on a public
268
+ collection the same URL also answers anonymously for non-app consumers.
269
+ Declaring `indexes` on a private collection is rejected at config validation --
270
+ the encrypted (blinded-index) query path is not yet supported.
271
+
272
+ ### Share links (publish-copy)
273
+
274
+ A public collection also gives every document a stable, world-readable resource
275
+ URL, which is the basis for share links. The pattern is publish-copy: declare
276
+ one public collection for shared documents,
277
+
278
+ ```ts
279
+ { key: 'sharedNotes', id: 'shared-notes', visibility: 'public' }
280
+ ```
281
+
282
+ to share a document, copy it into that store, and the share URL is that copy's
283
+ resource URL:
284
+
285
+ ```ts
286
+ import { publicUrlFor } from '@interop/was-react'
287
+ import { useSharedNotes } from './stores.js'
288
+
289
+ // Share: copy the doc into the public collection.
290
+ await useSharedNotes.getState().insert(doc)
291
+ const url = publicUrlFor({ collectionKey: 'sharedNotes', id: doc.id })
292
+
293
+ // Unshare: remove the copy; replication pushes the delete and the URL stops
294
+ // resolving.
295
+ await useSharedNotes.getState().remove(doc.id)
296
+ ```
297
+
298
+ The URL is stable across edits because a public collection stores the payload
299
+ under its own logical uuid. Whether a share is a copy (which survives later
300
+ unsharing edits of the original) or a move is an app product decision;
301
+ content-addressed ids (hashing immutable content so identical content shares
302
+ one URL) are likewise an app-level choice.
303
+
304
+ Anyone on the web can read the URL -- there is no auth. A consumer can fetch it
305
+ with `WasClient.publicRead` from `@interop/was-client` or a plain GET. The URL
306
+ resolves only after the document has synced to the server (a locally-inserted
307
+ doc shares after the next sync push). Expiring or time-boxed share links are
308
+ not supported: sharing IS public-collection membership, so a share lasts until
309
+ the copy is removed.
310
+
213
311
  The MUI entry supplies a router gate and status UI on top of this; see
214
312
  [Entry points](#entry-points).
215
313
 
@@ -292,11 +390,13 @@ Hooks:
292
390
  row is `{ id, updatedAt, version, data }`, where `data` is an EDV envelope
293
391
  `{ id, sequence, jwe }`. The app reads exclusively from the in-memory entity
294
392
  stores hydrated from this replica, so it works fully offline.
295
- - **Envelope encryption.** Each collection is encrypted with its own X25519
296
- key-agreement key, HKDF-derived from the master seed with the label
393
+ - **Envelope encryption.** Each private collection is encrypted with its own
394
+ X25519 key-agreement key, HKDF-derived from the master seed with the label
297
395
  `kak:v1:<collectionId>` (`deriveCollectionKeys`). HKDF one-wayness means a
298
396
  shared per-collection key exposes nothing about the master seed or the sibling
299
- collections. The WAS server never sees plaintext.
397
+ collections. The WAS server never sees plaintext. A collection declared
398
+ `visibility: 'public'` opts out entirely: payloads are stored plaintext (no
399
+ key derivation, no envelope) behind the same storage seam.
300
400
  - **Replication.** A per-session `SyncController` runs RxDB replication per
301
401
  collection over a `WasSyncPort` (signed requests authorized by the granted
302
402
  zcaps). Pull is driven by the WAS `changes` feed; a low-frequency periodic
@@ -19,6 +19,7 @@ import type { IZcap } from '@interop/data-integrity-core';
19
19
  import type { DocumentLoader } from '../identity/documentLoader.js';
20
20
  import { type SeedCredentialConfig } from '../identity/seedCredential.js';
21
21
  import type { IdentityAgents } from '../identity/agents.js';
22
+ import { type GrantRequestCollection } from './loginRequest.js';
22
23
  import { type CheckedGrants } from './verifyResponse.js';
23
24
  import type { ParsedGrants } from '../grants.js';
24
25
  /**
@@ -36,9 +37,10 @@ export interface LoginConfig {
36
37
  */
37
38
  appName: string;
38
39
  /**
39
- * The WAS collection ids to request read/write grants for.
40
+ * The collections to request read/write grants for (WAS collection id +
41
+ * visibility; `'public'` selects the `urn:was:public-collection` descriptor).
40
42
  */
41
- collections: string[];
43
+ collections: GrantRequestCollection[];
42
44
  /**
43
45
  * The seed-credential type name + vocabulary namespace.
44
46
  */
@@ -1 +1 @@
1
- {"version":3,"file":"loginFlow.d.ts","sourceRoot":"","sources":["../../src/auth/loginFlow.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAKL,KAAK,oBAAoB,EAC1B,MAAM,+BAA+B,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAO3D,OAAO,EAIL,KAAK,aAAa,E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,CAAA;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,IAAI,EAAE,MAAM;CAIzB;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,OAAO,EACR,EAAE;IACD,QAAQ,EAAE,cAAc,CAAA;IACxB,MAAM,EAAE,WAAW,CAAA;IACnB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;CACtC,GAAG,OAAO,CAAC,aAAa,CAAC,CAkCzB;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,EACpC,MAAM,EACN,OAAO,EACR,EAAE;IACD,MAAM,EAAE,WAAW,CAAA;IACnB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;CACtC,GAAG,OAAO,CAAC,YAAY,CAAC,CAiFxB"}
@@ -51,7 +51,7 @@ export async function requestGrants({ identity, config, onPhase }) {
51
51
  return checkGrants({
52
52
  grants: grantsOf(presentation),
53
53
  controllerDid: identity.controllerDid,
54
- collections: config.collections,
54
+ collections: config.collections.map(collection => collection.id),
55
55
  ...(config.wasServerUrl !== undefined && {
56
56
  expectedServerUrl: config.wasServerUrl
57
57
  })
@@ -1 +1 @@
1
- {"version":3,"file":"loginFlow.js","sourceRoot":"","sources":["../../src/auth/loginFlow.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EAEvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,YAAY,EACb,MA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M,CAAC,UAAU;YACzB,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAC,CAAA;QACF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC;YAC9B,YAAY,EAAE,sBAAsB,CAAC,MAAM,CAAC;YAC5C,GAAG,CAAC,MAAM,CAAC,YAAY,KAAK,SAAS,IAAI;gBACvC,YAAY,EAAE,MAAM,CAAC,YAAY;aAClC,CAAC;SACH,CAAC,CAAA;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAmB,CAAC,mCAAmC,CAAC,CAAA;QACpE,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/C,sEAAsE;IACtE,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC;QAClC,QAAQ;QACR,MAAM;QACN,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC;KAC5B,CAAC,CAAA;IACF,OAAO;QACL,IAAI;QACJ,QAAQ;QACR,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ;KACT,CAAA;AACH,CAAC"}
@@ -11,6 +11,13 @@
11
11
  * one capabilityQuery per collection (descriptor-object targets, which the
12
12
  * wallet resolves against the user's one Space and auto-provisions). Only
13
13
  * collection-scoped capabilities are requested -- no whole-space grant.
14
+ * A `visibility: 'public'` collection is requested with the distinct
15
+ * descriptor type `urn:was:public-collection` (the wallet provisions it
16
+ * plaintext with a collection-level public-read policy and renders a
17
+ * world-readable consent warning); wallets that predate the type render it
18
+ * UNSATISFIABLE, which is the intended fail-closed behavior -- an older
19
+ * wallet must not silently provision a private collection the app believes
20
+ * is public.
14
21
  *
15
22
  * `domain` must host-match the CHAPI requesting origin or the wallet refuses
16
23
  * to sign; `challenge` must be fresh per request (echoed into the DIDAuth
@@ -21,6 +28,22 @@ import type { IVPRDetails } from './walletRequestTypes.js';
21
28
  * Default read/write actions requested on each app collection.
22
29
  */
23
30
  export declare const RW_ACTIONS: string[];
31
+ /**
32
+ * One collection to request a grant for: the WAS collection id plus its
33
+ * declared visibility (`'private'`, the default, or `'public'`).
34
+ */
35
+ export interface GrantRequestCollection {
36
+ /**
37
+ * WAS collection id (the unprefixed, cross-app generic name).
38
+ */
39
+ id: string;
40
+ /**
41
+ * Who can read the collection; selects the descriptor type
42
+ * (`urn:was:collection` for `'private'`/unset, `urn:was:public-collection`
43
+ * for `'public'`).
44
+ */
45
+ visibility?: 'private' | 'public';
46
+ }
24
47
  /**
25
48
  * A fresh nonce for a VPR challenge.
26
49
  */
@@ -44,13 +67,16 @@ export declare function buildSeedProbeVpr({ challenge, domain, credentialType, a
44
67
  /**
45
68
  * VPR #2: DIDAuthentication + AuthorizationCapabilityQuery -- one read/write
46
69
  * capabilityQuery per app collection (delegated to `controllerDid`). Only
47
- * collection-scoped capabilities are requested.
70
+ * collection-scoped capabilities are requested. A `visibility: 'public'`
71
+ * collection uses the `urn:was:public-collection` descriptor type; everything
72
+ * else uses `urn:was:collection`.
48
73
  *
49
74
  * @param options {object}
50
75
  * @param options.challenge {string}
51
76
  * @param options.domain {string}
52
77
  * @param options.controllerDid {string}
53
- * @param options.collections {string[]} the WAS collection ids to request
78
+ * @param options.collections {GrantRequestCollection[]} the collections to
79
+ * request (WAS collection id + visibility)
54
80
  * @param options.appName {string} human-readable app name for the reason line
55
81
  * @param [options.actions] {string[]} the RW action set (defaults to
56
82
  * `RW_ACTIONS`)
@@ -60,7 +86,7 @@ export declare function buildGrantsVpr({ challenge, domain, controllerDid, colle
60
86
  challenge: string;
61
87
  domain: string;
62
88
  controllerDid: string;
63
- collections: string[];
89
+ collections: GrantRequestCollection[];
64
90
  appName: string;
65
91
  actions?: string[];
66
92
  }): IVPRDetails;
@@ -1 +1 @@
1
- {"version":3,"file":"loginRequest.d.ts","sourceRoot":"","sources":["../../src/auth/loginRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAEhC;;GAEG;AACH,eAAO,MAAM,UAAU,UAA2C,CAAA;AAElE;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,MAAM,EACN,cAAc,EACd,OAAO,EACR,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,WAAW,CAkBd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,MAAM,EACN,aAAa,EACb,WAAW,EACX,OAAO,EACP,OAAoB,EACrB,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,GAAG,WAAW,CAsBd"}
1
+ {"version":3,"file":"loginRequest.d.ts","sourceRoot":"","sources":["../../src/auth/loginRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAEhC;;GAEG;AACH,eAAO,MAAM,UAAU,UAA2C,CAAA;AAElE;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CAClC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,MAAM,EACN,cAAc,EACd,OAAO,EACR,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,WAAW,CAkBd;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,MAAM,EACN,aAAa,EACb,WAAW,EACX,OAAO,EACP,OAAoB,EACrB,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,sBAAsB,EAAE,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,GAAG,WAAW,CA6Bd"}
@@ -40,25 +40,33 @@ export function buildSeedProbeVpr({ challenge, domain, credentialType, appName }
40
40
  /**
41
41
  * VPR #2: DIDAuthentication + AuthorizationCapabilityQuery -- one read/write
42
42
  * capabilityQuery per app collection (delegated to `controllerDid`). Only
43
- * collection-scoped capabilities are requested.
43
+ * collection-scoped capabilities are requested. A `visibility: 'public'`
44
+ * collection uses the `urn:was:public-collection` descriptor type; everything
45
+ * else uses `urn:was:collection`.
44
46
  *
45
47
  * @param options {object}
46
48
  * @param options.challenge {string}
47
49
  * @param options.domain {string}
48
50
  * @param options.controllerDid {string}
49
- * @param options.collections {string[]} the WAS collection ids to request
51
+ * @param options.collections {GrantRequestCollection[]} the collections to
52
+ * request (WAS collection id + visibility)
50
53
  * @param options.appName {string} human-readable app name for the reason line
51
54
  * @param [options.actions] {string[]} the RW action set (defaults to
52
55
  * `RW_ACTIONS`)
53
56
  * @returns {IVPRDetails}
54
57
  */
55
58
  export function buildGrantsVpr({ challenge, domain, controllerDid, collections, appName, actions = RW_ACTIONS }) {
56
- const capabilityQuery = collections.map(id => ({
59
+ const capabilityQuery = collections.map(({ id, visibility }) => ({
57
60
  referenceId: id,
58
61
  reason: `Store your ${appName} data in the "${id}" collection.`,
59
62
  controller: controllerDid,
60
63
  allowedAction: actions,
61
- invocationTarget: { type: 'urn:was:collection', name: id }
64
+ invocationTarget: {
65
+ type: visibility === 'public'
66
+ ? 'urn:was:public-collection'
67
+ : 'urn:was:collection',
68
+ name: id
69
+ }
62
70
  }));
63
71
  return {
64
72
  query: [
@@ -1 +1 @@
1
- {"version":3,"file":"loginRequest.js","sourceRoot":"","sources":["../../src/auth/loginRequest.ts"],"names":[],"mappings":"AAuBA;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAElE;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,UAAU,EAAE,CAAA;AAC5B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,MAAM,EACN,cAAc,EACd,OAAO,EAMR;IACC,OAAO;QACL,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;aACrC;YACD;gBACE,IAAI,EAAE,gBAAgB;gBACtB,eAAe,EAAE;oBACf,MAAM,EAAE,eAAe,OAAO,iCAAiC;oBAC/D,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;iBAClC;aACF;SACF;QACD,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,SAAS,EACT,MAAM,EACN,aAAa,EACb,WAAW,EACX,OAAO,EACP,OAAO,GAAG,UAAU,EAQrB;IACC,MAAM,eAAe,GAA6B,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACvE,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,cAAc,OAAO,iBAAiB,EAAE,eAAe;QAC/D,UAAU,EAAE,aAAa;QACzB,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,EAAE,EAAE;KAC3D,CAAC,CAAC,CAAA;IACH,OAAO;QACL,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;aACrC;YACD;gBACE,IAAI,EAAE,8BAA8B;gBACpC,eAAe;aAChB;SACF;QACD,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"loginRequest.js","sourceRoot":"","sources":["../../src/auth/loginRequest.ts"],"names":[],"mappings":"AA8BA;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAmBlE;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,UAAU,EAAE,CAAA;AAC5B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,MAAM,EACN,cAAc,EACd,OAAO,EAMR;IACC,OAAO;QACL,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;aACrC;YACD;gBACE,IAAI,EAAE,gBAAgB;gBACtB,eAAe,EAAE;oBACf,MAAM,EAAE,eAAe,OAAO,iCAAiC;oBAC/D,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;iBAClC;aACF;SACF;QACD,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,SAAS,EACT,MAAM,EACN,aAAa,EACb,WAAW,EACX,OAAO,EACP,OAAO,GAAG,UAAU,EAQrB;IACC,MAAM,eAAe,GAA6B,WAAW,CAAC,GAAG,CAC/D,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QACvB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,cAAc,OAAO,iBAAiB,EAAE,eAAe;QAC/D,UAAU,EAAE,aAAa;QACzB,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE;YAChB,IAAI,EAAE,UAAU,KAAK,QAAQ;gBAC3B,CAAC,CAAC,2BAA2B;gBAC7B,CAAC,CAAC,oBAAoB;YACxB,IAAI,EAAE,EAAE;SACT;KACF,CAAC,CACH,CAAA;IACD,OAAO;QACL,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;aACrC;YACD;gBACE,IAAI,EAAE,8BAA8B;gBACpC,eAAe;aAChB;SACF;QACD,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC"}
package/dist/config.d.ts CHANGED
@@ -35,6 +35,28 @@ export interface WasCollectionConfig {
35
35
  * WAS collection id (the unprefixed, cross-app generic name).
36
36
  */
37
37
  id: string;
38
+ /**
39
+ * Who can read the collection. `'private'` (the default) is the encrypted
40
+ * mode: payloads are stored as EDV envelopes locally and remotely. `'public'`
41
+ * declares a world-readable collection (the wallet provisions it with a
42
+ * public-read policy); public implies PLAINTEXT -- payloads are stored as-is,
43
+ * with no per-collection cipher, and the LWW bookkeeping fields (`updatedAt`,
44
+ * `deviceId`) are world-readable alongside the content (`deviceId` is a
45
+ * random per-device identifier, but still a linkability handle across a
46
+ * user's public documents). Changing a collection's visibility after first
47
+ * use is a data-migration event, not a config tweak: existing rows keep
48
+ * their stored form and stop being readable by the other mode.
49
+ */
50
+ visibility?: 'private' | 'public';
51
+ /**
52
+ * The content attributes the server indexes for equality queries
53
+ * (`store.query({ equals })`), e.g. `['author', 'inReplyTo']`. Declared here
54
+ * so the sync bootstrap can announce them in the collection description
55
+ * (undeclared attributes are rejected fail-closed by the server). Only valid
56
+ * on `visibility: 'public'` (plaintext) collections for now: the encrypted
57
+ * `blinded-index` query path is not yet supported.
58
+ */
59
+ indexes?: string[];
38
60
  }
39
61
  /**
40
62
  * Optional replication tuning; each field falls back to a documented default.
@@ -197,6 +219,22 @@ export declare const DEFAULT_EXPIRY_WARNING_MS: number;
197
219
  * Default near-expiry watch poll interval (ms): 1 minute.
198
220
  */
199
221
  export declare const DEFAULT_EXPIRY_WATCH_MS: number;
222
+ /**
223
+ * Validates a collection registry, fail-closed. Rejects an unknown `visibility`
224
+ * value (a config written against a future library version must not silently
225
+ * fall back to either mode), the encrypted-but-public combination: the same
226
+ * WAS collection id registered under conflicting visibilities, which would
227
+ * treat one server-side collection as both encrypted (private) and plaintext
228
+ * (public), and malformed `indexes` declarations (indexes on a private
229
+ * collection -- the encrypted query path is not yet supported -- plus empty or
230
+ * duplicate attribute names, and the same WAS collection id declared with
231
+ * diverging index sets). Called by the storage layer before any replica is
232
+ * opened.
233
+ *
234
+ * @param collections {WasCollectionConfig[]} the collection registry
235
+ * @returns {void}
236
+ */
237
+ export declare function validateCollections(collections: WasCollectionConfig[]): void;
200
238
  /**
201
239
  * Resolves a localStore/RxDB collection `key` from its WAS collection `id`.
202
240
  *
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAExE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;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E,MAAM,IAAI,CAAA;CAClB;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,gBAAgB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,0BAA0B,eAAe,CAAA;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAQ,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAiB,CAAA;AAEvD;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAY,CAAA;AAEhD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAyD5E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,EAAE,EACH,EAAE;IACD,WAAW,EAAE,mBAAmB,EAAE,CAAA;IAClC,EAAE,EAAE,MAAM,CAAA;CACX,GAAG,MAAM,GAAG,SAAS,CAErB"}
package/dist/config.js CHANGED
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAgLA;;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,C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S,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CACb,kBAAkB,EAAE,uCAAuC;gBACzD,oEAAoE;gBACpE,eAAe,CAClB,CAAA;QACH,CAAC;QACD,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;IAChC,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"}
@@ -8,15 +8,9 @@ export type DocumentLoader = (url: string) => Promise<{
8
8
  }>;
9
9
  /**
10
10
  * Builds the JSON-LD document loader handed to `@interop/vc` issuance and
11
- * verifier-core verification. Same envelope shape as the base loader; the http
12
- * did:web dev shim activates only when `wasServerUrl` is an http URL.
11
+ * verifier-core verification.
13
12
  *
14
- * @param [options] {object}
15
- * @param [options.wasServerUrl] {string} the configured WAS server URL; when
16
- * it is an http URL, did:web DIDs on that exact host are resolved over http
17
13
  * @returns {DocumentLoader}
18
14
  */
19
- export declare function createDocumentLoader({ wasServerUrl }?: {
20
- wasServerUrl?: string;
21
- }): DocumentLoader;
15
+ export declare function createDocumentLoader(): DocumentLoader;
22
16
  //# sourceMappingURL=documentLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"documentLoader.d.ts","sourceRoot":"","sources":["../../src/identity/documentLoader.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACpD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC,CAAA;AAiDF;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,YAAY,EACb,GAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,cAAc,CA+CtB"}
1
+ {"version":3,"file":"documentLoader.d.ts","sourceRoot":"","sources":["../../src/identity/documentLoader.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACpD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC,CAAA;AAIF;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAErD"}
@@ -3,101 +3,20 @@
3
3
  */
4
4
  /**
5
5
  * The app's one JSON-LD document loader: static security contexts plus did:key
6
- * / did:web resolution (`@interop/security-document-loader`).
7
- *
8
- * Local-dev shim: the did:web method mandates https, but a local WAS server
9
- * (which hosts the wallet's did:web documents) may run plain http. When the
10
- * configured WAS server URL is http, DIDs on exactly that host are resolved over
11
- * it; everything else falls through to the standard loader. In production
12
- * (https server, or no server URL) the shim never engages.
6
+ * / did:web resolution (`@interop/security-document-loader`). did:web DIDs on
7
+ * loopback hosts (a local dev WAS server on `localhost` or `127.0.0.1`)
8
+ * resolve over plain http; the resolver handles that natively, so no dev shim
9
+ * is needed here.
13
10
  */
14
11
  import { securityLoader } from '@interop/security-document-loader';
15
12
  const baseLoader = securityLoader({ fetchRemoteContexts: true }).build();
16
- /**
17
- * Per-suite context for a dereferenced verification-method node.
18
- */
19
- const CONTEXT_BY_KEY_TYPE = {
20
- Ed25519VerificationKey2020: 'https://w3id.org/security/suites/ed25519-2020/v1',
21
- X25519KeyAgreementKey2020: 'https://w3id.org/security/suites/x25519-2020/v1',
22
- Multikey: 'https://w3id.org/security/multikey/v1'
23
- };
24
- /**
25
- * Dereferences a `#fragment` subnode the way did-web-resolver's getNode does.
26
- */
27
- function nodeOf(didDocument, id) {
28
- const methods = (didDocument.verificationMethod ?? []);
29
- let match = methods.find(vm => vm?.id === id);
30
- if (!match) {
31
- for (const [key, value] of Object.entries(didDocument)) {
32
- if (key === '@context' || key === 'verificationMethod') {
33
- continue;
34
- }
35
- if (Array.isArray(value)) {
36
- match = value.find(entry => entry?.id === id);
37
- }
38
- else if (value?.id === id) {
39
- match = value;
40
- }
41
- if (match) {
42
- break;
43
- }
44
- }
45
- }
46
- if (!match) {
47
- throw new Error(`DID document entity with id "${id}" not found.`);
48
- }
49
- const context = (match.type && CONTEXT_BY_KEY_TYPE[match.type]) ?? didDocument['@context'];
50
- return { '@context': context, ...match };
51
- }
52
13
  /**
53
14
  * Builds the JSON-LD document loader handed to `@interop/vc` issuance and
54
- * verifier-core verification. Same envelope shape as the base loader; the http
55
- * did:web dev shim activates only when `wasServerUrl` is an http URL.
15
+ * verifier-core verification.
56
16
  *
57
- * @param [options] {object}
58
- * @param [options.wasServerUrl] {string} the configured WAS server URL; when
59
- * it is an http URL, did:web DIDs on that exact host are resolved over http
60
17
  * @returns {DocumentLoader}
61
18
  */
62
- export function createDocumentLoader({ wasServerUrl } = {}) {
63
- /**
64
- * Maps a did:web DID onto the local http WAS server's URL, or `null` when the
65
- * DID does not live on that host (or the shim is not applicable).
66
- */
67
- function insecureDidWebUrl(didAuthority) {
68
- if (!wasServerUrl || !wasServerUrl.startsWith('http://')) {
69
- return null;
70
- }
71
- const server = new URL(wasServerUrl);
72
- const segments = didAuthority.split(':');
73
- // ['did', 'web', '<encoded host>', ...path]
74
- const host = segments[2] ? decodeURIComponent(segments[2]) : '';
75
- if (host !== server.host) {
76
- return null;
77
- }
78
- const path = segments.slice(3).map(decodeURIComponent).join('/');
79
- return `http://${host}/${path ? `${path}/did.json` : '.well-known/did.json'}`;
80
- }
81
- return async function documentLoader(url) {
82
- if (url.startsWith('did:web:')) {
83
- const [didAuthority = ''] = url.split(/[#?]/);
84
- const fetchUrl = insecureDidWebUrl(didAuthority);
85
- if (fetchUrl) {
86
- const response = await fetch(fetchUrl);
87
- if (!response.ok) {
88
- throw new Error(`Could not fetch the DID document at "${fetchUrl}" (status ${response.status}).`);
89
- }
90
- const didDocument = (await response.json());
91
- if (didDocument.id !== didAuthority) {
92
- throw new Error(`DID document for "${didAuthority}" not found.`);
93
- }
94
- const document = url.includes('#')
95
- ? nodeOf(didDocument, url)
96
- : didDocument;
97
- return { contextUrl: null, document, documentUrl: url };
98
- }
99
- }
100
- return (await baseLoader(url));
101
- };
19
+ export function createDocumentLoader() {
20
+ return baseLoader;
102
21
  }
103
22
  //# sourceMappingURL=documentLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"documentLoader.js","sourceRoot":"","sources":["../../src/identity/documentLoader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAWlE,MAAM,UAAU,GAAG,cAAc,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAA;AAExE;;GAEG;AACH,MAAM,mBAAmB,GAA2B;IAClD,0BAA0B,EACxB,kDAAkD;IACpD,yBAAyB,EAAE,iDAAiD;IAC5E,QAAQ,EAAE,uCAAuC;CAClD,CAAA;AAQD;;GAEG;AACH,SAAS,MAAM,CAAC,WAA4B,EAAE,EAAU;IACtD,MAAM,OAAO,GAAG,CAAC,WAAW,CAAC,kBAAkB,IAAI,EAAE,CAAsB,CAAA;IAC3E,IAAI,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACvD,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,oBAAoB,EAAE,CAAC;gBACvD,SAAQ;YACV,CA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AAW,EAAE,GAAG,EAAE,CAAA;YACzD,CAAC;QACH,CAAC;QACD,OAAO,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,CAI5B,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"documentLoader.js","sourceRoot":"","sources":["../../src/identity/documentLoader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAWlE,MAAM,UAAU,GAAG,cAAc,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAA;AAExE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,UAA4B,CAAA;AACrC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * `@interop/was-react/mui`; the Node-only dev-grant provisioner lives at
11
11
  * `@interop/was-react/dev`. Neither is re-exported here.
12
12
  */
13
- export { DEFAULT_DB_NAME, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_SYNC_POLL_MS, DEFAULT_EXPIRY_WARNING_MS, DEFAULT_EXPIRY_WATCH_MS, collectionKeyForId, type WasCollectionConfig, type WasSyncConfig, type WasExpiryConfig, type WasAppConfig, type StoreRegistryEntry, type StoreRegistry } from './config.js';
13
+ export { DEFAULT_DB_NAME, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_SYNC_POLL_MS, DEFAULT_EXPIRY_WARNING_MS, DEFAULT_EXPIRY_WATCH_MS, collectionKeyForId, validateCollections, type WasCollectionConfig, type WasSyncConfig, type WasExpiryConfig, type WasAppConfig, type StoreRegistryEntry, type StoreRegistry } from './config.js';
14
14
  export { parseInvocationTarget, parseGrants, type ParsedGrants } from './grants.js';
15
15
  export { deriveIdentity, deriveCollectionKeys, DEFAULT_IDENTITY_HANDLE, DEFAULT_KAK_HANDLE, type IdentityAgents, type CollectionKeys } from './identity/agents.js';
16
16
  export { createDocumentLoader, type DocumentLoader } from './identity/documentLoader.js';
@@ -19,15 +19,16 @@ export { issueSeedCredential, parseSeedCredential, findSeedCredential, wrapCrede
19
19
  export { initAppSession } from './identity/initAppSession.js';
20
20
  export { persistAppSession, restoreAppSession, clearAppSession, isExpired, isNearExpiry, earliestExpiry, type AppSessionRecord, type RestoredAppSession } from './identity/appSession.js';
21
21
  export { DEFAULT_MEDIATOR_BASE, loadChapi, chapiGet, chapiStore } from './auth/chapi.js';
22
- export { RW_ACTIONS, newChallenge, buildSeedProbeVpr, buildGrantsVpr } from './auth/loginRequest.js';
22
+ export { RW_ACTIONS, newChallenge, buildSeedProbeVpr, buildGrantsVpr, type GrantRequestCollection } from './auth/loginRequest.js';
23
23
  export { verifyLoginPresentation, grantsOf, checkGrants, type CheckedGrants } from './auth/verifyResponse.js';
24
24
  export { loginWithWallet, requestGrants, LoginCancelledError, type LoginConfig, type LoginPhase, type LoginOutcome } from './auth/loginFlow.js';
25
25
  export type { WalletAPIMessage, IVPOffer, IVPRequest, IVPRDetails, IVPRQuery, IQueryByExample, IDIDAuthenticationQuery, IZcapQuery, ICapabilityQueryDetail, WalletResponse, WalletRequestProfile, IVerifiableCredential, IVerifiablePresentation, IZcap } from './auth/walletRequestTypes.js';
26
26
  export * from './sync/index.js';
27
27
  export { LocalStore } from './storage/localStore.js';
28
- export { setLocalStore, requireStore, hasStore, clearLocalStore, getDeviceId } from './storage/storageManager.js';
28
+ export { setLocalStore, requireStore, hasStore, clearLocalStore, setRemoteStore, requireRemoteStore, hasRemoteStore, clearRemoteStore, getDeviceId } from './storage/storageManager.js';
29
29
  export { createEntityStore, type EntityStore } from './storage/entityStore.js';
30
- export { WasRemoteStore, type MarkerResult } from './storage/wasRemoteStore.js';
30
+ export { WasRemoteStore, type MarkerResult, type EqualityQueryPage } from './storage/wasRemoteStore.js';
31
+ export { publicUrlFor } from './storage/publicUrl.js';
31
32
  export { useSyncStatusStore, deriveSyncRollup, type SyncStatus } from './storage/syncStatusStore.js';
32
33
  export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
33
34
  export { isAuthError, SyncController, createSyncController } from './storage/syncController.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AAGH,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,KAAK,YAAY,EAClB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,QAAQ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KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AAGH,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,KAAK,YAAY,EAClB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,iBAAiB,EAC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AAK,UAAU,EAChB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,WAAW,EACX,cAAc,EACd,oBAAoB,EACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * `@interop/was-react/dev`. Neither is re-exported here.
12
12
  */
13
13
  // Configuration contract.
14
- export { DEFAULT_DB_NAME, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_SYNC_POLL_MS, DEFAULT_EXPIRY_WARNING_MS, DEFAULT_EXPIRY_WATCH_MS, collectionKeyForId } from './config.js';
14
+ export { DEFAULT_DB_NAME, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_SYNC_POLL_MS, DEFAULT_EXPIRY_WARNING_MS, DEFAULT_EXPIRY_WATCH_MS, collectionKeyForId, validateCollections } from './config.js';
15
15
  // Grant parsing / topology routing.
16
16
  export { parseInvocationTarget, parseGrants } from './grants.js';
17
17
  // Identity: seed-derived agents + per-collection vault keys.
@@ -32,9 +32,10 @@ export * from './sync/index.js';
32
32
  // stores, the delegated remote store, sync status, rehydrate mechanism, and the
33
33
  // replication controller.
34
34
  export { LocalStore } from './storage/localStore.js';
35
- export { setLocalStore, requireStore, hasStore, clearLocalStore, getDeviceId } from './storage/storageManager.js';
35
+ export { setLocalStore, requireStore, hasStore, clearLocalStore, setRemoteStore, requireRemoteStore, hasRemoteStore, clearRemoteStore, getDeviceId } from './storage/storageManager.js';
36
36
  export { createEntityStore } from './storage/entityStore.js';
37
37
  export { WasRemoteStore } from './storage/wasRemoteStore.js';
38
+ export { publicUrlFor } from './storage/publicUrl.js';
38
39
  export { useSyncStatusStore, deriveSyncRollup } from './storage/syncStatusStore.js';
39
40
  export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
40
41
  export { isAuthError, SyncController, createSyncController } from './storage/syncController.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AAEH,0BAA0B;AAC1B,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAOnB,MAAM,aAAa,CAAA;AAEpB,oCAAoC;AACpC,OAAO,EACL,qBAAqB,EACrB,WAAW,EAEZ,MAAM,aAAa,CAAA;AAEpB,6DAA6D;AAC7D,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAGnB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,oBAAoB,EAErB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,eAAe,EAAkB,MAAM,yBAAyB,CAAA;AACzE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAGjB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,Y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