@interop/was-react 0.18.1 → 0.20.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 +4 -3
- package/dist/auth/verifyResponse.d.ts.map +1 -1
- package/dist/auth/verifyResponse.js +14 -7
- package/dist/auth/verifyResponse.js.map +1 -1
- package/dist/identity/agents.d.ts +5 -0
- package/dist/identity/agents.d.ts.map +1 -1
- package/dist/identity/agents.js +10 -3
- package/dist/identity/agents.js.map +1 -1
- package/dist/identity/seedCredential.d.ts +5 -1
- package/dist/identity/seedCredential.d.ts.map +1 -1
- package/dist/identity/seedCredential.js +15 -28
- package/dist/identity/seedCredential.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/mui/ClearDataDialog.d.ts.map +1 -1
- package/dist/mui/ClearDataDialog.js +14 -12
- package/dist/mui/ClearDataDialog.js.map +1 -1
- package/dist/mui/LogoutDialog.d.ts.map +1 -1
- package/dist/mui/LogoutDialog.js +12 -8
- package/dist/mui/LogoutDialog.js.map +1 -1
- package/dist/react/hooks.d.ts +11 -7
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/hooks.js +14 -8
- package/dist/react/hooks.js.map +1 -1
- package/dist/session/authStore.d.ts +30 -9
- package/dist/session/authStore.d.ts.map +1 -1
- package/dist/session/authStore.js +147 -48
- package/dist/session/authStore.js.map +1 -1
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +1 -0
- package/dist/session/index.js.map +1 -1
- package/dist/session/localWipe.d.ts +144 -0
- package/dist/session/localWipe.d.ts.map +1 -0
- package/dist/session/localWipe.js +190 -0
- package/dist/session/localWipe.js.map +1 -0
- package/dist/storage/adopt.d.ts +4 -1
- package/dist/storage/adopt.d.ts.map +1 -1
- package/dist/storage/adopt.js +4 -3
- package/dist/storage/adopt.js.map +1 -1
- package/dist/storage/entityStore.d.ts.map +1 -1
- package/dist/storage/entityStore.js +3 -0
- package/dist/storage/entityStore.js.map +1 -1
- package/dist/storage/publicUrl.js +3 -3
- package/dist/storage/storageContext.d.ts +175 -0
- package/dist/storage/storageContext.d.ts.map +1 -0
- package/dist/storage/storageContext.js +327 -0
- package/dist/storage/storageContext.js.map +1 -0
- package/dist/storage/storageManager.d.ts +57 -60
- package/dist/storage/storageManager.d.ts.map +1 -1
- package/dist/storage/storageManager.js +55 -125
- package/dist/storage/storageManager.js.map +1 -1
- package/dist/storage/syncController.d.ts +10 -1
- package/dist/storage/syncController.d.ts.map +1 -1
- package/dist/storage/syncController.js +12 -4
- package/dist/storage/syncController.js.map +1 -1
- package/dist/storage/syncStatusStore.d.ts +23 -2
- package/dist/storage/syncStatusStore.d.ts.map +1 -1
- package/dist/storage/syncStatusStore.js +22 -13
- package/dist/storage/syncStatusStore.js.map +1 -1
- package/dist/storage/writerId.d.ts +36 -0
- package/dist/storage/writerId.d.ts.map +1 -0
- package/dist/storage/writerId.js +76 -0
- package/dist/storage/writerId.js.map +1 -0
- package/package.json +13 -13
- package/dist/storage/rehydrate.d.ts +0 -64
- package/dist/storage/rehydrate.d.ts.map +0 -1
- package/dist/storage/rehydrate.js +0 -132
- package/dist/storage/rehydrate.js.map +0 -1
package/README.md
CHANGED
|
@@ -537,9 +537,10 @@ Hooks:
|
|
|
537
537
|
- **Status.** `useSyncStatus()` rolls the per-collection replication states up
|
|
538
538
|
to an aggregate: `offline` (no replication running / local-only), or
|
|
539
539
|
`error > syncing > synced`. The `SyncStatusChip` MUI component renders it. The
|
|
540
|
-
underlying `
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
underlying per-session status store (`storageContext.syncStatus` on the auth
|
|
541
|
+
store's state) keys its `statuses` map by the registry's logical collection
|
|
542
|
+
`key`, like every other layer (two entries may share one WAS collection `id`,
|
|
543
|
+
so the id is not a unique status key).
|
|
543
544
|
|
|
544
545
|
## Entry points
|
|
545
546
|
|
|
@@ -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":"AA0CA,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"}
|
|
@@ -23,14 +23,21 @@
|
|
|
23
23
|
* nothing at present; it stays because the spec forbids failing a connection
|
|
24
24
|
* over an action the requested class never allows, which a correct wallet
|
|
25
25
|
* would be obliged to withhold.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Chain depth, the parent capability, and the delegator's DID form are
|
|
27
|
+
* deliberately not inspected here; validity at invocation is the storage
|
|
28
|
+
* server's decision. ARCHITECTURE.md's "Grant checks and the skip
|
|
29
|
+
* condition" section states that intent and its consequences.
|
|
28
30
|
*
|
|
29
|
-
* Note on holder binding:
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* `
|
|
33
|
-
*
|
|
31
|
+
* Note on holder binding: for an ordinary DIDAuth request the wallet signs
|
|
32
|
+
* the VP as ITS holder DID -- did:webvh, did:web (the did:webvh log's
|
|
33
|
+
* projection id, same key), or did:key -- chosen by the wallet from the
|
|
34
|
+
* request's `acceptedMethods`. An App Connect response is pinned to the
|
|
35
|
+
* wallet client's did:key by construction, so it never dispatches on
|
|
36
|
+
* `acceptedMethods`. Either way the holder is not this app's controller DID,
|
|
37
|
+
* which never leaves this app. The seed-to-identity binding is enforced
|
|
38
|
+
* instead by `parseSeedCredential` (issuer === subject === DID derived from
|
|
39
|
+
* the embedded seed) and by every grant's `controller` being the requested
|
|
40
|
+
* controller DID.
|
|
34
41
|
*/
|
|
35
42
|
import { verifyPresentation } from '@interop/verifier-core';
|
|
36
43
|
import { parseGrants } from '../grants.js';
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,kBAAkB,EAA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ule; the one check every seed consumer
|
|
84
|
+
* (identity derivation, credential self-issue) runs before touching the bytes.
|
|
85
|
+
*/
|
|
86
|
+
export declare function assertSeedLength(seed: Uint8Array): void;
|
|
82
87
|
/**
|
|
83
88
|
* Derives the master identity agents from the master seed. The did:key
|
|
84
89
|
* controller is stable across devices for the same seed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AAErC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,cAAc,CAAA;AAMlD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,eAAe,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;IACtB;;OAEG;IACH,eAAe,EAAE,gBAAgB,CAAA;IACjC;;OAEG;IACH,WAAW,EAAE,YAAY,CAAA;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,EACnC,IAAI,EACJ,cAAwC,EACzC,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AAErC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,cAAc,CAAA;AAMlD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,eAAe,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;IACtB;;OAEG;IACH,eAAe,EAAE,gBAAgB,CAAA;IACjC;;OAEG;IACH,WAAW,EAAE,YAAY,CAAA;CAC1B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAIvD;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,EACnC,IAAI,EACJ,cAAwC,EACzC,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CAAC,cAAc,CAAC,CAa1B"}
|
package/dist/identity/agents.js
CHANGED
|
@@ -54,6 +54,15 @@ export const DEFAULT_IDENTITY_HANDLE = 'was-react';
|
|
|
54
54
|
// PINNED key-derivation input (the HMAC message that, with the seed, selects
|
|
55
55
|
// the key). Changing it after first use is a data-migration event.
|
|
56
56
|
const IDENTITY_KEY_NAME = 'app-key';
|
|
57
|
+
/**
|
|
58
|
+
* Enforces the 32-byte master seed rule; the one check every seed consumer
|
|
59
|
+
* (identity derivation, credential self-issue) runs before touching the bytes.
|
|
60
|
+
*/
|
|
61
|
+
export function assertSeedLength(seed) {
|
|
62
|
+
if (seed.length !== 32) {
|
|
63
|
+
throw new Error(`Master seed must be 32 bytes (got ${seed.length}).`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
57
66
|
/**
|
|
58
67
|
* Derives the master identity agents from the master seed. The did:key
|
|
59
68
|
* controller is stable across devices for the same seed.
|
|
@@ -65,9 +74,7 @@ const IDENTITY_KEY_NAME = 'app-key';
|
|
|
65
74
|
* @returns {Promise<IdentityAgents>}
|
|
66
75
|
*/
|
|
67
76
|
export async function deriveIdentity({ seed, identityHandle = DEFAULT_IDENTITY_HANDLE }) {
|
|
68
|
-
|
|
69
|
-
throw new Error(`Master seed must be 32 bytes (got ${seed.length}).`);
|
|
70
|
-
}
|
|
77
|
+
assertSeedLength(seed);
|
|
71
78
|
const keyAgent = await CapabilityAgent.fromSeed({
|
|
72
79
|
seed,
|
|
73
80
|
handle: identityHandle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAMlE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAA;AAElD,6EAA6E;AAC7E,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,SAAS,CAAA;AA8BnC
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAMlE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAA;AAElD,6EAA6E;AAC7E,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,SAAS,CAAA;AA8BnC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;IACvE,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,IAAI,EACJ,cAAc,GAAG,uBAAuB,EAIzC;IACC,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC;QAC9C,IAAI;QACJ,MAAM,EAAE,cAAc;QACtB,OAAO,EAAE,iBAAiB;KAC3B,CAAC,CAAA;IACF,qEAAqE;IACrE,0EAA0E;IAC1E,6EAA6E;IAC7E,wEAAwE;IACxE,6DAA6D;IAC7D,OAAO,EAAE,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAA;AAC1D,CAAC"}
|
|
@@ -42,7 +42,11 @@ export declare function bytesToBase64url(bytes: Uint8Array): string;
|
|
|
42
42
|
export declare function base64urlToBytes(text: string): Uint8Array;
|
|
43
43
|
/**
|
|
44
44
|
* Self-issues the app-key credential for `seed`, signed Ed25519Signature2020 by
|
|
45
|
-
* the seed-derived signer.
|
|
45
|
+
* the seed-derived signer. Delegates to wallet-core's `issueAppKeyCredential`,
|
|
46
|
+
* the same issuer the wallet mints with, so the credential's shape (context
|
|
47
|
+
* pair, type array, self-issued issuer/subject, seed claim) is maintained in
|
|
48
|
+
* one place; this wrapper only enforces the 32-byte seed rule up front and
|
|
49
|
+
* returns the bare credential.
|
|
46
50
|
*
|
|
47
51
|
* @param options {object}
|
|
48
52
|
* @param options.seed {Uint8Array} the 32-byte master seed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seedCredential.d.ts","sourceRoot":"","sources":["../../src/identity/seedCredential.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seedCredential.d.ts","sourceRoot":"","s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A2DhC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,MAAM,EACP,EAAE;IACD,YAAY,EAAE,uBAAuB,CAAA;IACrC,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,qBAAqB,GAAG,IAAI,CAW/B"}
|
|
@@ -22,13 +22,9 @@
|
|
|
22
22
|
* origin, `appUrl`).
|
|
23
23
|
*/
|
|
24
24
|
import { base64urlnopad } from '@scure/base';
|
|
25
|
-
import
|
|
26
|
-
import { Ed25519Signature2020 } from '@interop/ed25519-signature';
|
|
27
|
-
import { APP_KEY_CREDENTIAL_TYPE, APP_KEY_TYPE_ARRAY } from '@interop/wallet-core/request';
|
|
28
|
-
import { CONTEXT_URL_V1 } from 'byoe-context';
|
|
25
|
+
import { APP_KEY_CREDENTIAL_TYPE, APP_KEY_TYPE_ARRAY, issueAppKeyCredential } from '@interop/wallet-core/request';
|
|
29
26
|
import { asArray } from '../jsonLd.js';
|
|
30
|
-
import { deriveIdentity } from './agents.js';
|
|
31
|
-
const VC_1_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1';
|
|
27
|
+
import { assertSeedLength, deriveIdentity } from './agents.js';
|
|
32
28
|
/**
|
|
33
29
|
* The pinned wire constants of the app-key credential, owned by
|
|
34
30
|
* `@interop/wallet-core/request` (the wallet mints against the same values) and
|
|
@@ -60,7 +56,11 @@ export function base64urlToBytes(text) {
|
|
|
60
56
|
}
|
|
61
57
|
/**
|
|
62
58
|
* Self-issues the app-key credential for `seed`, signed Ed25519Signature2020 by
|
|
63
|
-
* the seed-derived signer.
|
|
59
|
+
* the seed-derived signer. Delegates to wallet-core's `issueAppKeyCredential`,
|
|
60
|
+
* the same issuer the wallet mints with, so the credential's shape (context
|
|
61
|
+
* pair, type array, self-issued issuer/subject, seed claim) is maintained in
|
|
62
|
+
* one place; this wrapper only enforces the 32-byte seed rule up front and
|
|
63
|
+
* returns the bare credential.
|
|
64
64
|
*
|
|
65
65
|
* @param options {object}
|
|
66
66
|
* @param options.seed {Uint8Array} the 32-byte master seed
|
|
@@ -74,28 +74,15 @@ export function base64urlToBytes(text) {
|
|
|
74
74
|
* @returns {Promise<IVerifiableCredential>}
|
|
75
75
|
*/
|
|
76
76
|
export async function issueSeedCredential({ seed, origin, appUrl, appName, documentLoader }) {
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
name: `${appName} app key`,
|
|
84
|
-
description: `The ${appName} app keeps this key in your wallet so it can open your encrypted data on this and other devices.`,
|
|
85
|
-
issuer: controllerDid,
|
|
86
|
-
credentialSubject: {
|
|
87
|
-
id: controllerDid,
|
|
88
|
-
seed: bytesToBase64url(seed),
|
|
89
|
-
appUrl,
|
|
90
|
-
origin
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const suite = new Ed25519Signature2020({ signer: keyAgent.getSigner() });
|
|
94
|
-
return (await vc.issue({
|
|
95
|
-
credential,
|
|
96
|
-
suite,
|
|
77
|
+
assertSeedLength(seed);
|
|
78
|
+
const { credential } = await issueAppKeyCredential({
|
|
79
|
+
seedBytes: seed,
|
|
80
|
+
appName,
|
|
81
|
+
appUrl,
|
|
82
|
+
origin,
|
|
97
83
|
documentLoader
|
|
98
|
-
})
|
|
84
|
+
});
|
|
85
|
+
return credential;
|
|
99
86
|
}
|
|
100
87
|
/**
|
|
101
88
|
* Parses an app-key credential and enforces the App Connect spec's six parse
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seedCredential.js","sourceRoot":"","sources":["../../src/identity/seedCredential.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"seedCredential.js","sourceRoot":"","sources":["../../src/identity/seedCredential.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;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EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,iDAAiD,IAAI,CAAC,MAAM,IAAI,CACjE,CAAA;IACH,CAAC;IACD,yEAAyE;IACzE,wDAAwD;IACxD,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/C,IAAI,QAAQ,CAAC,aAAa,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAA;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,CAAC,aAAa,EAAE,QAAQ,EAAE,CAAA;AAClE,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,YAAY,EACZ,MAAM,EAIP;IACC,MAAM,QAAQ,GAAI,YAAmD;SAClE,oBAAoB,CAAA;IACvB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,MAAM,OAAO,GAAI,KAAsD;aACpE,iBAAiB,CAAA;QACpB,IAAI,OAAO,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;YAC/B,OAAO,KAA8B,CAAA;QACvC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,15 +25,16 @@ export type { IVPRDetails, IVPRQuery, IDIDAuthenticationQuery, IAppConnectQuery,
|
|
|
25
25
|
export * from './sync/index.js';
|
|
26
26
|
export { LocalStore } from './storage/localStore.js';
|
|
27
27
|
export { mintRecordEncryption } from '@interop/wallet-core/keyring';
|
|
28
|
-
export {
|
|
28
|
+
export { StorageContext } from './storage/storageContext.js';
|
|
29
|
+
export { activateStorageContext, deactivateStorageContext, hasStorageContext, requireStorageContext, requireStore, hasStore, requireRemoteStore, hasRemoteStore, requireWriterId, stampLww } from './storage/storageManager.js';
|
|
30
|
+
export { getWriterId, clearPersistedWriterId } from './storage/writerId.js';
|
|
29
31
|
export { createEntityStore, type EntityStore } from './storage/entityStore.js';
|
|
30
32
|
export { WasRemoteStore, remoteDescriptorSource, type DeclarationResult, type EqualityQueryPage } from './storage/wasRemoteStore.js';
|
|
31
33
|
export { SharedCollectionReader, SharedCollectionUnavailableError, SHARED_CHANGES_PAGE_SIZE, type SharedResource } from './storage/sharedCollectionReader.js';
|
|
32
34
|
export { publicUrlFor } from './storage/publicUrl.js';
|
|
33
|
-
export {
|
|
34
|
-
export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
|
|
35
|
+
export { createSyncStatusStore, deriveSyncRollup, type SyncStatus, type SyncStatusStore } from './storage/syncStatusStore.js';
|
|
35
36
|
export { isAuthError, SyncController } from './storage/syncController.js';
|
|
36
37
|
export { startWasSync, type WasSyncBootstrap } from './storage/wasSync.js';
|
|
37
|
-
export { createAuthStore, type SessionStatus, type AuthState, type WasAuthStore } from './session/index.js';
|
|
38
|
+
export { createAuthStore, executeLocalWipe, snapshotWipeTargets, type SessionStatus, type AuthState, type WasAuthStore, type LocalWipeReport, type WipeTargets } from './session/index.js';
|
|
38
39
|
export { WasSessionProvider, WasSessionContext, useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSharedCollection, useSyncStatus, type SyncRollup, defineDocumentApp, DOCUMENT_COLLECTION_KEY, DOCUMENT_EXPORT_FORMAT, type DocumentApp } from './react/index.js';
|
|
39
40
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,mBAAmB,EACnB,yBAAy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ACV,WAAW,EACX,SAAS,EACT,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,EACN,MAAM,8BAA8B,CAAA;AAGrC,cAAc,iBAAiB,CAAA;AAK/B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAIpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,
|
|
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,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,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;AAIpB,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,KAAK,SAAS,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,KAAK,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6B,CAAA;AACpC,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EAChC,wBAAwB,EACxB,KAAK,cAAc,EACpB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAI1E,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,KAAK,UAAU,EACf,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -28,25 +28,27 @@ export { verifyLoginPresentation, grantsOf, checkGrants } from './auth/verifyRes
|
|
|
28
28
|
export { loginWithWallet, requestGrants, LoginCancelledError, WalletUnsupportedError } from './auth/loginFlow.js';
|
|
29
29
|
// The collection-agnostic RxDB-WAS replication core.
|
|
30
30
|
export * from './sync/index.js';
|
|
31
|
-
// Storage: local encrypted replica, the
|
|
32
|
-
//
|
|
33
|
-
// replication controller.
|
|
31
|
+
// Storage: local encrypted replica, the session-scoped storage context and
|
|
32
|
+
// the app-facing facades over the active one, entity stores, the delegated
|
|
33
|
+
// remote store, sync status, and the replication controller.
|
|
34
34
|
export { LocalStore } from './storage/localStore.js';
|
|
35
35
|
// Re-exported beside `LocalStore` (with `deriveIdentity` and
|
|
36
36
|
// `createDescriptorCache` above) so a consumer handed the store directly is
|
|
37
37
|
// also handed everything needed to provision one under epoch-from-birth.
|
|
38
38
|
export { mintRecordEncryption } from '@interop/wallet-core/keyring';
|
|
39
|
-
export {
|
|
39
|
+
export { StorageContext } from './storage/storageContext.js';
|
|
40
|
+
export { activateStorageContext, deactivateStorageContext, hasStorageContext, requireStorageContext, requireStore, hasStore, requireRemoteStore, hasRemoteStore, requireWriterId, stampLww } from './storage/storageManager.js';
|
|
41
|
+
export { getWriterId, clearPersistedWriterId } from './storage/writerId.js';
|
|
40
42
|
export { createEntityStore } from './storage/entityStore.js';
|
|
41
43
|
export { WasRemoteStore, remoteDescriptorSource } from './storage/wasRemoteStore.js';
|
|
42
44
|
export { SharedCollectionReader, SharedCollectionUnavailableError, SHARED_CHANGES_PAGE_SIZE } from './storage/sharedCollectionReader.js';
|
|
43
45
|
export { publicUrlFor } from './storage/publicUrl.js';
|
|
44
|
-
export {
|
|
45
|
-
export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
|
|
46
|
+
export { createSyncStatusStore, deriveSyncRollup } from './storage/syncStatusStore.js';
|
|
46
47
|
export { isAuthError, SyncController } from './storage/syncController.js';
|
|
47
48
|
export { startWasSync } from './storage/wasSync.js';
|
|
48
|
-
// Session lifecycle: the session auth store factory (the four-state machine)
|
|
49
|
-
|
|
49
|
+
// Session lifecycle: the session auth store factory (the four-state machine),
|
|
50
|
+
// and the wipe enumeration behind `clearLocalData`.
|
|
51
|
+
export { createAuthStore, executeLocalWipe, snapshotWipeTargets } from './session/index.js';
|
|
50
52
|
// React: the session provider + hooks.
|
|
51
53
|
export { WasSessionProvider, WasSessionContext, useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSharedCollection, useSyncStatus, defineDocumentApp, DOCUMENT_COLLECTION_KEY, DOCUMENT_EXPORT_FORMAT } from './react/index.js';
|
|
52
54
|
//# sourceMappingURL=index.js.map
|
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,mBAAmB,EACnB,yBAAyB,EAQ1B,MAAM,aAAa,CAAA;AAEpB,oCAAoC;AACpC,OAAO,EACL,qBAAqB,EACrB,WAAW,EAEZ,MAAM,aAAa,CAAA;AAEpB,8EAA8E;AAC9E,2CAA2C;AAC3C,OAAO,EACL,cAAc,EACd,uBAAuB,EAExB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,oBAAoB,EAErB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,eAAe,EACf,qBAAqB,EAEtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAEjB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EAGf,MAAM,0BAA0B,CAAA;AAEjC,2EAA2E;AAC3E,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC5E,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,EAEnB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,uBAAuB,EACvB,QAAQ,EACR,WAAW,EAEZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,eAAe,EACf,aAAa,EACb,mBAA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AAmB,EACnB,aAAa,EAEb,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearDataDialog.d.ts","sourceRoot":"","sources":["../../src/mui/ClearDataDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClearDataDialog.d.ts","sourceRoot":"","sources":["../../src/mui/ClearDataDialog.tsx"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EACR,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,+BAuCA"}
|
|
@@ -5,12 +5,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
/**
|
|
6
6
|
* The clear-data confirmation dialog. A dumb presentational component over the
|
|
7
7
|
* store's `clearLocalData` action: it confirms the destructive reset --
|
|
8
|
-
* deleting
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* deleting every database this app wrote on the browser (the connected replica
|
|
9
|
+
* AND the anonymous one), dropping the writer id, and minting a brand-new
|
|
10
|
+
* anonymous identity. The warning text is mode-aware: in `local` mode the
|
|
11
|
+
* browser's copy is the ONLY copy, so it nudges the user to export first; once
|
|
12
|
+
* connected, the copy already synced to the Web Space survives the reset, so
|
|
13
|
+
* the text says so instead of threatening total loss. Dismissing the dialog
|
|
14
|
+
* (backdrop / escape / Cancel) leaves the data untouched.
|
|
14
15
|
*/
|
|
15
16
|
import { Button } from '@mui/material';
|
|
16
17
|
import { ConfirmDialog } from './ConfirmDialog.js';
|
|
@@ -31,12 +32,13 @@ export function ClearDataDialog({ open, onClose }) {
|
|
|
31
32
|
onClose();
|
|
32
33
|
}
|
|
33
34
|
return (_jsx(ConfirmDialog, { testId: "clear-data", open: open, onClose: onClose, title: "Clear data", body: connected
|
|
34
|
-
? 'This erases
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
? 'This erases everything this app has stored in this browser -- ' +
|
|
36
|
+
'the copy of your Web Space and any offline data kept here ' +
|
|
37
|
+
'alongside it -- and disconnects from your Web Space. The data ' +
|
|
38
|
+
'already saved to your Web Space stays there: reconnect with ' +
|
|
39
|
+
'your wallet to bring it back.'
|
|
40
|
+
: 'This permanently erases everything this app has stored in this ' +
|
|
41
|
+
'browser and starts you over fresh. Your data lives only here, ' +
|
|
40
42
|
'so once cleared it cannot be recovered -- export a copy first ' +
|
|
41
43
|
'if you want to keep it.', actions: _jsx(Button, { color: "error", onClick: () => void handleClear(), "data-testid": "clear-data-confirm", children: "Clear data" }) }));
|
|
42
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearDataDialog.js","sourceRoot":"","sources":["../../src/mui/ClearDataDialog.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"ClearDataDialog.js","sourceRoot":"","sources":["../../src/mui/ClearDataDialog.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE5D;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EAIR;IACC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAAA;IAC/B,MAAM,SAAS,GAAG,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,WAAW,CAAA;IAElE,KAAK,UAAU,WAAW;QACxB,MAAM,SAAS,EAAE,CAAA;QACjB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,OAAO,CACL,KAAC,aAAa,IACZ,MAAM,EAAC,YAAY,EACnB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAC,YAAY,EAClB,IAAI,EACF,SAAS;YACP,CAAC,CAAC,gEAAgE;gBAChE,4DAA4D;gBAC5D,gEAAgE;gBAChE,8DAA8D;gBAC9D,+BAA+B;YACjC,CAAC,CAAC,iEAAiE;gBACjE,gEAAgE;gBAChE,gEAAgE;gBAChE,yBAAyB,EAE/B,OAAO,EACL,KAAC,MAAM,IACL,KAAK,EAAC,OAAO,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,WAAW,EAAE,iBACrB,oBAAoB,2BAGzB,GAEX,CACH,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutDialog.d.ts","sourceRoot":"","sources":["../../src/mui/LogoutDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogoutDialog.d.ts","sourceRoot":"","sources":["../../src/mui/LogoutDialog.tsx"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,OAAO,EACR,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,+BAwCA"}
|
package/dist/mui/LogoutDialog.js
CHANGED
|
@@ -5,10 +5,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
/**
|
|
6
6
|
* The logout confirmation dialog (connected mode). A dumb presentational
|
|
7
7
|
* component over the store's `logout` action: it makes the keep-vs-wipe choice
|
|
8
|
-
* explicit -- log out but leave the
|
|
9
|
-
* erase it -- since a shared machine and a personal one want opposite
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* explicit -- log out but leave the connected replica on this browser, or log
|
|
9
|
+
* out and erase it -- since a shared machine and a personal one want opposite
|
|
10
|
+
* defaults. The copy names WHICH copy erasing removes: the connected replica
|
|
11
|
+
* only. The anonymous local-first replica and the writer id survive a logout of
|
|
12
|
+
* either grade, and removing everything is `ClearDataDialog`'s job. Dismissing
|
|
13
|
+
* the dialog (backdrop / escape / Cancel) cancels logout entirely; no action
|
|
14
|
+
* runs and the session stays connected.
|
|
12
15
|
*/
|
|
13
16
|
import { Button } from '@mui/material';
|
|
14
17
|
import { ConfirmDialog } from './ConfirmDialog.js';
|
|
@@ -26,9 +29,10 @@ export function LogoutDialog({ open, onClose }) {
|
|
|
26
29
|
await logout({ wipe });
|
|
27
30
|
onClose();
|
|
28
31
|
}
|
|
29
|
-
return (_jsx(ConfirmDialog, { testId: "logout", open: open, onClose: onClose, title: "Log out", body: 'Keep
|
|
30
|
-
'Erasing removes the
|
|
31
|
-
'
|
|
32
|
-
'log
|
|
32
|
+
return (_jsx(ConfirmDialog, { testId: "logout", open: open, onClose: onClose, title: "Log out", body: 'Keep the copy on this browser for next time, or erase it now. ' +
|
|
33
|
+
'Erasing removes only the copy this browser holds of your Web Space ' +
|
|
34
|
+
'-- the data itself stays in your Web Space and comes back when you ' +
|
|
35
|
+
'log in again. To remove everything this app has stored here, use ' +
|
|
36
|
+
'Clear data instead.', actions: _jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => void handleLogout(false), "data-testid": "logout-keep", children: "Log out, keep data" }), _jsx(Button, { color: "error", onClick: () => void handleLogout(true), "data-testid": "logout-wipe", children: "Log out, erase local copy" })] }) }));
|
|
33
37
|
}
|
|
34
38
|
//# sourceMappingURL=LogoutDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutDialog.js","sourceRoot":"","sources":["../../src/mui/LogoutDialog.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"LogoutDialog.js","sourceRoot":"","sources":["../../src/mui/LogoutDialog.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,IAAI,EACJ,OAAO,EAIR;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,KAAK,UAAU,YAAY,CAAC,IAAa;QACvC,MAAM,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACtB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,OAAO,CACL,KAAC,aAAa,IACZ,MAAM,EAAC,QAAQ,EACf,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAC,SAAS,EACf,IAAI,EACF,gEAAgE;YAChE,qEAAqE;YACrE,qEAAqE;YACrE,mEAAmE;YACnE,qBAAqB,EAEvB,OAAO,EACL,8BACE,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,YAAY,CAAC,KAAK,CAAC,iBAC3B,aAAa,mCAGlB,EACT,KAAC,MAAM,IACL,KAAK,EAAC,OAAO,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,iBAC1B,aAAa,0CAGlB,IACR,GAEL,CACH,CAAA;AACH,CAAC"}
|
package/dist/react/hooks.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WasAuthStore } from '../session/authStore.js';
|
|
2
|
+
import type { LocalWipeReport } from '../session/localWipe.js';
|
|
2
3
|
import type { SharedCollectionReader } from '../storage/sharedCollectionReader.js';
|
|
3
4
|
import { type SyncRollup } from '../storage/syncStatusStore.js';
|
|
4
5
|
/**
|
|
@@ -59,13 +60,15 @@ export declare function useLogout(): (options?: {
|
|
|
59
60
|
wipe?: boolean;
|
|
60
61
|
}) => Promise<void>;
|
|
61
62
|
/**
|
|
62
|
-
* The clear-data action: deletes
|
|
63
|
-
*
|
|
64
|
-
* "Clear data" affordance).
|
|
63
|
+
* The clear-data action: deletes every database this app wrote on the browser
|
|
64
|
+
* (both replicas and both seed stores), drops the persisted writer id, and
|
|
65
|
+
* mints a fresh anonymous seed/DID + replica (the "Clear data" affordance).
|
|
66
|
+
* Resolves with the wipe report, so a caller can surface a deletion the engine
|
|
67
|
+
* could not confirm rather than claim a clean wipe.
|
|
65
68
|
*
|
|
66
|
-
* @returns {() => Promise<
|
|
69
|
+
* @returns {() => Promise<LocalWipeReport>}
|
|
67
70
|
*/
|
|
68
|
-
export declare function useClearData(): () => Promise<
|
|
71
|
+
export declare function useClearData(): () => Promise<LocalWipeReport>;
|
|
69
72
|
/**
|
|
70
73
|
* Whether the anonymous `local` replica currently holds any documents -- the
|
|
71
74
|
* check a login affordance runs at decision time (e.g. on the login button
|
|
@@ -105,8 +108,9 @@ export declare function useReconnect(): {
|
|
|
105
108
|
export type { SyncRollup };
|
|
106
109
|
/**
|
|
107
110
|
* The aggregate sync status over the per-collection replication statuses (the
|
|
108
|
-
* sync-status store keys them by the registry's logical collection
|
|
109
|
-
* subscription over that store
|
|
111
|
+
* session's sync-status store keys them by the registry's logical collection
|
|
112
|
+
* key). A thin subscription over that store, reached through the provider's
|
|
113
|
+
* storage context: it reads the collection statuses and defers the
|
|
110
114
|
* offline / error > syncing > synced precedence to {@link deriveSyncRollup}.
|
|
111
115
|
*
|
|
112
116
|
* @returns {{ state: SyncRollup, label: string, title: string }}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/react/hooks.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAClF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AC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACtD,KAAK,EAAE,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACpD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAaA;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,CAAC,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAG3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,MAAM,OAAO,CAAC,eAAe,CAAC,CAG7D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,MAAM,OAAO,CAAC,OAAO,CAAC,CAGxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,GACV,sBAAsB,GAAG,SAAS,CAGpC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI;IAC9B,aAAa,EAAE,OAAO,CAAA;IACtB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC/B,CAWA;AAED;;;GAGG;AACH,YAAY,EAAE,UAAU,EAAE,CAAA;AAE1B;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI;IAC/B,KAAK,EAAE,UAAU,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CASA"}
|
package/dist/react/hooks.js
CHANGED
|
@@ -10,7 +10,7 @@ import { useContext } from 'react';
|
|
|
10
10
|
import { useStore } from 'zustand';
|
|
11
11
|
import { useShallow } from 'zustand/react/shallow';
|
|
12
12
|
import { WasSessionContext } from './WasSessionProvider.js';
|
|
13
|
-
import {
|
|
13
|
+
import { deriveSyncRollup } from '../storage/syncStatusStore.js';
|
|
14
14
|
/**
|
|
15
15
|
* The bound auth store from the nearest {@link WasSessionProvider}. Throws a
|
|
16
16
|
* helpful error when used outside a provider.
|
|
@@ -80,11 +80,13 @@ export function useLogout() {
|
|
|
80
80
|
return useStore(store, state => state.logout);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* The clear-data action: deletes
|
|
84
|
-
*
|
|
85
|
-
* "Clear data" affordance).
|
|
83
|
+
* The clear-data action: deletes every database this app wrote on the browser
|
|
84
|
+
* (both replicas and both seed stores), drops the persisted writer id, and
|
|
85
|
+
* mints a fresh anonymous seed/DID + replica (the "Clear data" affordance).
|
|
86
|
+
* Resolves with the wipe report, so a caller can surface a deletion the engine
|
|
87
|
+
* could not confirm rather than claim a clean wipe.
|
|
86
88
|
*
|
|
87
|
-
* @returns {() => Promise<
|
|
89
|
+
* @returns {() => Promise<LocalWipeReport>}
|
|
88
90
|
*/
|
|
89
91
|
export function useClearData() {
|
|
90
92
|
const store = useAuthStore();
|
|
@@ -134,14 +136,18 @@ export function useReconnect() {
|
|
|
134
136
|
}
|
|
135
137
|
/**
|
|
136
138
|
* The aggregate sync status over the per-collection replication statuses (the
|
|
137
|
-
* sync-status store keys them by the registry's logical collection
|
|
138
|
-
* subscription over that store
|
|
139
|
+
* session's sync-status store keys them by the registry's logical collection
|
|
140
|
+
* key). A thin subscription over that store, reached through the provider's
|
|
141
|
+
* storage context: it reads the collection statuses and defers the
|
|
139
142
|
* offline / error > syncing > synced precedence to {@link deriveSyncRollup}.
|
|
140
143
|
*
|
|
141
144
|
* @returns {{ state: SyncRollup, label: string, title: string }}
|
|
142
145
|
*/
|
|
143
146
|
export function useSyncStatus() {
|
|
144
|
-
|
|
147
|
+
// The context is set once at store creation and never replaced, so reading
|
|
148
|
+
// it outside a selector subscribes to nothing it would need to.
|
|
149
|
+
const { syncStatus } = useAuthStore().getState().storageContext;
|
|
150
|
+
const values = useStore(syncStatus, useShallow(state => Object.values(state.statuses)));
|
|
145
151
|
return deriveSyncRollup(values);
|
|
146
152
|
}
|
|
147
153
|
//# sourceMappingURL=hooks.js.map
|
package/dist/react/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/react/hooks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/react/hooks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAI3D,OAAO,EACL,gBAAgB,EAEjB,MAAM,+BAA+B,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC3C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,yEAAyE;YACvE,sDAAsD,CACzD,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU;IAYxB,MAAM,KAAK,GAAG,YAAY,EAAE,CAAA;IAC5B,OAAO,QAAQ,CACb,KAAK,EACL,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,QAAQ,EAAE,KA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