@interop/was-react 0.8.3 → 0.10.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 +50 -44
- package/dist/auth/chapi.d.ts.map +1 -1
- package/dist/auth/chapi.js +5 -4
- package/dist/auth/chapi.js.map +1 -1
- package/dist/auth/loginFlow.d.ts.map +1 -1
- package/dist/auth/loginFlow.js +48 -50
- package/dist/auth/loginFlow.js.map +1 -1
- package/dist/auth/loginRequest.d.ts +38 -5
- package/dist/auth/loginRequest.d.ts.map +1 -1
- package/dist/auth/loginRequest.js +66 -5
- package/dist/auth/loginRequest.js.map +1 -1
- package/dist/auth/verifyResponse.d.ts +7 -4
- package/dist/auth/verifyResponse.d.ts.map +1 -1
- package/dist/auth/verifyResponse.js +23 -13
- package/dist/auth/verifyResponse.js.map +1 -1
- package/dist/auth/walletRequestTypes.d.ts +9 -90
- package/dist/auth/walletRequestTypes.d.ts.map +1 -1
- package/dist/config.d.ts +9 -9
- package/dist/config.js +0 -0
- package/dist/dev/provisionDevGrants.d.ts.map +1 -1
- package/dist/dev/provisionDevGrants.js +18 -19
- package/dist/dev/provisionDevGrants.js.map +1 -1
- package/dist/grants.d.ts +19 -9
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js +17 -2
- package/dist/grants.js.map +1 -1
- package/dist/identity/agents.d.ts +1 -1
- package/dist/identity/agents.d.ts.map +1 -1
- package/dist/identity/agents.js +10 -25
- package/dist/identity/agents.js.map +1 -1
- package/dist/identity/appSession.d.ts +27 -0
- package/dist/identity/appSession.d.ts.map +1 -1
- package/dist/identity/appSession.js +51 -13
- package/dist/identity/appSession.js.map +1 -1
- package/dist/identity/seedCredential.d.ts +7 -0
- package/dist/identity/seedCredential.d.ts.map +1 -1
- package/dist/identity/seedCredential.js +11 -14
- package/dist/identity/seedCredential.js.map +1 -1
- package/dist/identity/seedStore.d.ts +19 -0
- package/dist/identity/seedStore.d.ts.map +1 -1
- package/dist/identity/seedStore.js +40 -13
- package/dist/identity/seedStore.js.map +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/jsonLd.d.ts +19 -0
- package/dist/jsonLd.d.ts.map +1 -0
- package/dist/jsonLd.js +24 -0
- package/dist/jsonLd.js.map +1 -0
- package/dist/mui/AdoptDialog.d.ts.map +1 -1
- package/dist/mui/AdoptDialog.js +7 -3
- package/dist/mui/AdoptDialog.js.map +1 -1
- package/dist/mui/ClearDataDialog.d.ts.map +1 -1
- package/dist/mui/ClearDataDialog.js +12 -11
- package/dist/mui/ClearDataDialog.js.map +1 -1
- package/dist/mui/ConfirmDialog.d.ts +35 -0
- package/dist/mui/ConfirmDialog.d.ts.map +1 -0
- package/dist/mui/ConfirmDialog.js +18 -0
- package/dist/mui/ConfirmDialog.js.map +1 -0
- package/dist/mui/LogoutDialog.d.ts.map +1 -1
- package/dist/mui/LogoutDialog.js +7 -3
- package/dist/mui/LogoutDialog.js.map +1 -1
- package/dist/react/documentApp.d.ts +29 -0
- package/dist/react/documentApp.d.ts.map +1 -1
- package/dist/react/documentApp.js +9 -38
- package/dist/react/documentApp.js.map +1 -1
- package/dist/react/hooks.d.ts +13 -7
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/hooks.js +17 -11
- package/dist/react/hooks.js.map +1 -1
- package/dist/session/authStore.d.ts +9 -9
- package/dist/session/authStore.d.ts.map +1 -1
- package/dist/session/authStore.js +100 -96
- package/dist/session/authStore.js.map +1 -1
- package/dist/storage/adopt.d.ts +5 -1
- package/dist/storage/adopt.d.ts.map +1 -1
- package/dist/storage/adopt.js +8 -24
- package/dist/storage/adopt.js.map +1 -1
- package/dist/storage/entityStore.d.ts.map +1 -1
- package/dist/storage/entityStore.js +27 -20
- package/dist/storage/entityStore.js.map +1 -1
- package/dist/storage/localStore.d.ts +12 -6
- package/dist/storage/localStore.d.ts.map +1 -1
- package/dist/storage/localStore.js +118 -74
- package/dist/storage/localStore.js.map +1 -1
- package/dist/storage/sharedCollectionReader.d.ts +1 -1
- package/dist/storage/sharedCollectionReader.d.ts.map +1 -1
- package/dist/storage/sharedCollectionReader.js +79 -81
- package/dist/storage/sharedCollectionReader.js.map +1 -1
- package/dist/storage/storageManager.d.ts +3 -1
- package/dist/storage/storageManager.d.ts.map +1 -1
- package/dist/storage/storageManager.js +20 -6
- package/dist/storage/storageManager.js.map +1 -1
- package/dist/storage/syncController.d.ts +1 -16
- package/dist/storage/syncController.d.ts.map +1 -1
- package/dist/storage/syncController.js +38 -58
- package/dist/storage/syncController.js.map +1 -1
- package/dist/storage/syncStatusStore.d.ts +8 -6
- package/dist/storage/syncStatusStore.d.ts.map +1 -1
- package/dist/storage/syncStatusStore.js +6 -6
- package/dist/storage/syncStatusStore.js.map +1 -1
- package/dist/storage/wasRemoteStore.d.ts +34 -2
- package/dist/storage/wasRemoteStore.d.ts.map +1 -1
- package/dist/storage/wasRemoteStore.js +45 -7
- package/dist/storage/wasRemoteStore.js.map +1 -1
- package/dist/storage/wasSync.d.ts.map +1 -1
- package/dist/storage/wasSync.js +47 -38
- package/dist/storage/wasSync.js.map +1 -1
- package/dist/sync/changesQuery.d.ts.map +1 -1
- package/dist/sync/changesQuery.js +2 -12
- package/dist/sync/changesQuery.js.map +1 -1
- package/dist/sync/docCipher.d.ts +17 -9
- package/dist/sync/docCipher.d.ts.map +1 -1
- package/dist/sync/docCipher.js +17 -11
- package/dist/sync/docCipher.js.map +1 -1
- package/dist/sync/feedMasterPort.d.ts +6 -0
- package/dist/sync/feedMasterPort.d.ts.map +1 -1
- package/dist/sync/feedMasterPort.js +82 -40
- package/dist/sync/feedMasterPort.js.map +1 -1
- package/dist/sync/index.d.ts +6 -5
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +6 -3
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/lww.d.ts +15 -14
- package/dist/sync/lww.d.ts.map +1 -1
- package/dist/sync/lww.js +3 -3
- package/dist/sync/lww.js.map +1 -1
- package/dist/sync/lwwConflictHandler.d.ts +3 -10
- package/dist/sync/lwwConflictHandler.d.ts.map +1 -1
- package/dist/sync/lwwConflictHandler.js +7 -17
- package/dist/sync/lwwConflictHandler.js.map +1 -1
- package/dist/sync/pushWrites.d.ts +6 -8
- package/dist/sync/pushWrites.d.ts.map +1 -1
- package/dist/sync/pushWrites.js +56 -83
- package/dist/sync/pushWrites.js.map +1 -1
- package/dist/sync/types.d.ts +80 -4
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +36 -18
- package/dist/sync/types.js.map +1 -1
- package/dist/sync/wasSyncPort.d.ts +0 -11
- package/dist/sync/wasSyncPort.d.ts.map +1 -1
- package/dist/sync/wasSyncPort.js +8 -33
- package/dist/sync/wasSyncPort.js.map +1 -1
- package/package.json +5 -5
- package/dist/identity/initAppSession.d.ts +0 -27
- package/dist/identity/initAppSession.d.ts.map +0 -1
- package/dist/identity/initAppSession.js +0 -30
- package/dist/identity/initAppSession.js.map +0 -1
package/dist/identity/agents.js
CHANGED
|
@@ -45,10 +45,7 @@
|
|
|
45
45
|
* Crypto that Node 24 provides.
|
|
46
46
|
*/
|
|
47
47
|
import { CapabilityAgent } from '@interop/webkms-client';
|
|
48
|
-
import {
|
|
49
|
-
import { ZcapClient } from '@interop/ezcap';
|
|
50
|
-
import { X25519KeyAgreementKey2020 } from '@interop/x25519-key-agreement-key';
|
|
51
|
-
import { singleKeyResolver } from '@interop/wallet-core/identity';
|
|
48
|
+
import { agentsFromKeyAgent } from '@interop/wallet-core/identity';
|
|
52
49
|
/**
|
|
53
50
|
* Default cosmetic label for the master identity agent. Local naming only (does
|
|
54
51
|
* not affect key material or the derived did:key); safe to override.
|
|
@@ -68,31 +65,19 @@ const IDENTITY_KEY_NAME = 'app-key';
|
|
|
68
65
|
* @returns {Promise<IdentityAgents>}
|
|
69
66
|
*/
|
|
70
67
|
export async function deriveIdentity({ seed, identityHandle = DEFAULT_IDENTITY_HANDLE }) {
|
|
68
|
+
if (seed.length !== 32) {
|
|
69
|
+
throw new Error(`Master seed must be 32 bytes (got ${seed.length}).`);
|
|
70
|
+
}
|
|
71
71
|
const keyAgent = await CapabilityAgent.fromSeed({
|
|
72
72
|
seed,
|
|
73
73
|
handle: identityHandle,
|
|
74
74
|
keyName: IDENTITY_KEY_NAME
|
|
75
75
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
// The identity KAK: the Ed25519-to-X25519 (Montgomery) conversion of the
|
|
83
|
-
// controller key pair -- the same conversion a wallet applies to the
|
|
84
|
-
// controller did:key when it writes this app into a shared collection's
|
|
85
|
-
// epoch roster.
|
|
86
|
-
const keyAgreementKey = X25519KeyAgreementKey2020.fromEd25519VerificationKey2020({
|
|
87
|
-
keyPair: keyAgent.getVerificationKeyPair()
|
|
88
|
-
});
|
|
89
|
-
const keyResolver = singleKeyResolver({ keyAgreementKey });
|
|
90
|
-
return {
|
|
91
|
-
controllerDid: keyAgent.id,
|
|
92
|
-
keyAgent,
|
|
93
|
-
zcapClient,
|
|
94
|
-
keyAgreementKey,
|
|
95
|
-
keyResolver
|
|
96
|
-
};
|
|
76
|
+
// The assembly (signer, ZcapClient, the Ed25519-to-X25519 Montgomery
|
|
77
|
+
// conversion of the controller key pair, key resolver) is shared with the
|
|
78
|
+
// wallet side via `agentsFromKeyAgent`, so the conversion that both sides of
|
|
79
|
+
// a share must agree on has exactly one implementation. Only the pinned
|
|
80
|
+
// derivation inputs above (seed bytes + keyName) stay local.
|
|
81
|
+
return { ...agentsFromKeyAgent({ keyAgent }), keyAgent };
|
|
97
82
|
}
|
|
98
83
|
//# sourceMappingURL=agents.js.map
|
|
@@ -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;
|
|
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;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,IAAI,EACJ,cAAc,GAAG,uBAAuB,EAIzC;IACC,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;IACvE,CAAC;IACD,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"}
|
|
@@ -32,6 +32,13 @@ export interface AppSessionRecord {
|
|
|
32
32
|
export interface RestoredAppSession extends AppSessionRecord {
|
|
33
33
|
seed: Uint8Array;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* A nominal far-future expiry (ms) standing in for "no expiry": used both for a
|
|
37
|
+
* login that returned no grants (so there is no earliest-expiry to report) and
|
|
38
|
+
* for grants minted without one (dev/test). Well past any near-expiry warning,
|
|
39
|
+
* so the expiry watch never fires against it.
|
|
40
|
+
*/
|
|
41
|
+
export declare const NO_EXPIRY_MS: number;
|
|
35
42
|
/**
|
|
36
43
|
* Whether an ISO `expires` timestamp is in the past (or malformed).
|
|
37
44
|
*/
|
|
@@ -60,6 +67,26 @@ export declare function persistAppSession({ session, store }: {
|
|
|
60
67
|
session: RestoredAppSession;
|
|
61
68
|
store: SeedStore;
|
|
62
69
|
}): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Reads the persisted seed and session record WITHOUT clearing anything and
|
|
72
|
+
* WITHOUT applying the expiry rule -- the reconnect path's read, where the
|
|
73
|
+
* record being past its expiry is the normal case and the seed must survive it
|
|
74
|
+
* (only the grants need renewing). Either half comes back `null` when it is
|
|
75
|
+
* missing or malformed.
|
|
76
|
+
*
|
|
77
|
+
* Use {@link restoreAppSession} for a hot restore instead: it enforces the
|
|
78
|
+
* expiry and wipes a stale record.
|
|
79
|
+
*
|
|
80
|
+
* @param options {object}
|
|
81
|
+
* @param options.store {SeedStore}
|
|
82
|
+
* @returns {Promise<{ seed: Uint8Array | null, record: AppSessionRecord | null }>}
|
|
83
|
+
*/
|
|
84
|
+
export declare function peekAppSession({ store }: {
|
|
85
|
+
store: SeedStore;
|
|
86
|
+
}): Promise<{
|
|
87
|
+
seed: Uint8Array | null;
|
|
88
|
+
record: AppSessionRecord | null;
|
|
89
|
+
}>;
|
|
63
90
|
/**
|
|
64
91
|
* Restores the persisted session, or returns `null` (clearing any stale state)
|
|
65
92
|
* when it is missing, malformed, or expired.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appSession.d.ts","sourceRoot":"","sources":["../../src/identity/appSession.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD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,CAUrC;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACN,EAAE;IACD,KAAK,EAAE,SAAS,CAAA;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhB"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A nominal far-future expiry (ms) standing in for "no expiry": used both for a
|
|
3
|
+
* login that returned no grants (so there is no earliest-expiry to report) and
|
|
4
|
+
* for grants minted without one (dev/test). Well past any near-expiry warning,
|
|
5
|
+
* so the expiry watch never fires against it.
|
|
6
|
+
*/
|
|
7
|
+
export const NO_EXPIRY_MS = 100 * 365 * 24 * 60 * 60 * 1000;
|
|
1
8
|
/**
|
|
2
9
|
* Whether an ISO `expires` timestamp is in the past (or malformed).
|
|
3
10
|
*/
|
|
@@ -53,27 +60,58 @@ export async function persistAppSession({ session, store }) {
|
|
|
53
60
|
await store.saveRecord(record);
|
|
54
61
|
}
|
|
55
62
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
63
|
+
* Whether a value loaded out of a {@link SeedStore} is a structurally complete
|
|
64
|
+
* session record. Says nothing about freshness -- an expired record is still a
|
|
65
|
+
* well-formed one (which is exactly what the reconnect path reads).
|
|
66
|
+
*
|
|
67
|
+
* @param stored {unknown}
|
|
68
|
+
* @returns {boolean}
|
|
69
|
+
*/
|
|
70
|
+
function isAppSessionRecord(stored) {
|
|
71
|
+
const record = stored;
|
|
72
|
+
return (!!record &&
|
|
73
|
+
typeof record.controllerDid === 'string' &&
|
|
74
|
+
typeof record.serverUrl === 'string' &&
|
|
75
|
+
typeof record.spaceId === 'string' &&
|
|
76
|
+
Array.isArray(record.grants) &&
|
|
77
|
+
record.grants.length > 0 &&
|
|
78
|
+
typeof record.expires === 'string');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Reads the persisted seed and session record WITHOUT clearing anything and
|
|
82
|
+
* WITHOUT applying the expiry rule -- the reconnect path's read, where the
|
|
83
|
+
* record being past its expiry is the normal case and the seed must survive it
|
|
84
|
+
* (only the grants need renewing). Either half comes back `null` when it is
|
|
85
|
+
* missing or malformed.
|
|
86
|
+
*
|
|
87
|
+
* Use {@link restoreAppSession} for a hot restore instead: it enforces the
|
|
88
|
+
* expiry and wipes a stale record.
|
|
58
89
|
*
|
|
59
90
|
* @param options {object}
|
|
60
91
|
* @param options.store {SeedStore}
|
|
61
|
-
* @returns {Promise<
|
|
92
|
+
* @returns {Promise<{ seed: Uint8Array | null, record: AppSessionRecord | null }>}
|
|
62
93
|
*/
|
|
63
|
-
export async function
|
|
94
|
+
export async function peekAppSession({ store }) {
|
|
64
95
|
const [seed, stored] = await Promise.all([
|
|
65
96
|
store.loadSeed(),
|
|
66
97
|
store.loadRecord()
|
|
67
98
|
]);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
return {
|
|
100
|
+
seed: seed ?? null,
|
|
101
|
+
record: isAppSessionRecord(stored) ? stored : null
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Restores the persisted session, or returns `null` (clearing any stale state)
|
|
106
|
+
* when it is missing, malformed, or expired.
|
|
107
|
+
*
|
|
108
|
+
* @param options {object}
|
|
109
|
+
* @param options.store {SeedStore}
|
|
110
|
+
* @returns {Promise<RestoredAppSession | null>}
|
|
111
|
+
*/
|
|
112
|
+
export async function restoreAppSession({ store }) {
|
|
113
|
+
const { seed, record } = await peekAppSession({ store });
|
|
114
|
+
if (!seed || !record) {
|
|
77
115
|
return null;
|
|
78
116
|
}
|
|
79
117
|
if (isExpired(record.expires)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appSession.js","sourceRoot":"","sources":["../../src/identity/appSession.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,MAA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Ac,CAAC,EAAE,KAAK,EAAwB;IAIlE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACvC,KAAK,CAAC,QAAQ,EAAE;QAChB,KAAK,CAAC,UAAU,EAAE;KACnB,CAAC,CAAA;IACF,OAAO;QACL,IAAI,EAAE,IAAI,IAAI,IAAI;QAClB,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;KACnD,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,KAAK,EAGN;IACC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IACxD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACrB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAA;AAC5B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,KAAK,EAGN;IACC,MAAM,KAAK,CAAC,cAAc,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IVerifiableCredential, IVerifiablePresentation } from '@interop/data-integrity-core';
|
|
2
|
+
import { type IdentityAgents } from './agents.js';
|
|
2
3
|
import type { DocumentLoader } from './documentLoader.js';
|
|
3
4
|
/**
|
|
4
5
|
* The marker type every app key carries alongside the app's own
|
|
@@ -28,6 +29,12 @@ export interface SeedCredentialConfig {
|
|
|
28
29
|
export interface ParsedSeedCredential {
|
|
29
30
|
seed: Uint8Array;
|
|
30
31
|
controllerDid: string;
|
|
32
|
+
/**
|
|
33
|
+
* The identity agents derived from the embedded seed while checking the
|
|
34
|
+
* seed-to-DID binding. Handed back so the login flow does not derive the same
|
|
35
|
+
* master identity a second time (the derivation is the expensive step).
|
|
36
|
+
*/
|
|
37
|
+
identity: IdentityAgents;
|
|
31
38
|
}
|
|
32
39
|
/**
|
|
33
40
|
* Encodes bytes as base64url (no padding), browser- and Node-safe.
|
|
@@ -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;AAGrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIzD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAA;AAUzD;;;;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;
|
|
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;AAGrC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIzD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAA;AAUzD;;;;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;IACrB;;;;OAIG;IACH,QAAQ,EAAE,cAAc,CAAA;CACzB;AAyBD;;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,CA0BjC;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,CAU/B"}
|
|
@@ -19,6 +19,7 @@ import { base64urlnopad } from '@scure/base';
|
|
|
19
19
|
import * as vc from '@interop/vc';
|
|
20
20
|
import { Ed25519Signature2020 } from '@interop/ed25519-signature';
|
|
21
21
|
import { CONTEXT_V1 } from 'byoe-context';
|
|
22
|
+
import { asArray } from '../jsonLd.js';
|
|
22
23
|
import { deriveIdentity } from './agents.js';
|
|
23
24
|
const VC_1_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1';
|
|
24
25
|
/**
|
|
@@ -85,9 +86,7 @@ export function base64urlToBytes(text) {
|
|
|
85
86
|
* @returns {Promise<IVerifiableCredential>}
|
|
86
87
|
*/
|
|
87
88
|
export async function issueSeedCredential({ seed, origin, appName, config, documentLoader }) {
|
|
88
|
-
|
|
89
|
-
throw new Error(`Master seed must be 32 bytes (got ${seed.length}).`);
|
|
90
|
-
}
|
|
89
|
+
// `deriveIdentity` enforces the 32-byte seed rule.
|
|
91
90
|
const { controllerDid, keyAgent } = await deriveIdentity({ seed });
|
|
92
91
|
const credential = {
|
|
93
92
|
'@context': [VC_1_CONTEXT_URL, seedContext(config)],
|
|
@@ -134,9 +133,7 @@ export async function issueSeedCredential({ seed, origin, appName, config, docum
|
|
|
134
133
|
*/
|
|
135
134
|
export async function parseSeedCredential({ credential, origin, config }) {
|
|
136
135
|
const { credentialType } = config;
|
|
137
|
-
const types =
|
|
138
|
-
? credential.type
|
|
139
|
-
: [credential.type];
|
|
136
|
+
const types = asArray(credential.type);
|
|
140
137
|
if (!types.includes(credentialType)) {
|
|
141
138
|
throw new Error(`Credential is not a ${credentialType} credential.`);
|
|
142
139
|
}
|
|
@@ -161,11 +158,13 @@ export async function parseSeedCredential({ credential, origin, config }) {
|
|
|
161
158
|
if (seed.length !== 32) {
|
|
162
159
|
throw new Error(`${credentialType} seed must decode to 32 bytes (got ${seed.length}).`);
|
|
163
160
|
}
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
// Derived once and handed back on the result: the same agents the caller
|
|
162
|
+
// would otherwise re-derive from this seed right after.
|
|
163
|
+
const identity = await deriveIdentity({ seed });
|
|
164
|
+
if (identity.controllerDid !== subject.id) {
|
|
166
165
|
throw new Error(`${credentialType} seed does not derive the credential subject DID.`);
|
|
167
166
|
}
|
|
168
|
-
return { seed, controllerDid };
|
|
167
|
+
return { seed, controllerDid: identity.controllerDid, identity };
|
|
169
168
|
}
|
|
170
169
|
/**
|
|
171
170
|
* Finds the seed credential inside a wallet response VP, or `null` when the
|
|
@@ -184,11 +183,9 @@ export async function parseSeedCredential({ credential, origin, config }) {
|
|
|
184
183
|
export function findSeedCredential({ presentation, credentialType }) {
|
|
185
184
|
const embedded = presentation
|
|
186
185
|
.verifiableCredential;
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const asArray = Array.isArray(types) ? types : [types];
|
|
191
|
-
if (asArray.includes(credentialType)) {
|
|
186
|
+
for (const entry of asArray(embedded)) {
|
|
187
|
+
const types = asArray(entry.type);
|
|
188
|
+
if (types.includes(credentialType)) {
|
|
192
189
|
return entry;
|
|
193
190
|
}
|
|
194
191
|
}
|
|
@@ -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,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,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,UAAU,EAAE,MAAM,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E,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,YAAY,EACZ,cAAc,EAIf;IACC,MAAM,QAAQ,GAAI,YAAmD;SAClE,oBAAoB,CAAA;IACvB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,OAAO,CAAE,KAAsC,CAAC,IAAI,CAAC,CAAA;QACnE,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YACnC,OAAO,KAA8B,CAAA;QACvC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EncryptionDescriptorCache } from '@interop/wallet-core/descriptors';
|
|
1
2
|
/**
|
|
2
3
|
* The bound seed-store operations returned by `createSeedStore`.
|
|
3
4
|
*/
|
|
@@ -46,4 +47,22 @@ export declare function createSeedStore({ dbName, idb }: {
|
|
|
46
47
|
dbName: string;
|
|
47
48
|
idb?: IDBFactory;
|
|
48
49
|
}): SeedStore;
|
|
50
|
+
/**
|
|
51
|
+
* Presents a {@link SeedStore}'s persisted descriptor record as the
|
|
52
|
+
* `EncryptionDescriptorCache` seam that `@interop/wallet-core/descriptors`
|
|
53
|
+
* acquires through: per-collection get/put over the single stored blob, already
|
|
54
|
+
* scoped to one session's Space by the store it is bound to.
|
|
55
|
+
*
|
|
56
|
+
* The blob is read-modify-written on every put. That is fine at this scale (an
|
|
57
|
+
* app registers a handful of collections) and it is the only shape the existing
|
|
58
|
+
* one-record persistence allows; concurrent puts are serialized through a
|
|
59
|
+
* promise chain so two of them cannot lose one another's entry.
|
|
60
|
+
*
|
|
61
|
+
* @param options {object}
|
|
62
|
+
* @param options.store {SeedStore} the session seed store to persist through
|
|
63
|
+
* @returns {EncryptionDescriptorCache}
|
|
64
|
+
*/
|
|
65
|
+
export declare function createDescriptorCache({ store }: {
|
|
66
|
+
store: SeedStore;
|
|
67
|
+
}): EncryptionDescriptorCache;
|
|
49
68
|
//# sourceMappingURL=seedStore.d.ts.map
|
|
@@ -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":"AAmBA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAOjF;;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,eAAe,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD;;OAEG;IACH,eAAe,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAC1C;;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,CAyEZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACN,EAAE;IACD,KAAK,EAAE,SAAS,CAAA;CACjB,GAAG,yBAAyB,CAmC5B"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Seed persistence: the master seed at rest in the app's own IndexedDB, so a
|
|
6
|
-
* reload restores the session with zero wallet popups. A raw-IndexedDB pattern
|
|
7
|
-
* (one db, one object store, fixed record keys, `db.close()` after every
|
|
8
|
-
* operation). Wiped on logout.
|
|
9
|
-
*
|
|
10
|
-
* `createSeedStore` binds a database name (each app supplies its own) and an
|
|
11
|
-
* optional `idb` factory (injectable for tests, e.g. fake-indexeddb), returning
|
|
12
|
-
* the five bound operations.
|
|
13
|
-
*/
|
|
14
1
|
const SESSION_STORE = 'session';
|
|
15
2
|
const SEED_RECORD = 'seed';
|
|
16
3
|
const SESSION_RECORD = 'record';
|
|
@@ -80,4 +67,44 @@ export function createSeedStore({ dbName, idb = indexedDB }) {
|
|
|
80
67
|
}
|
|
81
68
|
};
|
|
82
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Presents a {@link SeedStore}'s persisted descriptor record as the
|
|
72
|
+
* `EncryptionDescriptorCache` seam that `@interop/wallet-core/descriptors`
|
|
73
|
+
* acquires through: per-collection get/put over the single stored blob, already
|
|
74
|
+
* scoped to one session's Space by the store it is bound to.
|
|
75
|
+
*
|
|
76
|
+
* The blob is read-modify-written on every put. That is fine at this scale (an
|
|
77
|
+
* app registers a handful of collections) and it is the only shape the existing
|
|
78
|
+
* one-record persistence allows; concurrent puts are serialized through a
|
|
79
|
+
* promise chain so two of them cannot lose one another's entry.
|
|
80
|
+
*
|
|
81
|
+
* @param options {object}
|
|
82
|
+
* @param options.store {SeedStore} the session seed store to persist through
|
|
83
|
+
* @returns {EncryptionDescriptorCache}
|
|
84
|
+
*/
|
|
85
|
+
export function createDescriptorCache({ store }) {
|
|
86
|
+
async function readAll() {
|
|
87
|
+
const stored = await store.loadDescriptors();
|
|
88
|
+
if (stored && typeof stored === 'object' && !Array.isArray(stored)) {
|
|
89
|
+
return { ...stored };
|
|
90
|
+
}
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
93
|
+
// Serializes the read-modify-write of the single stored record.
|
|
94
|
+
let writes = Promise.resolve();
|
|
95
|
+
return {
|
|
96
|
+
async readDescriptor({ collectionId }) {
|
|
97
|
+
return (await readAll())[collectionId];
|
|
98
|
+
},
|
|
99
|
+
writeDescriptor({ collectionId, descriptor }) {
|
|
100
|
+
const next = writes.then(async () => {
|
|
101
|
+
const descriptors = await readAll();
|
|
102
|
+
descriptors[collectionId] = descriptor;
|
|
103
|
+
await store.saveDescriptors(descriptors);
|
|
104
|
+
});
|
|
105
|
+
writes = next.then(() => { }, () => { });
|
|
106
|
+
return next;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
83
110
|
//# sourceMappingURL=seedStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seedStore.js","sourceRoot":"","sources":["../../src/identity/seedStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seedStore.js","sourceRoot":"","sources":["../../src/identity/seedStore.ts"],"names":[],"mappings":"AAqBA,MAAM,aAAa,GAAG,SAAS,CAAA;AAC/B,MAAM,WAAW,GAAG,MAAM,CAAA;AAC1B,MAAM,cAAc,GAAG,QAAQ,CAAA;AAC/B,MAAM,kBAAkB,GAAG,aAAa,CAAA;AAsCxC;;;;;;;;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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, DEFAULT_SYNC_POLL_MS, DEFA
|
|
|
14
14
|
export { parseInvocationTarget, parseGrants, type ParsedGrants } from './grants.js';
|
|
15
15
|
export { deriveIdentity, DEFAULT_IDENTITY_HANDLE, type IdentityAgents } from './identity/agents.js';
|
|
16
16
|
export { createDocumentLoader, type DocumentLoader } from './identity/documentLoader.js';
|
|
17
|
-
export { createSeedStore, type SeedStore } from './identity/seedStore.js';
|
|
17
|
+
export { createSeedStore, createDescriptorCache, type SeedStore } from './identity/seedStore.js';
|
|
18
18
|
export { APP_KEY_CREDENTIAL_TYPE, issueSeedCredential, parseSeedCredential, findSeedCredential, bytesToBase64url, base64urlToBytes, type SeedCredentialConfig, type ParsedSeedCredential } from './identity/seedCredential.js';
|
|
19
|
-
export { initAppSession } from './identity/initAppSession.js';
|
|
20
19
|
export { persistAppSession, restoreAppSession, clearAppSession, isExpired, isNearExpiry, earliestExpiry, type AppSessionRecord, type RestoredAppSession } from './identity/appSession.js';
|
|
21
20
|
export { DEFAULT_MEDIATOR_BASE, loadChapi, chapiGet } from './auth/chapi.js';
|
|
22
|
-
export { RW_ACTIONS, SHARED_ACTIONS, newChallenge, buildAppConnectVpr, type GrantRequestCollection } from './auth/loginRequest.js';
|
|
21
|
+
export { RW_ACTIONS, PUBLIC_ACTIONS, SHARED_ACTIONS, actionCeiling, newChallenge, buildAppConnectVpr, type GrantRequestCollection } from './auth/loginRequest.js';
|
|
23
22
|
export { verifyLoginPresentation, grantsOf, checkGrants, type CheckedGrants } from './auth/verifyResponse.js';
|
|
24
23
|
export { loginWithWallet, requestGrants, LoginCancelledError, WalletUnsupportedError, type LoginConfig, type LoginPhase, type LoginOutcome } from './auth/loginFlow.js';
|
|
25
|
-
export type {
|
|
24
|
+
export type { IVPRDetails, IVPRQuery, IDIDAuthenticationQuery, IAppConnectQuery, IAppConnectCapabilityQuery, ICapabilityQueryDetail, IVerifiableCredential, IVerifiablePresentation, IZcap } from './auth/walletRequestTypes.js';
|
|
26
25
|
export * from './sync/index.js';
|
|
27
26
|
export { LocalStore } from './storage/localStore.js';
|
|
28
27
|
export { setLocalStore, requireStore, hasStore, clearLocalStore, setRemoteStore, requireRemoteStore, hasRemoteStore, clearRemoteStore, getClientId } from './storage/storageManager.js';
|
|
29
28
|
export { createEntityStore, type EntityStore } from './storage/entityStore.js';
|
|
30
|
-
export { WasRemoteStore, type DeclarationResult, type EqualityQueryPage } from './storage/wasRemoteStore.js';
|
|
29
|
+
export { WasRemoteStore, remoteDescriptorSource, type DeclarationResult, type EqualityQueryPage } from './storage/wasRemoteStore.js';
|
|
31
30
|
export { SharedCollectionReader, SharedCollectionUnavailableError, SHARED_CHANGES_PAGE_SIZE, type SharedResource } from './storage/sharedCollectionReader.js';
|
|
32
31
|
export { publicUrlFor } from './storage/publicUrl.js';
|
|
33
32
|
export { useSyncStatusStore, deriveSyncRollup, type SyncStatus } from './storage/syncStatusStore.js';
|
|
34
33
|
export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
|
|
35
|
-
export { isAuthError, SyncController
|
|
34
|
+
export { isAuthError, SyncController } from './storage/syncController.js';
|
|
36
35
|
export { startWasSync, type WasSyncBootstrap } from './storage/wasSync.js';
|
|
37
36
|
export { createAuthStore, type SessionStatus, type AuthState, type WasAuthStore } from './session/index.js';
|
|
38
37
|
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';
|
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,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,
|
|
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,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,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,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MAAM,6BAA6B,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,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,UAAU,EAChB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAG1E,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,mBAAmB,EACnB,aAAa,EACb,KAAK,UAAU,EACf,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -18,13 +18,12 @@ export { parseInvocationTarget, parseGrants } from './grants.js';
|
|
|
18
18
|
// every encrypted collection is read with.
|
|
19
19
|
export { deriveIdentity, DEFAULT_IDENTITY_HANDLE } from './identity/agents.js';
|
|
20
20
|
export { createDocumentLoader } from './identity/documentLoader.js';
|
|
21
|
-
export { createSeedStore } from './identity/seedStore.js';
|
|
21
|
+
export { createSeedStore, createDescriptorCache } from './identity/seedStore.js';
|
|
22
22
|
export { APP_KEY_CREDENTIAL_TYPE, issueSeedCredential, parseSeedCredential, findSeedCredential, bytesToBase64url, base64urlToBytes } from './identity/seedCredential.js';
|
|
23
|
-
export { initAppSession } from './identity/initAppSession.js';
|
|
24
23
|
export { persistAppSession, restoreAppSession, clearAppSession, isExpired, isNearExpiry, earliestExpiry } from './identity/appSession.js';
|
|
25
24
|
// Auth: CHAPI bridge, VPR construction, response verification, login flow.
|
|
26
25
|
export { DEFAULT_MEDIATOR_BASE, loadChapi, chapiGet } from './auth/chapi.js';
|
|
27
|
-
export { RW_ACTIONS, SHARED_ACTIONS, newChallenge, buildAppConnectVpr } from './auth/loginRequest.js';
|
|
26
|
+
export { RW_ACTIONS, PUBLIC_ACTIONS, SHARED_ACTIONS, actionCeiling, newChallenge, buildAppConnectVpr } from './auth/loginRequest.js';
|
|
28
27
|
export { verifyLoginPresentation, grantsOf, checkGrants } from './auth/verifyResponse.js';
|
|
29
28
|
export { loginWithWallet, requestGrants, LoginCancelledError, WalletUnsupportedError } from './auth/loginFlow.js';
|
|
30
29
|
// The collection-agnostic RxDB-WAS replication core.
|
|
@@ -35,12 +34,12 @@ export * from './sync/index.js';
|
|
|
35
34
|
export { LocalStore } from './storage/localStore.js';
|
|
36
35
|
export { setLocalStore, requireStore, hasStore, clearLocalStore, setRemoteStore, requireRemoteStore, hasRemoteStore, clearRemoteStore, getClientId } from './storage/storageManager.js';
|
|
37
36
|
export { createEntityStore } from './storage/entityStore.js';
|
|
38
|
-
export { WasRemoteStore } from './storage/wasRemoteStore.js';
|
|
37
|
+
export { WasRemoteStore, remoteDescriptorSource } from './storage/wasRemoteStore.js';
|
|
39
38
|
export { SharedCollectionReader, SharedCollectionUnavailableError, SHARED_CHANGES_PAGE_SIZE } from './storage/sharedCollectionReader.js';
|
|
40
39
|
export { publicUrlFor } from './storage/publicUrl.js';
|
|
41
40
|
export { useSyncStatusStore, deriveSyncRollup } from './storage/syncStatusStore.js';
|
|
42
41
|
export { hydrateAll, clearAllEntityStores, patchFromChange, scheduleRehydrate, cancelScheduledRehydrates } from './storage/rehydrate.js';
|
|
43
|
-
export { isAuthError, SyncController
|
|
42
|
+
export { isAuthError, SyncController } from './storage/syncController.js';
|
|
44
43
|
export { startWasSync } from './storage/wasSync.js';
|
|
45
44
|
// Session lifecycle: the session auth store factory (the four-state machine).
|
|
46
45
|
export { createAuthStore } from './session/index.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,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,
|
|
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,EACL,eAAe,EACf,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AM,8BAA8B,CAAA;AACrC,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACzE,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/jsonLd.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Small JSON-LD shape helpers shared by the identity and auth layers (auth
|
|
6
|
+
* already depends on identity, so this sits above both rather than inside
|
|
7
|
+
* either).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes a JSON-LD term that may appear as a single value, as an array, or
|
|
11
|
+
* not at all into an array. A missing (or otherwise empty) term becomes the
|
|
12
|
+
* empty array. This is the `type` / `proof` / `allowedAction` idiom, in one
|
|
13
|
+
* place.
|
|
14
|
+
*
|
|
15
|
+
* @param value {unknown} the raw term value
|
|
16
|
+
* @returns {Array}
|
|
17
|
+
*/
|
|
18
|
+
export declare function asArray<T>(value: T | T[] | undefined): T[];
|
|
19
|
+
//# sourceMappingURL=jsonLd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLd.d.ts","sourceRoot":"","sources":["../src/jsonLd.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,GAAG,CAAC,EAAE,CAK1D"}
|
package/dist/jsonLd.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Small JSON-LD shape helpers shared by the identity and auth layers (auth
|
|
6
|
+
* already depends on identity, so this sits above both rather than inside
|
|
7
|
+
* either).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes a JSON-LD term that may appear as a single value, as an array, or
|
|
11
|
+
* not at all into an array. A missing (or otherwise empty) term becomes the
|
|
12
|
+
* empty array. This is the `type` / `proof` / `allowedAction` idiom, in one
|
|
13
|
+
* place.
|
|
14
|
+
*
|
|
15
|
+
* @param value {unknown} the raw term value
|
|
16
|
+
* @returns {Array}
|
|
17
|
+
*/
|
|
18
|
+
export function asArray(value) {
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
return value ? [value] : [];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=jsonLd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLd.js","sourceRoot":"","sources":["../src/jsonLd.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CAAI,KAA0B;IACnD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdoptDialog.d.ts","sourceRoot":"","sources":["../../src/mui/AdoptDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AdoptDialog.d.ts","sourceRoot":"","sources":["../../src/mui/AdoptDialog.tsx"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,OAAO,EACR,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,+BAsCA"}
|