@interop/was-react 0.3.6 → 0.5.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 +84 -11
- package/dist/auth/loginFlow.d.ts +6 -0
- package/dist/auth/loginFlow.d.ts.map +1 -1
- package/dist/auth/loginFlow.js +28 -9
- package/dist/auth/loginFlow.js.map +1 -1
- package/dist/auth/loginRequest.d.ts +22 -1
- package/dist/auth/loginRequest.d.ts.map +1 -1
- package/dist/auth/loginRequest.js +17 -1
- package/dist/auth/loginRequest.js.map +1 -1
- package/dist/config.d.ts +51 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -0
- package/dist/config.js.map +1 -1
- package/dist/identity/agents.d.ts +38 -11
- package/dist/identity/agents.d.ts.map +1 -1
- package/dist/identity/agents.js +35 -11
- package/dist/identity/agents.js.map +1 -1
- package/dist/identity/initAppSession.d.ts +6 -6
- package/dist/identity/initAppSession.js +6 -6
- package/dist/identity/seedCredential.d.ts +29 -5
- package/dist/identity/seedCredential.d.ts.map +1 -1
- package/dist/identity/seedCredential.js +47 -11
- package/dist/identity/seedCredential.js.map +1 -1
- package/dist/identity/seedStore.d.ts +11 -1
- package/dist/identity/seedStore.d.ts.map +1 -1
- package/dist/identity/seedStore.js +9 -0
- package/dist/identity/seedStore.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/react/hooks.d.ts +12 -0
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/hooks.js +14 -0
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/session/authStore.d.ts +9 -0
- package/dist/session/authStore.d.ts.map +1 -1
- package/dist/session/authStore.js +73 -18
- package/dist/session/authStore.js.map +1 -1
- package/dist/storage/adopt.js +2 -2
- package/dist/storage/localStore.d.ts +73 -11
- package/dist/storage/localStore.d.ts.map +1 -1
- package/dist/storage/localStore.js +187 -30
- package/dist/storage/localStore.js.map +1 -1
- package/dist/storage/sharedCollectionReader.d.ts +95 -0
- package/dist/storage/sharedCollectionReader.d.ts.map +1 -0
- package/dist/storage/sharedCollectionReader.js +338 -0
- package/dist/storage/sharedCollectionReader.js.map +1 -0
- package/dist/storage/wasRemoteStore.d.ts +24 -2
- package/dist/storage/wasRemoteStore.d.ts.map +1 -1
- package/dist/storage/wasRemoteStore.js +40 -0
- package/dist/storage/wasRemoteStore.js.map +1 -1
- package/dist/storage/wasSync.d.ts +42 -5
- package/dist/storage/wasSync.d.ts.map +1 -1
- package/dist/storage/wasSync.js +71 -5
- package/dist/storage/wasSync.js.map +1 -1
- package/dist/sync/docCipher.d.ts +19 -3
- package/dist/sync/docCipher.d.ts.map +1 -1
- package/dist/sync/docCipher.js +24 -59
- package/dist/sync/docCipher.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
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;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAMjE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAA;AAElD,6EAA6E;AAC7E,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,SAAS,CAAA;AA8BnC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,IAAI,EACJ,cAAc,GAAG,uBAAuB,EAIzC;IACC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC;QAC9C,IAAI;QACJ,MAAM,EAAE,cAAc;QACtB,OAAO,EAAE,iBAAiB;KAC3B,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAA;IACnC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC;QAChC,UAAU,EAAE,oBAAoB;QAChC,gBAAgB,EAAE,MAAM;QACxB,gBAAgB,EAAE,MAAM;KACzB,CAAC,CAAA;IACF,yEAAyE;IACzE,qEAAqE;IACrE,wEAAwE;IACxE,gBAAgB;IAChB,MAAM,eAAe,GACnB,yBAAyB,CAAC,8BAA8B,CAAC;QACvD,OAAO,EAAE,QAAQ,CAAC,sBAAsB,EAAE;KAC3C,CAAgC,CAAA;IACnC,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAA;IAC1D,OAAO;QACL,aAAa,EAAE,QAAQ,CAAC,EAAE;QAC1B,QAAQ;QACR,UAAU;QACV,eAAe;QACf,WAAW;KACZ,CAAA;AACH,CAAC"}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* App-session identity bootstrap: everything derivable from the master seed in
|
|
6
6
|
* one call. Thin composition over the pinned derivation in `agents.ts` (which
|
|
7
|
-
* is the shared-key contract: `CapabilityAgent.fromSeed` on raw bytes
|
|
8
|
-
*
|
|
9
|
-
* never change either without a migration plan).
|
|
7
|
+
* is the shared-key contract: `CapabilityAgent.fromSeed` on raw bytes, keyName
|
|
8
|
+
* `app-key` -- never change it without a migration plan).
|
|
10
9
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* The agents it returns carry the app's identity key-agreement key, which is
|
|
11
|
+
* the ONE key every encrypted collection is read with: the local replica's
|
|
12
|
+
* ciphers (`LocalStore.init`) and every key-epoch roster entry the wallet
|
|
13
|
+
* writes for this app alike.
|
|
14
14
|
*/
|
|
15
15
|
import { type IdentityAgents } from './agents.js';
|
|
16
16
|
/**
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* App-session identity bootstrap: everything derivable from the master seed in
|
|
6
6
|
* one call. Thin composition over the pinned derivation in `agents.ts` (which
|
|
7
|
-
* is the shared-key contract: `CapabilityAgent.fromSeed` on raw bytes
|
|
8
|
-
*
|
|
9
|
-
* never change either without a migration plan).
|
|
7
|
+
* is the shared-key contract: `CapabilityAgent.fromSeed` on raw bytes, keyName
|
|
8
|
+
* `app-key` -- never change it without a migration plan).
|
|
10
9
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* The agents it returns carry the app's identity key-agreement key, which is
|
|
11
|
+
* the ONE key every encrypted collection is read with: the local replica's
|
|
12
|
+
* ciphers (`LocalStore.init`) and every key-epoch roster entry the wallet
|
|
13
|
+
* writes for this app alike.
|
|
14
14
|
*/
|
|
15
15
|
import { deriveIdentity } from './agents.js';
|
|
16
16
|
/**
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { IVerifiableCredential, IVerifiablePresentation } from '@interop/data-integrity-core';
|
|
2
2
|
import type { DocumentLoader } from './documentLoader.js';
|
|
3
|
+
/**
|
|
4
|
+
* The marker type every app key carries alongside the app's own
|
|
5
|
+
* `credentialType`, mapped to one stable IRI for every app (NOT interpolated
|
|
6
|
+
* from an app's `vocabBase`). It makes "presents as an app key" a term check
|
|
7
|
+
* rather than a shape heuristic, which is what lets the wallet refuse a
|
|
8
|
+
* foreign app key at store time.
|
|
9
|
+
*
|
|
10
|
+
* It is a self-declaration, not evidence: the `type` array of a planted
|
|
11
|
+
* credential is attacker-controlled like the rest of it. The marker makes the
|
|
12
|
+
* rule precise; the seed-to-DID binding `parseSeedCredential` enforces remains
|
|
13
|
+
* the only thing that authenticates.
|
|
14
|
+
*/
|
|
15
|
+
export declare const APP_KEY_CREDENTIAL_TYPE = "AppKeyCredential";
|
|
3
16
|
/**
|
|
4
17
|
* App-supplied naming for the seed credential: the VC `type` name and the URN
|
|
5
18
|
* vocabulary namespace its inline-context terms are minted under (e.g.
|
|
@@ -45,11 +58,17 @@ export declare function issueSeedCredential({ seed, origin, appName, config, doc
|
|
|
45
58
|
documentLoader: DocumentLoader;
|
|
46
59
|
}): Promise<IVerifiableCredential>;
|
|
47
60
|
/**
|
|
48
|
-
* Parses a seed credential and enforces the structural contract:
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* credential
|
|
61
|
+
* Parses a seed credential and enforces the structural contract: the shared
|
|
62
|
+
* `AppKeyCredential` marker type, the app's own type, self-issue
|
|
63
|
+
* (issuer === subject id), origin binding, a well-formed 32-byte seed, and --
|
|
64
|
+
* the strongest check -- that the DID derived from the embedded seed IS the
|
|
65
|
+
* credential's subject/issuer DID. (The cryptographic proof on the credential
|
|
66
|
+
* is verified separately at the presentation level.)
|
|
67
|
+
*
|
|
68
|
+
* The marker is required, not merely tolerated: a wallet may only store a
|
|
69
|
+
* credential presenting as an app key when it binds to its own seed, so
|
|
70
|
+
* requiring the marker here keeps both sides on one rule. It weakens nothing,
|
|
71
|
+
* since the seed-to-DID binding below is the boundary either way.
|
|
53
72
|
*
|
|
54
73
|
* @param options {object}
|
|
55
74
|
* @param options.credential {IVerifiableCredential}
|
|
@@ -66,6 +85,11 @@ export declare function parseSeedCredential({ credential, origin, config }: {
|
|
|
66
85
|
* Finds the seed credential inside a wallet response VP, or `null` when the
|
|
67
86
|
* wallet returned none (the first-run signal).
|
|
68
87
|
*
|
|
88
|
+
* Matched on the app's own type alone, deliberately: a returned credential
|
|
89
|
+
* missing the `AppKeyCredential` marker must surface as a parse error from
|
|
90
|
+
* {@link parseSeedCredential}, not as a `null` the caller would read as first
|
|
91
|
+
* run and answer by silently minting a second key.
|
|
92
|
+
*
|
|
69
93
|
* @param options {object}
|
|
70
94
|
* @param options.presentation {IVerifiablePresentation}
|
|
71
95
|
* @param options.credentialType {string} the app's seed-credential type name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seedCredential.d.ts","sourceRoot":"","sources":["../../src/identity/seedCredential.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,8BAA8B,CAAA;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIzD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;CACtB;
|
|
1
|
+
{"version":3,"file":"seedCredential.d.ts","sourceRoot":"","sources":["../../src/identity/seedCredential.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,8BAA8B,CAAA;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIzD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAA;AAIzD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;CACtB;AAwBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAEzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EACN,cAAc,EACf,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,oBAAoB,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;CAC/B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4BjC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,UAAU,EACV,MAAM,EACN,MAAM,EACP,EAAE;IACD,UAAU,EAAE,qBAAqB,CAAA;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,oBAAoB,CAAA;CAC7B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA+ChC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,cAAc,EACf,EAAE;IACD,YAAY,EAAE,uBAAuB,CAAA;IACrC,cAAc,EAAE,MAAM,CAAA;CACvB,GAAG,qBAAqB,GAAG,IAAI,CAY/B"}
|
|
@@ -21,16 +21,33 @@ import { Ed25519Signature2020 } from '@interop/ed25519-signature';
|
|
|
21
21
|
import { deriveIdentity } from './agents.js';
|
|
22
22
|
const VC_1_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1';
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* The marker type every app key carries alongside the app's own
|
|
25
|
+
* `credentialType`, mapped to one stable IRI for every app (NOT interpolated
|
|
26
|
+
* from an app's `vocabBase`). It makes "presents as an app key" a term check
|
|
27
|
+
* rather than a shape heuristic, which is what lets the wallet refuse a
|
|
28
|
+
* foreign app key at store time.
|
|
29
|
+
*
|
|
30
|
+
* It is a self-declaration, not evidence: the `type` array of a planted
|
|
31
|
+
* credential is attacker-controlled like the rest of it. The marker makes the
|
|
32
|
+
* rule precise; the seed-to-DID binding `parseSeedCredential` enforces remains
|
|
33
|
+
* the only thing that authenticates.
|
|
34
|
+
*/
|
|
35
|
+
export const APP_KEY_CREDENTIAL_TYPE = 'AppKeyCredential';
|
|
36
|
+
const APP_KEY_CREDENTIAL_TYPE_IRI = 'urn:was:AppKeyCredential';
|
|
37
|
+
/**
|
|
38
|
+
* Builds the inline context object for the credential's terms, so it stays
|
|
39
|
+
* verifiable with no remote vocabulary fetch. The marker type and the `seed` /
|
|
40
|
+
* `origin` claims carry shared `urn:was:` IRIs -- they mean the same thing for
|
|
41
|
+
* every app, so they do not belong under a per-app `vocabBase`, which keeps
|
|
42
|
+
* only the app's own type term.
|
|
27
43
|
*/
|
|
28
44
|
function seedContext({ credentialType, vocabBase }) {
|
|
29
45
|
return {
|
|
30
46
|
'@protected': true,
|
|
47
|
+
[APP_KEY_CREDENTIAL_TYPE]: APP_KEY_CREDENTIAL_TYPE_IRI,
|
|
31
48
|
[credentialType]: `${vocabBase}${credentialType}`,
|
|
32
|
-
seed:
|
|
33
|
-
origin:
|
|
49
|
+
seed: 'urn:was:seed',
|
|
50
|
+
origin: 'urn:was:origin',
|
|
34
51
|
name: 'https://schema.org/name',
|
|
35
52
|
description: 'https://schema.org/description'
|
|
36
53
|
};
|
|
@@ -68,7 +85,11 @@ export async function issueSeedCredential({ seed, origin, appName, config, docum
|
|
|
68
85
|
const credential = {
|
|
69
86
|
'@context': [VC_1_CONTEXT_URL, seedContext(config)],
|
|
70
87
|
id: `urn:uuid:${crypto.randomUUID()}`,
|
|
71
|
-
type: [
|
|
88
|
+
type: [
|
|
89
|
+
'VerifiableCredential',
|
|
90
|
+
APP_KEY_CREDENTIAL_TYPE,
|
|
91
|
+
config.credentialType
|
|
92
|
+
],
|
|
72
93
|
name: `${appName} app key`,
|
|
73
94
|
description: `The ${appName} app keeps this key in your wallet so it can open your encrypted data on this and other devices.`,
|
|
74
95
|
issuer: controllerDid,
|
|
@@ -86,11 +107,17 @@ export async function issueSeedCredential({ seed, origin, appName, config, docum
|
|
|
86
107
|
}));
|
|
87
108
|
}
|
|
88
109
|
/**
|
|
89
|
-
* Parses a seed credential and enforces the structural contract:
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* credential
|
|
110
|
+
* Parses a seed credential and enforces the structural contract: the shared
|
|
111
|
+
* `AppKeyCredential` marker type, the app's own type, self-issue
|
|
112
|
+
* (issuer === subject id), origin binding, a well-formed 32-byte seed, and --
|
|
113
|
+
* the strongest check -- that the DID derived from the embedded seed IS the
|
|
114
|
+
* credential's subject/issuer DID. (The cryptographic proof on the credential
|
|
115
|
+
* is verified separately at the presentation level.)
|
|
116
|
+
*
|
|
117
|
+
* The marker is required, not merely tolerated: a wallet may only store a
|
|
118
|
+
* credential presenting as an app key when it binds to its own seed, so
|
|
119
|
+
* requiring the marker here keeps both sides on one rule. It weakens nothing,
|
|
120
|
+
* since the seed-to-DID binding below is the boundary either way.
|
|
94
121
|
*
|
|
95
122
|
* @param options {object}
|
|
96
123
|
* @param options.credential {IVerifiableCredential}
|
|
@@ -106,6 +133,10 @@ export async function parseSeedCredential({ credential, origin, config }) {
|
|
|
106
133
|
if (!types.includes(credentialType)) {
|
|
107
134
|
throw new Error(`Credential is not a ${credentialType} credential.`);
|
|
108
135
|
}
|
|
136
|
+
if (!types.includes(APP_KEY_CREDENTIAL_TYPE)) {
|
|
137
|
+
throw new Error(`${credentialType} credential does not carry the ` +
|
|
138
|
+
`${APP_KEY_CREDENTIAL_TYPE} type.`);
|
|
139
|
+
}
|
|
109
140
|
const issuer = typeof credential.issuer === 'string'
|
|
110
141
|
? credential.issuer
|
|
111
142
|
: credential.issuer?.id;
|
|
@@ -133,6 +164,11 @@ export async function parseSeedCredential({ credential, origin, config }) {
|
|
|
133
164
|
* Finds the seed credential inside a wallet response VP, or `null` when the
|
|
134
165
|
* wallet returned none (the first-run signal).
|
|
135
166
|
*
|
|
167
|
+
* Matched on the app's own type alone, deliberately: a returned credential
|
|
168
|
+
* missing the `AppKeyCredential` marker must surface as a parse error from
|
|
169
|
+
* {@link parseSeedCredential}, not as a `null` the caller would read as first
|
|
170
|
+
* run and answer by silently minting a second key.
|
|
171
|
+
*
|
|
136
172
|
* @param options {object}
|
|
137
173
|
* @param options.presentation {IVerifiablePresentation}
|
|
138
174
|
* @param options.credentialType {string} the app's seed-credential type name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seedCredential.js","sourceRoot":"","sources":["../../src/identity/seedCredential.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAKjE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG5C,MAAM,gBAAgB,GAAG,wCAAwC,CAAA;
|
|
1
|
+
{"version":3,"file":"seedCredential.js","sourceRoot":"","sources":["../../src/identity/seedCredential.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAKjE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG5C,MAAM,gBAAgB,GAAG,wCAAwC,CAAA;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAA;AAEzD,MAAM,2BAA2B,GAAG,0BAA0B,CAAA;AAoB9D;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,E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AQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC5E,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,KAAK,GAAI,KAAsC,CAAC,IAAI,CAAA;QAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QACtD,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YACrC,OAAO,KAA8B,CAAA;QACvC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -19,7 +19,17 @@ export interface SeedStore {
|
|
|
19
19
|
*/
|
|
20
20
|
loadRecord(): Promise<unknown | null>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Persists the collection-encryption marker cache (keyed by WAS collection
|
|
23
|
+
* id), so an offline / hot-restore session can rebuild its epoch-aware
|
|
24
|
+
* ciphers without a live description read.
|
|
25
|
+
*/
|
|
26
|
+
saveMarkers(markers: unknown): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Loads the persisted marker cache, or `null`.
|
|
29
|
+
*/
|
|
30
|
+
loadMarkers(): Promise<unknown | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Wipes the seed, the session record, and the marker cache (logout).
|
|
23
33
|
*/
|
|
24
34
|
clearSeedStore(): Promise<void>;
|
|
25
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seedStore.d.ts","sourceRoot":"","sources":["../../src/identity/seedStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seedStore.d.ts","sourceRoot":"","sources":["../../src/identity/seedStore.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA;IACtC;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACrC;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACtC;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,GAAe,EAChB,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,UAAU,CAAA;CACjB,GAAG,SAAS,CAuEZ"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const SESSION_STORE = 'session';
|
|
15
15
|
const SEED_RECORD = 'seed';
|
|
16
16
|
const SESSION_RECORD = 'record';
|
|
17
|
+
const MARKERS_RECORD = 'markers';
|
|
17
18
|
/**
|
|
18
19
|
* Creates a seed store bound to `dbName` and `idb`.
|
|
19
20
|
*
|
|
@@ -65,9 +66,17 @@ export function createSeedStore({ dbName, idb = indexedDB }) {
|
|
|
65
66
|
const stored = await withSessionStore('readonly', store => store.get(SESSION_RECORD));
|
|
66
67
|
return stored ?? null;
|
|
67
68
|
},
|
|
69
|
+
async saveMarkers(markers) {
|
|
70
|
+
await withSessionStore('readwrite', store => store.put(markers, MARKERS_RECORD));
|
|
71
|
+
},
|
|
72
|
+
async loadMarkers() {
|
|
73
|
+
const stored = await withSessionStore('readonly', store => store.get(MARKERS_RECORD));
|
|
74
|
+
return stored ?? null;
|
|
75
|
+
},
|
|
68
76
|
async clearSeedStore() {
|
|
69
77
|
await withSessionStore('readwrite', store => store.delete(SEED_RECORD));
|
|
70
78
|
await withSessionStore('readwrite', store => store.delete(SESSION_RECORD));
|
|
79
|
+
await withSessionStore('readwrite', store => store.delete(MARKERS_RECORD));
|
|
71
80
|
}
|
|
72
81
|
};
|
|
73
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seedStore.js","sourceRoot":"","sources":["../../src/identity/seedStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,SAAS,CAAA;AAC/B,MAAM,WAAW,GAAG,MAAM,CAAA;AAC1B,MAAM,cAAc,GAAG,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"seedStore.js","sourceRoot":"","sources":["../../src/identity/seedStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,SAAS,CAAA;AAC/B,MAAM,WAAW,GAAG,MAAM,CAAA;AAC1B,MAAM,cAAc,GAAG,QAAQ,CAAA;AAC/B,MAAM,cAAc,GAAG,SAAS,CAAA;AAsChC;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,MAAM,EACN,GAAG,GAAG,SAAS,EAIhB;IACC,KAAK,UAAU,aAAa;QAC1B,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;YACnC,OAAO,CAAC,eAAe,GAAG,GAAG,EAAE;gBAC7B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAA;YACjD,CAAC,CAAA;YACD,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACjD,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,C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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, validateCollections, 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, validateSharedCollections, type WasCollectionConfig, type SharedCollectionConfig, type WasSyncConfig, type WasExpiryConfig, type WasAppConfig, type StoreRegistryEntry, type StoreRegistry } from './config.js';
|
|
14
14
|
export { parseInvocationTarget, parseGrants, type ParsedGrants } from './grants.js';
|
|
15
|
-
export { deriveIdentity,
|
|
15
|
+
export { deriveIdentity, DEFAULT_IDENTITY_HANDLE, type IdentityAgents } from './identity/agents.js';
|
|
16
16
|
export { createDocumentLoader, type DocumentLoader } from './identity/documentLoader.js';
|
|
17
17
|
export { createSeedStore, type SeedStore } from './identity/seedStore.js';
|
|
18
|
-
export { issueSeedCredential, parseSeedCredential, findSeedCredential, bytesToBase64url, base64urlToBytes, type SeedCredentialConfig, type ParsedSeedCredential } from './identity/seedCredential.js';
|
|
18
|
+
export { APP_KEY_CREDENTIAL_TYPE, issueSeedCredential, parseSeedCredential, findSeedCredential, bytesToBase64url, base64urlToBytes, type SeedCredentialConfig, type ParsedSeedCredential } from './identity/seedCredential.js';
|
|
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 } from './auth/chapi.js';
|
|
22
|
-
export { RW_ACTIONS, newChallenge, buildAppConnectVpr, type GrantRequestCollection } from './auth/loginRequest.js';
|
|
22
|
+
export { RW_ACTIONS, SHARED_ACTIONS, newChallenge, buildAppConnectVpr, type GrantRequestCollection } from './auth/loginRequest.js';
|
|
23
23
|
export { verifyLoginPresentation, grantsOf, checkGrants, type CheckedGrants } from './auth/verifyResponse.js';
|
|
24
24
|
export { loginWithWallet, requestGrants, LoginCancelledError, WalletUnsupportedError, type LoginConfig, type LoginPhase, type LoginOutcome } from './auth/loginFlow.js';
|
|
25
25
|
export type { WalletAPIMessage, IVPOffer, IVPRequest, IVPRDetails, IVPRQuery, IQueryByExample, IDIDAuthenticationQuery, IZcapQuery, IAppConnectQuery, IAppConnectCapabilityQuery, ICapabilityQueryDetail, WalletResponse, WalletRequestProfile, IVerifiableCredential, IVerifiablePresentation, IZcap } from './auth/walletRequestTypes.js';
|
|
@@ -28,11 +28,12 @@ export { LocalStore } from './storage/localStore.js';
|
|
|
28
28
|
export { setLocalStore, requireStore, hasStore, clearLocalStore, setRemoteStore, requireRemoteStore, hasRemoteStore, clearRemoteStore, getClientId } from './storage/storageManager.js';
|
|
29
29
|
export { createEntityStore, type EntityStore } from './storage/entityStore.js';
|
|
30
30
|
export { WasRemoteStore, type MarkerResult, type EqualityQueryPage } from './storage/wasRemoteStore.js';
|
|
31
|
+
export { SharedCollectionReader, SharedCollectionUnavailableError, SHARED_CHANGES_PAGE_SIZE, type SharedResource } from './storage/sharedCollectionReader.js';
|
|
31
32
|
export { publicUrlFor } from './storage/publicUrl.js';
|
|
32
33
|
export { useSyncStatusStore, deriveSyncRollup, type SyncStatus } from './storage/syncStatusStore.js';
|
|
33
34
|
export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
|
|
34
35
|
export { isAuthError, SyncController, createSyncController } from './storage/syncController.js';
|
|
35
|
-
export { startWasSync } from './storage/wasSync.js';
|
|
36
|
+
export { startWasSync, type WasSyncBootstrap } from './storage/wasSync.js';
|
|
36
37
|
export { createAuthStore, type SessionStatus, type AuthState, type WasAuthStore } from './session/index.js';
|
|
37
|
-
export { WasSessionProvider, WasSessionContext, useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSyncStatus, type SyncRollup, defineDocumentApp, DOCUMENT_COLLECTION_KEY, DOCUMENT_EXPORT_FORMAT, type DocumentApp } from './react/index.js';
|
|
38
|
+
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';
|
|
38
39
|
//# 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,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;
|
|
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,EAC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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,mBAAmB,EACnB,aAAa,EACb,KAAK,UAAU,EACf,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -11,19 +11,20 @@
|
|
|
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, validateCollections } 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, validateSharedCollections } from './config.js';
|
|
15
15
|
// Grant parsing / topology routing.
|
|
16
16
|
export { parseInvocationTarget, parseGrants } from './grants.js';
|
|
17
|
-
// Identity: seed-derived agents
|
|
18
|
-
|
|
17
|
+
// Identity: the seed-derived agents, including the identity key-agreement key
|
|
18
|
+
// every encrypted collection is read with.
|
|
19
|
+
export { deriveIdentity, DEFAULT_IDENTITY_HANDLE } from './identity/agents.js';
|
|
19
20
|
export { createDocumentLoader } from './identity/documentLoader.js';
|
|
20
21
|
export { createSeedStore } from './identity/seedStore.js';
|
|
21
|
-
export { issueSeedCredential, parseSeedCredential, findSeedCredential, bytesToBase64url, base64urlToBytes } from './identity/seedCredential.js';
|
|
22
|
+
export { APP_KEY_CREDENTIAL_TYPE, issueSeedCredential, parseSeedCredential, findSeedCredential, bytesToBase64url, base64urlToBytes } from './identity/seedCredential.js';
|
|
22
23
|
export { initAppSession } from './identity/initAppSession.js';
|
|
23
24
|
export { persistAppSession, restoreAppSession, clearAppSession, isExpired, isNearExpiry, earliestExpiry } from './identity/appSession.js';
|
|
24
25
|
// Auth: CHAPI bridge, VPR construction, response verification, login flow.
|
|
25
26
|
export { DEFAULT_MEDIATOR_BASE, loadChapi, chapiGet } from './auth/chapi.js';
|
|
26
|
-
export { RW_ACTIONS, newChallenge, buildAppConnectVpr } from './auth/loginRequest.js';
|
|
27
|
+
export { RW_ACTIONS, SHARED_ACTIONS, newChallenge, buildAppConnectVpr } from './auth/loginRequest.js';
|
|
27
28
|
export { verifyLoginPresentation, grantsOf, checkGrants } from './auth/verifyResponse.js';
|
|
28
29
|
export { loginWithWallet, requestGrants, LoginCancelledError, WalletUnsupportedError } from './auth/loginFlow.js';
|
|
29
30
|
// The collection-agnostic RxDB-WAS replication core.
|
|
@@ -35,6 +36,7 @@ export { LocalStore } from './storage/localStore.js';
|
|
|
35
36
|
export { setLocalStore, requireStore, hasStore, clearLocalStore, setRemoteStore, requireRemoteStore, hasRemoteStore, clearRemoteStore, getClientId } from './storage/storageManager.js';
|
|
36
37
|
export { createEntityStore } from './storage/entityStore.js';
|
|
37
38
|
export { WasRemoteStore } from './storage/wasRemoteStore.js';
|
|
39
|
+
export { SharedCollectionReader, SharedCollectionUnavailableError, SHARED_CHANGES_PAGE_SIZE } from './storage/sharedCollectionReader.js';
|
|
38
40
|
export { publicUrlFor } from './storage/publicUrl.js';
|
|
39
41
|
export { useSyncStatusStore, deriveSyncRollup } from './storage/syncStatusStore.js';
|
|
40
42
|
export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
|
|
@@ -43,5 +45,5 @@ export { startWasSync } from './storage/wasSync.js';
|
|
|
43
45
|
// Session lifecycle: the session auth store factory (the four-state machine).
|
|
44
46
|
export { createAuthStore } from './session/index.js';
|
|
45
47
|
// React: the session provider + hooks.
|
|
46
|
-
export { WasSessionProvider, WasSessionContext, useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSyncStatus, defineDocumentApp, DOCUMENT_COLLECTION_KEY, DOCUMENT_EXPORT_FORMAT } from './react/index.js';
|
|
48
|
+
export { WasSessionProvider, WasSessionContext, useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSharedCollection, useSyncStatus, defineDocumentApp, DOCUMENT_COLLECTION_KEY, DOCUMENT_EXPORT_FORMAT } from './react/index.js';
|
|
47
49
|
//# 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,kBAAkB,EAClB,mBAAmB,
|
|
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,EAClB,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,EAAE,eAAe,EAAkB,MAAM,yBAAyB,CAAA;AACzE,OAAO,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ACL,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,EAAyB,MAAM,sBAAsB,CAAA;AAE1E,8EAA8E;AAC9E,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAA;AAE3B,uCAAuC;AACvC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,aAAa,EAEb,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,kBAAkB,CAAA"}
|
package/dist/react/hooks.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WasAuthStore } from '../session/authStore.js';
|
|
2
|
+
import type { SharedCollectionReader } from '../storage/sharedCollectionReader.js';
|
|
2
3
|
import { type SyncRollup } from '../storage/syncStatusStore.js';
|
|
3
4
|
/**
|
|
4
5
|
* The bound auth store from the nearest {@link WasSessionProvider}. Throws a
|
|
@@ -70,6 +71,17 @@ export declare function useClearData(): () => Promise<void>;
|
|
|
70
71
|
* @returns {() => Promise<boolean>}
|
|
71
72
|
*/
|
|
72
73
|
export declare function useHasLocalData(): () => Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* The read-only reader over one wallet-owned collection the wallet shared with
|
|
76
|
+
* this app, looked up by its `sharedCollections` config `key`. Returns
|
|
77
|
+
* `undefined` until replication has bootstrapped, and stays `undefined` when the
|
|
78
|
+
* wallet declined the share (or removed it), so a component must handle its
|
|
79
|
+
* absence rather than assume the grant.
|
|
80
|
+
*
|
|
81
|
+
* @param key {string} the shared-collection config key
|
|
82
|
+
* @returns {SharedCollectionReader | undefined}
|
|
83
|
+
*/
|
|
84
|
+
export declare function useSharedCollection(key: string): SharedCollectionReader | undefined;
|
|
73
85
|
/**
|
|
74
86
|
* The expired-access reconnect: the banner flags plus the reconnect action.
|
|
75
87
|
*
|
|
@@ -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,EAGL,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAA;AAEtC;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,YAAY,CAS3C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI;IAC5B,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACtD,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;IAC9D,cAAc,EAAE,OAAO,CAAA;IACvB,KAAK,EAAE,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACpD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;IACtB,YAAY,EAAE,OAAO,CAAA;CACtB,CAgBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI;IAC1B,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE;QAChB,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;KAC1B,KAAK,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAC3C,cAAc,EAAE,OAAO,CAAA;IACvB,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CA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;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,GACV,sBAAsB,GAAG,SAAS,CAGpC;AAED;;;;GAIG;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;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI;IAC/B,KAAK,EAAE,UAAU,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CAKA"}
|
package/dist/react/hooks.js
CHANGED
|
@@ -98,6 +98,20 @@ export function useHasLocalData() {
|
|
|
98
98
|
const store = useAuthStore();
|
|
99
99
|
return useStore(store, state => state.hasLocalData);
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* The read-only reader over one wallet-owned collection the wallet shared with
|
|
103
|
+
* this app, looked up by its `sharedCollections` config `key`. Returns
|
|
104
|
+
* `undefined` until replication has bootstrapped, and stays `undefined` when the
|
|
105
|
+
* wallet declined the share (or removed it), so a component must handle its
|
|
106
|
+
* absence rather than assume the grant.
|
|
107
|
+
*
|
|
108
|
+
* @param key {string} the shared-collection config key
|
|
109
|
+
* @returns {SharedCollectionReader | undefined}
|
|
110
|
+
*/
|
|
111
|
+
export function useSharedCollection(key) {
|
|
112
|
+
const store = useAuthStore();
|
|
113
|
+
return useStore(store, state => state.sharedCollections[key]);
|
|
114
|
+
}
|
|
101
115
|
/**
|
|
102
116
|
* The expired-access reconnect: the banner flags plus the reconnect action.
|
|
103
117
|
*
|
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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KAAK,CAAC,YAAY,CAAC,CAAA;AACrD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CACjC,GAAW;IAEX,MAAM,KAAK,GAAG,YAAY,EAAE,CAAA;IAC5B,OAAO,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAK1B,MAAM,KAAK,GAAG,YAAY,EAAE,CAAA;IAC5B,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAC3D,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,QAAQ,CAC9C,KAAK,EACL,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC,CAAC,CACJ,CAAA;IACD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,CAAA;AACnD,CAAC;AAQD;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa;IAK3B,MAAM,MAAM,GAAG,kBAAkB,CAC/B,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CACnD,CAAA;IACD,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACjC,CAAC"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `./mui` subpath.
|
|
8
8
|
*/
|
|
9
9
|
export { WasSessionProvider, WasSessionContext } from './WasSessionProvider.js';
|
|
10
|
-
export { useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSyncStatus, type SyncRollup } from './hooks.js';
|
|
10
|
+
export { useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSharedCollection, useSyncStatus, type SyncRollup } from './hooks.js';
|
|
11
11
|
export { defineDocumentApp, DOCUMENT_COLLECTION_KEY, DOCUMENT_EXPORT_FORMAT, type DocumentApp } from './documentApp.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,KAAK,UAAU,EAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA"}
|
package/dist/react/index.js
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `./mui` subpath.
|
|
8
8
|
*/
|
|
9
9
|
export { WasSessionProvider, WasSessionContext } from './WasSessionProvider.js';
|
|
10
|
-
export { useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSyncStatus } from './hooks.js';
|
|
10
|
+
export { useAuthStore, useSession, useLogin, useLogout, useClearData, useHasLocalData, useReconnect, useSharedCollection, useSyncStatus } from './hooks.js';
|
|
11
11
|
export { defineDocumentApp, DOCUMENT_COLLECTION_KEY, DOCUMENT_EXPORT_FORMAT } from './documentApp.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EAEd,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,aAAa,EAEd,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,kBAAkB,CAAA"}
|
|
@@ -36,6 +36,7 @@ import { type StoreApi } from 'zustand/vanilla';
|
|
|
36
36
|
import type { RxStorage } from 'rxdb/plugins/core';
|
|
37
37
|
import type { IZcap } from '@interop/data-integrity-core';
|
|
38
38
|
import { type StoreRegistry, type WasAppConfig } from '../config.js';
|
|
39
|
+
import type { SharedCollectionReader } from '../storage/sharedCollectionReader.js';
|
|
39
40
|
import { type SeedStore } from '../identity/seedStore.js';
|
|
40
41
|
import { type LoginPhase } from '../auth/loginFlow.js';
|
|
41
42
|
/**
|
|
@@ -79,6 +80,14 @@ export interface AuthState {
|
|
|
79
80
|
*/
|
|
80
81
|
accessExpired: boolean;
|
|
81
82
|
reconnecting: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The read-only readers over the wallet-owned collections the wallet shared
|
|
85
|
+
* with this app, keyed by the `sharedCollections` config `key`. Populated once
|
|
86
|
+
* replication bootstraps; empty in `local`, and cleared on logout / teardown.
|
|
87
|
+
* A shared collection the wallet declined to grant (or that this app is not a
|
|
88
|
+
* recipient of) is simply absent -- never a session failure.
|
|
89
|
+
*/
|
|
90
|
+
sharedCollections: Record<string, SharedCollectionReader>;
|
|
82
91
|
/**
|
|
83
92
|
* Attempt a zero-popup hot restore; a restore hit lands `connected`, any
|
|
84
93
|
* miss/error falls to `local` (a fresh anonymous replica), never a dead login
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../src/session/authStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../src/session/authStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAA;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