@interop/wallet-core 0.22.0 → 0.22.1
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/dist/descriptors/acquire.d.ts +23 -15
- package/dist/descriptors/acquire.d.ts.map +1 -1
- package/dist/descriptors/acquire.js +11 -8
- package/dist/descriptors/acquire.js.map +1 -1
- package/dist/descriptors/cipher.d.ts +5 -2
- package/dist/descriptors/cipher.d.ts.map +1 -1
- package/dist/descriptors/cipher.js +27 -4
- package/dist/descriptors/cipher.js.map +1 -1
- package/dist/descriptors/index.d.ts +6 -2
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +6 -2
- package/dist/descriptors/index.js.map +1 -1
- package/dist/keyring/index.d.ts +8 -3
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +8 -3
- package/dist/keyring/index.js.map +1 -1
- package/dist/keyring/record.d.ts +38 -18
- package/dist/keyring/record.d.ts.map +1 -1
- package/dist/keyring/record.js +44 -15
- package/dist/keyring/record.js.map +1 -1
- package/dist/keys/index.d.ts +1 -0
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +50 -11
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +31 -15
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/recovery/recoveryRecord.d.ts +4 -2
- package/dist/recovery/recoveryRecord.d.ts.map +1 -1
- package/dist/recovery/recoveryRecord.js +2 -1
- package/dist/recovery/recoveryRecord.js.map +1 -1
- package/dist/sync/engine.d.ts +11 -0
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/remint.d.ts +23 -7
- package/dist/sync/remint.d.ts.map +1 -1
- package/dist/sync/remint.js +72 -34
- package/dist/sync/remint.js.map +1 -1
- package/dist/sync/types.d.ts +13 -1
- package/dist/sync/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,11 +4,16 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Collection encryption-descriptor acquisition: reading a collection's
|
|
6
6
|
* `CollectionEncryption` descriptor (its key-epoch roster) from the Collection
|
|
7
|
-
* Description, caching each success, and falling back to the cached copy
|
|
8
|
-
* the description
|
|
9
|
-
* must keep encrypting under its current
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Description, caching each success, and falling back to the cached copy
|
|
8
|
+
* whenever the description yields no descriptor -- whether it could not be
|
|
9
|
+
* fetched at all (offline, a collection must keep encrypting under its current
|
|
10
|
+
* epoch) or came back empty (WAS masks an unauthorized read as an absent one,
|
|
11
|
+
* so an empty description is ambiguous, never an authoritative "no
|
|
12
|
+
* encryption"). `undefined` therefore means only this: nothing, fetched or
|
|
13
|
+
* cached, describes this collection's encryption -- a plaintext collection, or
|
|
14
|
+
* an encrypted one whose epoch[0] install has not landed. A caller that has
|
|
15
|
+
* declared the collection encrypted must refuse fail-closed rather than
|
|
16
|
+
* encrypt without a roster.
|
|
12
17
|
*
|
|
13
18
|
* The two seams are deliberately narrow, so a wallet app's own classes satisfy
|
|
14
19
|
* them structurally -- no adapter needed. An {@link EncryptionDescriptorSource}
|
|
@@ -20,9 +25,11 @@
|
|
|
20
25
|
import type { CollectionEncryption, WasClient } from '@interop/was-client';
|
|
21
26
|
/**
|
|
22
27
|
* Where descriptors come from: one signed read of the collection's
|
|
23
|
-
* Description. Resolves `undefined`
|
|
24
|
-
*
|
|
25
|
-
*
|
|
28
|
+
* Description. Resolves `undefined` when the description carries no encryption
|
|
29
|
+
* member -- which a WAS host also serves for a read this client is not
|
|
30
|
+
* authorized to make, so the absence is ambiguous and callers fall back to a
|
|
31
|
+
* cached copy just as they do for a thrown fetch. Network errors throw through
|
|
32
|
+
* (callers treat the fetch as best-effort).
|
|
26
33
|
*/
|
|
27
34
|
export interface EncryptionDescriptorSource {
|
|
28
35
|
collectionEncryption(options: {
|
|
@@ -59,11 +66,12 @@ export declare function wasDescriptorSource({ was, spaceId }: {
|
|
|
59
66
|
}): EncryptionDescriptorSource;
|
|
60
67
|
/**
|
|
61
68
|
* Acquires one collection's descriptor: fetches it from the source, caching a
|
|
62
|
-
* success; falls back to the cached copy
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
69
|
+
* success; falls back to the cached copy whenever the fetch yields no
|
|
70
|
+
* descriptor (it threw, or it came back empty -- a masked 404 for an
|
|
71
|
+
* unauthorized read looks exactly like an unencrypted collection); and with no
|
|
72
|
+
* source at all (a purely local code path) reads the cache alone. Any cached
|
|
73
|
+
* copy is deliberately left in place, never cleared by an empty fetch.
|
|
74
|
+
* `undefined` means no descriptor exists anywhere for this collection.
|
|
67
75
|
*
|
|
68
76
|
* @param options {object}
|
|
69
77
|
* @param [options.source] {EncryptionDescriptorSource} omit for cache-only
|
|
@@ -71,8 +79,8 @@ export declare function wasDescriptorSource({ was, spaceId }: {
|
|
|
71
79
|
* @param options.cache {EncryptionDescriptorCache}
|
|
72
80
|
* @param options.collectionId {string}
|
|
73
81
|
* @param [options.onFetchError] {function} observes a swallowed fetch
|
|
74
|
-
* failure (the
|
|
75
|
-
* through
|
|
82
|
+
* failure (the thrown-fetch branch only; an empty description is not an
|
|
83
|
+
* error). Errors from the cache itself throw through
|
|
76
84
|
* @returns {Promise<CollectionEncryption | undefined>}
|
|
77
85
|
*/
|
|
78
86
|
export declare function acquireDescriptor({ source, cache, collectionId, onFetchError }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquire.d.ts","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"acquire.d.ts","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,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yBAAyB,CAAA;IAChC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAiBhD"}
|
|
@@ -21,11 +21,12 @@ export function wasDescriptorSource({ was, spaceId }) {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Acquires one collection's descriptor: fetches it from the source, caching a
|
|
24
|
-
* success; falls back to the cached copy
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
24
|
+
* success; falls back to the cached copy whenever the fetch yields no
|
|
25
|
+
* descriptor (it threw, or it came back empty -- a masked 404 for an
|
|
26
|
+
* unauthorized read looks exactly like an unencrypted collection); and with no
|
|
27
|
+
* source at all (a purely local code path) reads the cache alone. Any cached
|
|
28
|
+
* copy is deliberately left in place, never cleared by an empty fetch.
|
|
29
|
+
* `undefined` means no descriptor exists anywhere for this collection.
|
|
29
30
|
*
|
|
30
31
|
* @param options {object}
|
|
31
32
|
* @param [options.source] {EncryptionDescriptorSource} omit for cache-only
|
|
@@ -33,8 +34,8 @@ export function wasDescriptorSource({ was, spaceId }) {
|
|
|
33
34
|
* @param options.cache {EncryptionDescriptorCache}
|
|
34
35
|
* @param options.collectionId {string}
|
|
35
36
|
* @param [options.onFetchError] {function} observes a swallowed fetch
|
|
36
|
-
* failure (the
|
|
37
|
-
* through
|
|
37
|
+
* failure (the thrown-fetch branch only; an empty description is not an
|
|
38
|
+
* error). Errors from the cache itself throw through
|
|
38
39
|
* @returns {Promise<CollectionEncryption | undefined>}
|
|
39
40
|
*/
|
|
40
41
|
export async function acquireDescriptor({ source, cache, collectionId, onFetchError }) {
|
|
@@ -47,7 +48,9 @@ export async function acquireDescriptor({ source, cache, collectionId, onFetchEr
|
|
|
47
48
|
await cache.writeDescriptor({ collectionId, descriptor: fetched });
|
|
48
49
|
return fetched;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
// Empty description: not authoritative (an unauthorized read is masked as
|
|
52
|
+
// an absent one), so a warm cache still serves the collection.
|
|
53
|
+
return cache.readDescriptor({ collectionId });
|
|
51
54
|
}
|
|
52
55
|
catch (err) {
|
|
53
56
|
onFetchError?.(err, { collectionId });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquire.js","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"acquire.js","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AAuDA;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,GAAG,EACH,OAAO,EAIR;IACC,OAAO;QACL,KAAK,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE;YACzC,MAAM,WAAW,GAAG,MAAM,GAAG;iBAC1B,KAAK,CAAC,OAAO,CAAC;iBACd,UAAU,CAAC,YAAY,CAAC;iBACxB,QAAQ,EAAE,CAAA;YACb,OAAO,WAAW,EAAE,UAAU,IAAI,SAAS,CAAA;QAC7C,CAAC;KACF,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,MAAM,EACN,KAAK,EACL,YAAY,EACZ,YAAY,EAMb;IACC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;IAC/C,CAAC;IACD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;QACnE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,KAAK,CAAC,eAAe,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAA;YAClE,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,0EAA0E;QAC1E,+DAA+D;QAC/D,OAAO,KAAK,CAAC,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;IAC/C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,CAAC,CAAA;QACrC,OAAO,KAAK,CAAC,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,MAAM,EACN,KAAK,EACL,aAAa,EACb,YAAY,EAMb;IACC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,aAAa,CAAC,GAAG,CACf,KAAK,EAAC,YAAY,EAAC,EAAE,CACnB;QACE,YAAY;QACZ,MAAM,iBAAiB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;KAC9D,CACb,CACF,CAAA;IACD,MAAM,WAAW,GAAyC,EAAE,CAAA;IAC5D,KAAK,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,IAAI,QAAQ,EAAE,CAAC;QAClD,IAAI,UAAU,EAAE,CAAC;YACf,WAAW,CAAC,YAAY,CAAC,GAAG,UAAU,CAAA;QACxC,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* conflict resolver) rather than a row-scanning store.
|
|
9
9
|
*
|
|
10
10
|
* Built, the cipher acquires the collection's descriptor (fetch, cache the
|
|
11
|
-
* success, cached fallback
|
|
11
|
+
* success, cached fallback whenever the fetch yields none -- see
|
|
12
|
+
* `acquire.ts`) and constructs the
|
|
12
13
|
* underlying EDV cipher from it; with no descriptor, or a descriptor with no
|
|
13
14
|
* epochs, the build refuses fail-closed (every encrypted collection's
|
|
14
15
|
* descriptor carries an epoch roster from provisioning, so the absence can
|
|
@@ -18,7 +19,9 @@
|
|
|
18
19
|
* and retries that decrypt exactly once -- and only once per cipher instance,
|
|
19
20
|
* which the host scopes to one `(profile, collection)` session by dropping
|
|
20
21
|
* its cipher cache when the session ends. A second failure (or any unknown
|
|
21
|
-
* epoch after the one refresh is spent) propagates.
|
|
22
|
+
* epoch after the one refresh is spent) propagates. A refresh that itself
|
|
23
|
+
* fails does not count as spent -- the original `UnknownEpochError` is
|
|
24
|
+
* rethrown and a later decrypt may try again.
|
|
22
25
|
*/
|
|
23
26
|
import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-core';
|
|
24
27
|
import { type DocCipher } from '@interop/was-client/edv';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cipher.d.ts","sourceRoot":"","sources":["../../src/descriptors/cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"cipher.d.ts","sourceRoot":"","sources":["../../src/descriptors/cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,4BAA4B,CAAC,EACjD,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,EACb,EAAE;IACD,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IACnC,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,SAAS,CAAC,CAoFrB"}
|
|
@@ -64,10 +64,33 @@ export async function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolve
|
|
|
64
64
|
if (!(err instanceof UnknownEpochError) || !source) {
|
|
65
65
|
throw err;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
if (!refreshed) {
|
|
68
|
+
const attempt = build().then(cipher => {
|
|
69
|
+
inner = cipher;
|
|
70
|
+
});
|
|
71
|
+
refreshed = attempt;
|
|
72
|
+
// Only a COMPLETED refresh is spent. A rejected one (the description
|
|
73
|
+
// could not be read and no cached copy answered either) un-arms the
|
|
74
|
+
// guard so a later unknown-epoch decrypt may try again; a successful
|
|
75
|
+
// refresh that still cannot route the envelope stays spent for the
|
|
76
|
+
// session, which is what keeps a genuinely foreign envelope from
|
|
77
|
+
// driving a refetch loop.
|
|
78
|
+
attempt.catch(() => {
|
|
79
|
+
if (refreshed === attempt) {
|
|
80
|
+
refreshed = null;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
await refreshed;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// The refresh failed, so nothing was learned about this envelope's
|
|
89
|
+
// epoch: surface the original UnknownEpochError rather than the
|
|
90
|
+
// build failure, so callers classifying on it (the create-loss
|
|
91
|
+
// re-mint) still see the row they exist to repair.
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
71
94
|
// One retry under the swapped cipher. If the refresh was already
|
|
72
95
|
// spent before this decrypt began, this re-attempt is a local
|
|
73
96
|
// no-network decrypt that fails the same way -- so a genuinely
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cipher.js","sourceRoot":"","sources":["../../src/descriptors/cipher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cipher.js","sourceRoot":"","sources":["../../src/descriptors/cipher.ts"],"names":[],"mappings":"AA6BA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,EASb;IACC,MAAM,KAAK,GAAG,KAAK,IAAwB,EAAE;QAC3C,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC;YACzC,MAAM;YACN,KAAK;YACL,YAAY;YACZ,YAAY;SACb,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,eAAe,YAAY,2CAA2C;gBACpE,kEAAkE;gBAClE,oEAAoE,CACvE,CAAA;QACH,CAAC;QACD,OAAO,kBAAkB,CAAC;YACxB,eAAe;YACf,WAAW;YACX,YAAY;YACZ,YAAY;YACZ,UAAU;SACX,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,IAAI,KAAK,GAAG,MAAM,KAAK,EAAE,CAAA;IACzB,0EAA0E;IAC1E,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,SAAS,GAAyB,IAAI,CAAA;IAE1C,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAE1C,aAAa,EAAE,OAAO,CAAC,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;gBACzB,MAA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AC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
* - `wasDescriptorSource` -- the `EncryptionDescriptorSource` over a
|
|
16
16
|
* was-client handle.
|
|
17
17
|
* - `acquireDescriptor` / `acquireDescriptors` -- fetch + cache with the
|
|
18
|
-
* cached fallback
|
|
19
|
-
* under its current epoch;
|
|
18
|
+
* cached fallback whenever the fetch yields no descriptor, thrown or empty
|
|
19
|
+
* (offline, a collection keeps encrypting under its current epoch; an empty
|
|
20
|
+
* description is ambiguous, since WAS masks an unauthorized read as an
|
|
21
|
+
* absent one). No descriptor anywhere means a plaintext collection, or an
|
|
22
|
+
* encrypted one whose epoch[0] install has not landed -- which a caller that
|
|
23
|
+
* has declared the collection encrypted must refuse fail-closed.
|
|
20
24
|
* - `DescriptorRefreshPolicy` -- the once-per-collection-per-session
|
|
21
25
|
* unknown-epoch refresh guard, plus the refresh-and-re-read-once wrapper
|
|
22
26
|
* for hosts whose reads scan rows and count unknown-epoch skips.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
* - `wasDescriptorSource` -- the `EncryptionDescriptorSource` over a
|
|
16
16
|
* was-client handle.
|
|
17
17
|
* - `acquireDescriptor` / `acquireDescriptors` -- fetch + cache with the
|
|
18
|
-
* cached fallback
|
|
19
|
-
* under its current epoch;
|
|
18
|
+
* cached fallback whenever the fetch yields no descriptor, thrown or empty
|
|
19
|
+
* (offline, a collection keeps encrypting under its current epoch; an empty
|
|
20
|
+
* description is ambiguous, since WAS masks an unauthorized read as an
|
|
21
|
+
* absent one). No descriptor anywhere means a plaintext collection, or an
|
|
22
|
+
* encrypted one whose epoch[0] install has not landed -- which a caller that
|
|
23
|
+
* has declared the collection encrypted must refuse fail-closed.
|
|
20
24
|
* - `DescriptorRefreshPolicy` -- the once-per-collection-per-session
|
|
21
25
|
* unknown-epoch refresh guard, plus the refresh-and-re-read-once wrapper
|
|
22
26
|
* for hosts whose reads scan rows and count unknown-epoch skips.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAMrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/keyring/index.d.ts
CHANGED
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
* wire-level unlock derivation (implemented over `@noble/hashes`, so it runs
|
|
11
11
|
* unchanged where WebCrypto's `deriveBits` is unavailable) and the unlock
|
|
12
12
|
* Space addressing convention.
|
|
13
|
-
* - `wrapKeyringRecord` / `unwrapKeyringRecord` -- the
|
|
14
|
-
* account-pointer record codec.
|
|
13
|
+
* - `wrapKeyringRecord` / `unwrapKeyringRecord` -- the
|
|
14
|
+
* `{ version, encryption, wrapped }` account-pointer record codec.
|
|
15
|
+
* - `mintRecordEncryption` / `recordCipher` / `parseRecordFrame` -- the
|
|
16
|
+
* record-own-epoch envelope construction the codec seals with plus the frame
|
|
17
|
+
* validation it opens with, exported so an app's own locally stored records
|
|
18
|
+
* seal and unseal the same way (under their own cipher context) rather than
|
|
19
|
+
* re-deriving the construction.
|
|
15
20
|
* - `ensureUnlockSpace` / `getUnlockKeyring` / `putUnlockKeyring` /
|
|
16
21
|
* `deleteUnlockSpace` / `deleteUnlockSpaceWithCapability` -- the unlock
|
|
17
22
|
* Space's lifecycle and its one resource.
|
|
@@ -23,7 +28,7 @@
|
|
|
23
28
|
*/
|
|
24
29
|
export { deriveUnlockIdentity, KEYRING_KDF, UNLOCK_HANDLE, UNLOCK_KEY_NAME, unlockSpaceIdFor } from './kdf.js';
|
|
25
30
|
export type { UnlockIdentity, UnlockKdf } from './kdf.js';
|
|
26
|
-
export { KEYRING_RECORD_VERSION, parseRecordPointer, unwrapKeyringRecord, wrapKeyringRecord } from './record.js';
|
|
31
|
+
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordFrame, parseRecordPointer, recordCipher, unwrapKeyringRecord, wrapKeyringRecord } from './record.js';
|
|
27
32
|
export type { AccountPointer, KeyringRecordContents } from './record.js';
|
|
28
33
|
export { deleteUnlockSpace, deleteUnlockSpaceWithCapability, ensureUnlockSpace, getUnlockKeyring, putUnlockKeyring, putUnlockKeyringWithCapability, UNLOCK_SPACE_NAME } from './unlockSpace.js';
|
|
29
34
|
export { fetchKeyringRecord } from './fetch.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExE,OAAO,EACL,iBAAiB,EACjB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,8BAA8B,EAC9B,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/keyring/index.js
CHANGED
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
* wire-level unlock derivation (implemented over `@noble/hashes`, so it runs
|
|
11
11
|
* unchanged where WebCrypto's `deriveBits` is unavailable) and the unlock
|
|
12
12
|
* Space addressing convention.
|
|
13
|
-
* - `wrapKeyringRecord` / `unwrapKeyringRecord` -- the
|
|
14
|
-
* account-pointer record codec.
|
|
13
|
+
* - `wrapKeyringRecord` / `unwrapKeyringRecord` -- the
|
|
14
|
+
* `{ version, encryption, wrapped }` account-pointer record codec.
|
|
15
|
+
* - `mintRecordEncryption` / `recordCipher` / `parseRecordFrame` -- the
|
|
16
|
+
* record-own-epoch envelope construction the codec seals with plus the frame
|
|
17
|
+
* validation it opens with, exported so an app's own locally stored records
|
|
18
|
+
* seal and unseal the same way (under their own cipher context) rather than
|
|
19
|
+
* re-deriving the construction.
|
|
15
20
|
* - `ensureUnlockSpace` / `getUnlockKeyring` / `putUnlockKeyring` /
|
|
16
21
|
* `deleteUnlockSpace` / `deleteUnlockSpaceWithCapability` -- the unlock
|
|
17
22
|
* Space's lifecycle and its one resource.
|
|
@@ -22,7 +27,7 @@
|
|
|
22
27
|
* was-client dependency graph (the same isolation pattern as `./identity`).
|
|
23
28
|
*/
|
|
24
29
|
export { deriveUnlockIdentity, KEYRING_KDF, UNLOCK_HANDLE, UNLOCK_KEY_NAME, unlockSpaceIdFor } from './kdf.js';
|
|
25
|
-
export { KEYRING_RECORD_VERSION, parseRecordPointer, unwrapKeyringRecord, wrapKeyringRecord } from './record.js';
|
|
30
|
+
export { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordFrame, parseRecordPointer, recordCipher, unwrapKeyringRecord, wrapKeyringRecord } from './record.js';
|
|
26
31
|
export { deleteUnlockSpace, deleteUnlockSpaceWithCapability, ensureUnlockSpace, getUnlockKeyring, putUnlockKeyring, putUnlockKeyringWithCapability, UNLOCK_SPACE_NAME } from './unlockSpace.js';
|
|
27
32
|
export { fetchKeyringRecord } from './fetch.js';
|
|
28
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,iBAAiB,EACjB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,8BAA8B,EAC9B,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/keyring/record.d.ts
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* account pointer -- and deliberately no key material of any kind, so the
|
|
9
9
|
* record locates an account without authorizing anything against it.
|
|
10
10
|
*
|
|
11
|
-
* The wrap is an EDV document envelope
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* The wrap is an EDV document envelope sealed under the record's own key
|
|
12
|
+
* epoch: every EDV envelope seals to an epoch key, so the record carries its
|
|
13
|
+
* one-epoch descriptor in its `encryption` member, epoch[0] wrapped to the
|
|
14
|
+
* unlock key-agreement key. The record stays self-contained -- unlock KAK in,
|
|
15
|
+
* contents out. The cipher's `keyring` collection context labels errors only
|
|
16
|
+
* (the codec is agnostic to it); what keeps a swapped-in foreign record from
|
|
17
|
+
* being accepted is the contents validation on unwrap, not the cipher.
|
|
17
18
|
*/
|
|
18
19
|
import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-core';
|
|
19
20
|
import type { CollectionEncryption } from '@interop/was-client';
|
|
@@ -27,45 +28,63 @@ import { type DocCipher } from '@interop/was-client/edv';
|
|
|
27
28
|
export declare const KEYRING_RECORD_VERSION = 1;
|
|
28
29
|
/**
|
|
29
30
|
* Mints the one-epoch descriptor a fresh record is sealed under: epoch[0]
|
|
30
|
-
* wrapped to the
|
|
31
|
+
* wrapped to the given KAK alone, built through `initRecipients` against a
|
|
31
32
|
* throwaway in-memory store (the descriptor's home is the record itself).
|
|
33
|
+
* Exported for any consumer sealing a self-contained
|
|
34
|
+
* `{ version, encryption, wrapped }` record -- the keyring and recovery
|
|
35
|
+
* records here, and a wallet app's own locally stored records (e.g.
|
|
36
|
+
* freewallet's client-key record and unlock-methods registry).
|
|
32
37
|
*
|
|
33
38
|
* @param options {object}
|
|
34
|
-
* @param options.keyAgreementKey {IKeyAgreementKey} the
|
|
39
|
+
* @param options.keyAgreementKey {IKeyAgreementKey} the wrapping KAK (for
|
|
40
|
+
* the keyring record, the unlock KAK)
|
|
35
41
|
* @returns {Promise<CollectionEncryption>}
|
|
36
42
|
*/
|
|
37
43
|
export declare function mintRecordEncryption({ keyAgreementKey }: {
|
|
38
44
|
keyAgreementKey: IKeyAgreementKey;
|
|
39
45
|
}): Promise<CollectionEncryption>;
|
|
40
46
|
/**
|
|
41
|
-
* Builds the record cipher:
|
|
42
|
-
*
|
|
43
|
-
*
|
|
47
|
+
* Builds the record cipher: an EDV cipher over the record's own descriptor.
|
|
48
|
+
* Shared by the wrap and unwrap paths (and by the recovery record, which
|
|
49
|
+
* reuses the keyring cipher context verbatim); an app's own record kind
|
|
50
|
+
* passes its own `collectionId` so its failures name the record kind. The
|
|
51
|
+
* context labels errors only -- the codec is agnostic to it, so a record
|
|
52
|
+
* kind's real swap protection is its contents validation on unwrap.
|
|
44
53
|
*
|
|
45
54
|
* @param options {object}
|
|
46
|
-
* @param options.keyAgreementKey {IKeyAgreementKey} the
|
|
55
|
+
* @param options.keyAgreementKey {IKeyAgreementKey} the wrapping KAK (for
|
|
56
|
+
* the keyring record, the unlock KAK)
|
|
47
57
|
* @param options.keyResolver {IKeyResolver}
|
|
48
58
|
* @param options.encryption {CollectionEncryption} the record's descriptor
|
|
59
|
+
* @param [options.collectionId] {string} the cipher context failures are
|
|
60
|
+
* labeled with; defaults to the keyring context
|
|
49
61
|
* @returns {Promise<DocCipher>}
|
|
50
62
|
*/
|
|
51
|
-
export declare function recordCipher({ keyAgreementKey, keyResolver, encryption }: {
|
|
63
|
+
export declare function recordCipher({ keyAgreementKey, keyResolver, encryption, collectionId }: {
|
|
52
64
|
keyAgreementKey: IKeyAgreementKey;
|
|
53
65
|
keyResolver: IKeyResolver;
|
|
54
66
|
encryption: CollectionEncryption;
|
|
67
|
+
collectionId?: string;
|
|
55
68
|
}): Promise<DocCipher>;
|
|
56
69
|
/**
|
|
57
70
|
* Validates the common `{ version, encryption, wrapped }` frame of a stored
|
|
58
71
|
* record (keyring or recovery -- `label` names the refusals) and returns its
|
|
59
|
-
* members.
|
|
72
|
+
* members. Exported so an app's own record kinds open their records through
|
|
73
|
+
* the same frame validation the codec here seals with, rather than re-deriving
|
|
74
|
+
* the version and shape checks.
|
|
60
75
|
*
|
|
61
76
|
* @param options {object}
|
|
62
77
|
* @param options.record {unknown}
|
|
63
|
-
* @param options.label {string} `'keyring'
|
|
78
|
+
* @param options.label {string} `'keyring'`, `'recovery'`, or an app record
|
|
79
|
+
* kind's own label
|
|
80
|
+
* @param [options.version] {number} the version the frame must carry;
|
|
81
|
+
* defaults to the keyring record version
|
|
64
82
|
* @returns {{ encryption: CollectionEncryption, wrapped: unknown }}
|
|
65
83
|
*/
|
|
66
|
-
export declare function parseRecordFrame({ record, label }: {
|
|
84
|
+
export declare function parseRecordFrame({ record, label, version }: {
|
|
67
85
|
record: unknown;
|
|
68
86
|
label: string;
|
|
87
|
+
version?: number;
|
|
69
88
|
}): {
|
|
70
89
|
encryption: CollectionEncryption;
|
|
71
90
|
wrapped: unknown;
|
|
@@ -106,7 +125,8 @@ export interface KeyringRecordContents {
|
|
|
106
125
|
* no-WAS deployments)
|
|
107
126
|
* @param options.keyAgreementKey {IKeyAgreementKey} the unlock KAK
|
|
108
127
|
* @param options.keyResolver {IKeyResolver}
|
|
109
|
-
* @returns {Promise<{ version: number, encryption:
|
|
128
|
+
* @returns {Promise<{ version: number, encryption: CollectionEncryption,
|
|
129
|
+
* wrapped: unknown }>}
|
|
110
130
|
*/
|
|
111
131
|
export declare function wrapKeyringRecord({ controller, email, pointer, keyAgreementKey, keyResolver }: {
|
|
112
132
|
controller: string;
|
|
@@ -116,7 +136,7 @@ export declare function wrapKeyringRecord({ controller, email, pointer, keyAgree
|
|
|
116
136
|
keyResolver: IKeyResolver;
|
|
117
137
|
}): Promise<{
|
|
118
138
|
version: number;
|
|
119
|
-
encryption:
|
|
139
|
+
encryption: CollectionEncryption;
|
|
120
140
|
wrapped: unknown;
|
|
121
141
|
}>;
|
|
122
142
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/keyring/record.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/keyring/record.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,yBAAyB,CAAA;AAGhC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,eAAe,EAChB,EAAE;IACD,eAAe,EAAE,gBAAgB,CAAA;CAClC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAiBhC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAAC,EACjC,eAAe,EACf,WAAW,EACX,UAAU,EACV,YAAoC,EACrC,EAAE;IACD,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;IACzB,UAAU,EAAE,oBAAoB,CAAA;IAChC,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,OAAO,CAAC,SAAS,CAAC,CAOrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,KAAK,EACL,OAAgC,EACjC,EAAE;IACD,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG;IAAE,UAAU,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAoCzD;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,UAAU,EACV,KAAK,EACL,OAAO,EACP,eAAe,EACf,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;CAC1B,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,oBAAoB,CAAA;IAChC,OAAO,EAAE,OAAO,CAAA;CACjB,CAAC,CAwBD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EACN,eAAe,EACf,WAAW,EACZ,EAAE;IACD,MAAM,EAAE,OAAO,CAAA;IACf,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;CAC1B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAgCjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAsB7E"}
|
package/dist/keyring/record.js
CHANGED
|
@@ -9,11 +9,16 @@ import { KEYRING_COLLECTION } from '../space/collections.js';
|
|
|
9
9
|
export const KEYRING_RECORD_VERSION = 1;
|
|
10
10
|
/**
|
|
11
11
|
* Mints the one-epoch descriptor a fresh record is sealed under: epoch[0]
|
|
12
|
-
* wrapped to the
|
|
12
|
+
* wrapped to the given KAK alone, built through `initRecipients` against a
|
|
13
13
|
* throwaway in-memory store (the descriptor's home is the record itself).
|
|
14
|
+
* Exported for any consumer sealing a self-contained
|
|
15
|
+
* `{ version, encryption, wrapped }` record -- the keyring and recovery
|
|
16
|
+
* records here, and a wallet app's own locally stored records (e.g.
|
|
17
|
+
* freewallet's client-key record and unlock-methods registry).
|
|
14
18
|
*
|
|
15
19
|
* @param options {object}
|
|
16
|
-
* @param options.keyAgreementKey {IKeyAgreementKey} the
|
|
20
|
+
* @param options.keyAgreementKey {IKeyAgreementKey} the wrapping KAK (for
|
|
21
|
+
* the keyring record, the unlock KAK)
|
|
17
22
|
* @returns {Promise<CollectionEncryption>}
|
|
18
23
|
*/
|
|
19
24
|
export async function mintRecordEncryption({ keyAgreementKey }) {
|
|
@@ -35,41 +40,64 @@ export async function mintRecordEncryption({ keyAgreementKey }) {
|
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
38
|
-
* Builds the record cipher:
|
|
39
|
-
*
|
|
40
|
-
*
|
|
43
|
+
* Builds the record cipher: an EDV cipher over the record's own descriptor.
|
|
44
|
+
* Shared by the wrap and unwrap paths (and by the recovery record, which
|
|
45
|
+
* reuses the keyring cipher context verbatim); an app's own record kind
|
|
46
|
+
* passes its own `collectionId` so its failures name the record kind. The
|
|
47
|
+
* context labels errors only -- the codec is agnostic to it, so a record
|
|
48
|
+
* kind's real swap protection is its contents validation on unwrap.
|
|
41
49
|
*
|
|
42
50
|
* @param options {object}
|
|
43
|
-
* @param options.keyAgreementKey {IKeyAgreementKey} the
|
|
51
|
+
* @param options.keyAgreementKey {IKeyAgreementKey} the wrapping KAK (for
|
|
52
|
+
* the keyring record, the unlock KAK)
|
|
44
53
|
* @param options.keyResolver {IKeyResolver}
|
|
45
54
|
* @param options.encryption {CollectionEncryption} the record's descriptor
|
|
55
|
+
* @param [options.collectionId] {string} the cipher context failures are
|
|
56
|
+
* labeled with; defaults to the keyring context
|
|
46
57
|
* @returns {Promise<DocCipher>}
|
|
47
58
|
*/
|
|
48
|
-
export async function recordCipher({ keyAgreementKey, keyResolver, encryption }) {
|
|
59
|
+
export async function recordCipher({ keyAgreementKey, keyResolver, encryption, collectionId = KEYRING_COLLECTION.id }) {
|
|
49
60
|
return createEdvDocCipher({
|
|
50
61
|
keyAgreementKey,
|
|
51
62
|
keyResolver,
|
|
52
|
-
collectionId
|
|
63
|
+
collectionId,
|
|
53
64
|
encryption
|
|
54
65
|
});
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
68
|
* Validates the common `{ version, encryption, wrapped }` frame of a stored
|
|
58
69
|
* record (keyring or recovery -- `label` names the refusals) and returns its
|
|
59
|
-
* members.
|
|
70
|
+
* members. Exported so an app's own record kinds open their records through
|
|
71
|
+
* the same frame validation the codec here seals with, rather than re-deriving
|
|
72
|
+
* the version and shape checks.
|
|
60
73
|
*
|
|
61
74
|
* @param options {object}
|
|
62
75
|
* @param options.record {unknown}
|
|
63
|
-
* @param options.label {string} `'keyring'
|
|
76
|
+
* @param options.label {string} `'keyring'`, `'recovery'`, or an app record
|
|
77
|
+
* kind's own label
|
|
78
|
+
* @param [options.version] {number} the version the frame must carry;
|
|
79
|
+
* defaults to the keyring record version
|
|
64
80
|
* @returns {{ encryption: CollectionEncryption, wrapped: unknown }}
|
|
65
81
|
*/
|
|
66
|
-
export function parseRecordFrame({ record, label }) {
|
|
82
|
+
export function parseRecordFrame({ record, label, version = KEYRING_RECORD_VERSION }) {
|
|
67
83
|
if (record === null || typeof record !== 'object') {
|
|
68
84
|
throw new Error(`Malformed ${label} record.`);
|
|
69
85
|
}
|
|
70
|
-
const { version, encryption, wrapped } = record;
|
|
71
|
-
if (
|
|
72
|
-
throw new Error(`Unsupported ${label} record version "${String(
|
|
86
|
+
const { version: recordVersion, encryption, wrapped } = record;
|
|
87
|
+
if (recordVersion !== version) {
|
|
88
|
+
throw new Error(`Unsupported ${label} record version "${String(recordVersion)}".`);
|
|
89
|
+
}
|
|
90
|
+
if (wrapped === undefined || wrapped === null) {
|
|
91
|
+
throw new Error(`Malformed ${label} record.`);
|
|
92
|
+
}
|
|
93
|
+
// A version-1 frame carrying a wrap but no descriptor is the retired
|
|
94
|
+
// pre-extraction record shape, which shipped under this same version number
|
|
95
|
+
// and wrapped a data seed. It is unusable, not merely damaged -- name the
|
|
96
|
+
// shape so the refusal is not read as corruption.
|
|
97
|
+
if (encryption === undefined && version === KEYRING_RECORD_VERSION) {
|
|
98
|
+
throw new Error(`The ${label} record uses the retired pre-extraction version 1 shape ` +
|
|
99
|
+
'(a data-seed wrap with no encryption descriptor); such accounts are ' +
|
|
100
|
+
're-provisioned, not migrated.');
|
|
73
101
|
}
|
|
74
102
|
if (encryption === null || typeof encryption !== 'object') {
|
|
75
103
|
throw new Error(`The ${label} record is missing its encryption descriptor.`);
|
|
@@ -89,7 +117,8 @@ export function parseRecordFrame({ record, label }) {
|
|
|
89
117
|
* no-WAS deployments)
|
|
90
118
|
* @param options.keyAgreementKey {IKeyAgreementKey} the unlock KAK
|
|
91
119
|
* @param options.keyResolver {IKeyResolver}
|
|
92
|
-
* @returns {Promise<{ version: number, encryption:
|
|
120
|
+
* @returns {Promise<{ version: number, encryption: CollectionEncryption,
|
|
121
|
+
* wrapped: unknown }>}
|
|
93
122
|
*/
|
|
94
123
|
export async function wrapKeyringRecord({ controller, email, pointer, keyAgreementKey, keyResolver }) {
|
|
95
124
|
const encryption = await mintRecordEncryption({ keyAgreementKey });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/keyring/record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/keyring/record.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EAGf,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAy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UserKeyRotationOutcome, UserKeyCascadeResult } from './u
|
|
|
50
50
|
export type { UserKeyRosterReadResult, RosterRecipientDocument } from './userKeyRoster.js';
|
|
51
51
|
export { userKeyRosterDescriptorStore } from './rosterStore.js';
|
|
52
52
|
export { ensureWalletSpaceEpochs } from './spaceEpochs.js';
|
|
53
|
+
export type { WalletSpaceEpochsResult } from './spaceEpochs.js';
|
|
53
54
|
export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
|
|
54
55
|
export type { ClientLabelsRecord, ClientLabelsStore } from './clientLabels.js';
|
|
55
56
|
export { wasClientLabelsStore } from './wasLabelsStore.js';
|
package/dist/keys/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC5D,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,gCAAgC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D,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE/D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/keys/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG5D,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAA;AAO7B,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAU5B,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAA;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG5D,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAA;AAO7B,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAU5B,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAA;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -12,9 +12,36 @@
|
|
|
12
12
|
* which re-exports `space`, stays free of the EDV crypto graph -- the same
|
|
13
13
|
* split was-client makes between `ensureSpaceAndCollection` and
|
|
14
14
|
* `ensureFirstEpoch`.
|
|
15
|
+
*
|
|
16
|
+
* The install is re-provisioning, never a content migration: `ensureFirstEpoch`
|
|
17
|
+
* installs a fresh epoch[0] onto ANY epoch-less descriptor, with no check for
|
|
18
|
+
* content already in the collection. So any resource sealed before epochs
|
|
19
|
+
* existed -- straight to the user key's key-agreement key, in the shape that
|
|
20
|
+
* predates the epoch roster -- stops being routable once epoch[0] lands
|
|
21
|
+
* (`UnknownEpochError`), and nothing here re-seals it. That is deliberate:
|
|
22
|
+
* epoch-less encrypted content only ever existed in pre-release accounts, whose
|
|
23
|
+
* affected population is effectively zero, and re-provisioning from scratch is
|
|
24
|
+
* the supported answer for them, as it is for a pre-release keyring or recovery
|
|
25
|
+
* record.
|
|
15
26
|
*/
|
|
16
|
-
import type { WasClient } from '@interop/was-client';
|
|
27
|
+
import type { CollectionEncryption, WasClient } from '@interop/was-client';
|
|
17
28
|
import type { UserKey } from './userKey.js';
|
|
29
|
+
/**
|
|
30
|
+
* What the epoch[0] fan-out did, per collection id: the settled epoch-bearing
|
|
31
|
+
* descriptor of every collection that came through (with whether this call is
|
|
32
|
+
* the one that installed it), and the per-collection failures the caller
|
|
33
|
+
* surfaces -- one stuck collection never discards the others' outcomes.
|
|
34
|
+
*/
|
|
35
|
+
export interface WalletSpaceEpochsResult {
|
|
36
|
+
outcomes: Record<string, {
|
|
37
|
+
installed: boolean;
|
|
38
|
+
descriptor: CollectionEncryption;
|
|
39
|
+
}>;
|
|
40
|
+
failed: Array<{
|
|
41
|
+
collectionId: string;
|
|
42
|
+
error: unknown;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
18
45
|
/**
|
|
19
46
|
* Installs key epoch[0] on every encrypted collection of the wallet Space
|
|
20
47
|
* roster (or on the given `collectionIds`), concurrently, wrapped to the user
|
|
@@ -27,12 +54,24 @@ import type { UserKey } from './userKey.js';
|
|
|
27
54
|
*
|
|
28
55
|
* Run both steps from the sync engine's `ensureProvisioned` seam (or, for a
|
|
29
56
|
* driver of its own, equally before the collection's first content push): the
|
|
30
|
-
* descriptor-before-first-content-push invariant rests on it.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
57
|
+
* descriptor-before-first-content-push invariant rests on it.
|
|
58
|
+
*
|
|
59
|
+
* A collection that fails is reported in `failed` and the rest proceed, so a
|
|
60
|
+
* transient failure on one collection never costs the caller the descriptors
|
|
61
|
+
* the others just settled on. The caller decides what a failure means; a naive
|
|
62
|
+
* full re-run converges, since the collections that did settle are adopted
|
|
63
|
+
* untouched.
|
|
64
|
+
*
|
|
65
|
+
* **Re-minting after adoption.** `installed: false` is not on its own the eager
|
|
66
|
+
* minter's re-mint trigger: it is equally the steady state of every re-run,
|
|
67
|
+
* where nothing changed. The returned `descriptor` is what matters -- an eager
|
|
68
|
+
* minter (one that seals envelopes at local write time against a cached
|
|
69
|
+
* descriptor) builds its cipher from the descriptor returned here, and re-mints
|
|
70
|
+
* every pending envelope that cipher cannot route before pushing.
|
|
71
|
+
* `remintPendingEnvelopes` (`@interop/wallet-core/sync`) is that path; it
|
|
72
|
+
* decides per row from the envelope itself, so running it with the returned
|
|
73
|
+
* descriptor's cipher on every run is both correct and (in the settled case)
|
|
74
|
+
* free.
|
|
36
75
|
*
|
|
37
76
|
* @param options {object}
|
|
38
77
|
* @param options.was {WasClient}
|
|
@@ -43,14 +82,14 @@ import type { UserKey } from './userKey.js';
|
|
|
43
82
|
* cover; defaults to the wallet Space roster's encrypted collections. A
|
|
44
83
|
* caller naming its own ids (e.g. `contacts`) must name only collections
|
|
45
84
|
* declared encrypted
|
|
46
|
-
* @returns {Promise<
|
|
47
|
-
* this call installed its epoch[0] (`false` means an
|
|
48
|
-
* adopted)
|
|
85
|
+
* @returns {Promise<WalletSpaceEpochsResult>} per collection id, the settled
|
|
86
|
+
* descriptor and whether this call installed its epoch[0] (`false` means an
|
|
87
|
+
* existing roster was adopted), plus the collections that failed
|
|
49
88
|
*/
|
|
50
89
|
export declare function ensureWalletSpaceEpochs({ was, spaceId, userKey, collectionIds }: {
|
|
51
90
|
was: WasClient;
|
|
52
91
|
spaceId: string;
|
|
53
92
|
userKey: UserKey;
|
|
54
93
|
collectionIds?: string[];
|
|
55
|
-
}): Promise<
|
|
94
|
+
}): Promise<WalletSpaceEpochsResult>;
|
|
56
95
|
//# sourceMappingURL=spaceEpochs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaceEpochs.d.ts","sourceRoot":"","sources":["../../src/keys/spaceEpochs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"spaceEpochs.d.ts","sourceRoot":"","sources":["../../src/keys/spaceEpochs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAK1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CACd,MAAM,EACN;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,oBAAoB,CAAA;KAAE,CACzD,CAAA;IACD,MAAM,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,GAAG,EACH,OAAO,EACP,OAAO,EACP,aAAa,EACd,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CACzB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6BnC"}
|
package/dist/keys/spaceEpochs.js
CHANGED
|
@@ -13,12 +13,24 @@ import { userKeyAsRecipient } from './userKeyCascade.js';
|
|
|
13
13
|
*
|
|
14
14
|
* Run both steps from the sync engine's `ensureProvisioned` seam (or, for a
|
|
15
15
|
* driver of its own, equally before the collection's first content push): the
|
|
16
|
-
* descriptor-before-first-content-push invariant rests on it.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* descriptor-before-first-content-push invariant rests on it.
|
|
17
|
+
*
|
|
18
|
+
* A collection that fails is reported in `failed` and the rest proceed, so a
|
|
19
|
+
* transient failure on one collection never costs the caller the descriptors
|
|
20
|
+
* the others just settled on. The caller decides what a failure means; a naive
|
|
21
|
+
* full re-run converges, since the collections that did settle are adopted
|
|
22
|
+
* untouched.
|
|
23
|
+
*
|
|
24
|
+
* **Re-minting after adoption.** `installed: false` is not on its own the eager
|
|
25
|
+
* minter's re-mint trigger: it is equally the steady state of every re-run,
|
|
26
|
+
* where nothing changed. The returned `descriptor` is what matters -- an eager
|
|
27
|
+
* minter (one that seals envelopes at local write time against a cached
|
|
28
|
+
* descriptor) builds its cipher from the descriptor returned here, and re-mints
|
|
29
|
+
* every pending envelope that cipher cannot route before pushing.
|
|
30
|
+
* `remintPendingEnvelopes` (`@interop/wallet-core/sync`) is that path; it
|
|
31
|
+
* decides per row from the envelope itself, so running it with the returned
|
|
32
|
+
* descriptor's cipher on every run is both correct and (in the settled case)
|
|
33
|
+
* free.
|
|
22
34
|
*
|
|
23
35
|
* @param options {object}
|
|
24
36
|
* @param options.was {WasClient}
|
|
@@ -29,27 +41,31 @@ import { userKeyAsRecipient } from './userKeyCascade.js';
|
|
|
29
41
|
* cover; defaults to the wallet Space roster's encrypted collections. A
|
|
30
42
|
* caller naming its own ids (e.g. `contacts`) must name only collections
|
|
31
43
|
* declared encrypted
|
|
32
|
-
* @returns {Promise<
|
|
33
|
-
* this call installed its epoch[0] (`false` means an
|
|
34
|
-
* adopted)
|
|
44
|
+
* @returns {Promise<WalletSpaceEpochsResult>} per collection id, the settled
|
|
45
|
+
* descriptor and whether this call installed its epoch[0] (`false` means an
|
|
46
|
+
* existing roster was adopted), plus the collections that failed
|
|
35
47
|
*/
|
|
36
48
|
export async function ensureWalletSpaceEpochs({ was, spaceId, userKey, collectionIds }) {
|
|
37
49
|
const ids = collectionIds ??
|
|
38
50
|
WALLET_SPACE_PROVISION_ROSTER.filter(spec => spec.encryption === 'edv').map(spec => spec.collectionId);
|
|
39
|
-
const
|
|
51
|
+
const outcomes = {};
|
|
52
|
+
const failed = [];
|
|
40
53
|
await Promise.all(ids.map(async (collectionId) => {
|
|
41
54
|
try {
|
|
42
|
-
const
|
|
55
|
+
const { installed, descriptor } = await ensureFirstEpoch({
|
|
43
56
|
collection: was.space(spaceId).collection(collectionId),
|
|
44
57
|
recipients: [userKeyAsRecipient({ userKey })]
|
|
45
58
|
});
|
|
46
|
-
|
|
59
|
+
outcomes[collectionId] = { installed, descriptor };
|
|
47
60
|
}
|
|
48
61
|
catch (err) {
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
failed.push({
|
|
63
|
+
collectionId,
|
|
64
|
+
error: new Error(`Error installing the first key epoch for collection ` +
|
|
65
|
+
`"${collectionId}" in space "${spaceId}".`, { cause: err })
|
|
66
|
+
});
|
|
51
67
|
}
|
|
52
68
|
}));
|
|
53
|
-
return
|
|
69
|
+
return { outcomes, failed };
|
|
54
70
|
}
|
|
55
71
|
//# sourceMappingURL=spaceEpochs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaceEpochs.js","sourceRoot":"","sources":["../../src/keys/spaceEpochs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spaceEpochs.js","sourceRoot":"","sources":["../../src/keys/spaceEpochs.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAiBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,EAC5C,GAAG,EACH,OAAO,EACP,OAAO,EACP,aAAa,EAMd;IACC,MAAM,GAAG,GACP,aAAa;QACb,6BAA6B,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,GAAG,CACzE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAC1B,CAAA;IACH,MAAM,QAAQ,GAAwC,EAAE,CAAA;IACxD,MAAM,MAAM,GAAoD,EAAE,CAAA;IAClE,MAAM,OAAO,CAAC,GAAG,CACf,GAAG,CAAC,GAAG,CAAC,KAAK,EAAC,YAAY,EAAC,EAAE;QAC3B,IAAI,CAAC;YACH,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,gBAAgB,CAAC;gBACvD,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;gBACvD,UAAU,EAAE,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;aAC9C,CAAC,CAAA;YACF,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC;gBACV,YAAY;gBACZ,KAAK,EAAE,IAAI,KAAK,CACd,sDAAsD;oBACpD,IAAI,YAAY,eAAe,OAAO,IAAI,EAC5C,EAAE,KAAK,EAAE,GAAG,EAAE,CACf;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAA;IACD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;AAC7B,CAAC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* ignores the extra member) -- only the recovery flow demands the delegation.
|
|
18
18
|
*/
|
|
19
19
|
import type { IKeyAgreementKey, IKeyResolver, IZcap } from '@interop/data-integrity-core';
|
|
20
|
+
import type { CollectionEncryption } from '@interop/was-client';
|
|
20
21
|
import type { AccountPointer } from '../keyring/record.js';
|
|
21
22
|
/**
|
|
22
23
|
* The unwrapped contents of a recovery keyring record: the ordinary record
|
|
@@ -43,7 +44,8 @@ export interface RecoveryRecordContents {
|
|
|
43
44
|
* code-derived signing DID
|
|
44
45
|
* @param options.keyAgreementKey {IKeyAgreementKey} the code's unlock KAK
|
|
45
46
|
* @param options.keyResolver {IKeyResolver}
|
|
46
|
-
* @returns {Promise<{ version: number, encryption:
|
|
47
|
+
* @returns {Promise<{ version: number, encryption: CollectionEncryption,
|
|
48
|
+
* wrapped: unknown }>}
|
|
47
49
|
*/
|
|
48
50
|
export declare function wrapRecoveryRecord({ controller, email, pointer, delegation, keyAgreementKey, keyResolver }: {
|
|
49
51
|
controller: string;
|
|
@@ -54,7 +56,7 @@ export declare function wrapRecoveryRecord({ controller, email, pointer, delegat
|
|
|
54
56
|
keyResolver: IKeyResolver;
|
|
55
57
|
}): Promise<{
|
|
56
58
|
version: number;
|
|
57
|
-
encryption:
|
|
59
|
+
encryption: CollectionEncryption;
|
|
58
60
|
wrapped: unknown;
|
|
59
61
|
}>;
|
|
60
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryRecord.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryRecord.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACN,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"recoveryRecord.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryRecord.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACN,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAQ/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,KAAK,CAAA;CAClB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,UAAU,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,eAAe,EACf,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,KAAK,CAAA;IACjB,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;CAC1B,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,oBAAoB,CAAA;IAChC,OAAO,EAAE,OAAO,CAAA;CACjB,CAAC,CAsBD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,MAAM,EACN,eAAe,EACf,WAAW,EACZ,EAAE;IACD,MAAM,EAAE,OAAO,CAAA;IACf,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;CAC1B,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAyClC"}
|
|
@@ -12,7 +12,8 @@ import { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordFrame, parseRe
|
|
|
12
12
|
* code-derived signing DID
|
|
13
13
|
* @param options.keyAgreementKey {IKeyAgreementKey} the code's unlock KAK
|
|
14
14
|
* @param options.keyResolver {IKeyResolver}
|
|
15
|
-
* @returns {Promise<{ version: number, encryption:
|
|
15
|
+
* @returns {Promise<{ version: number, encryption: CollectionEncryption,
|
|
16
|
+
* wrapped: unknown }>}
|
|
16
17
|
*/
|
|
17
18
|
export async function wrapRecoveryRecord({ controller, email, pointer, delegation, keyAgreementKey, keyResolver }) {
|
|
18
19
|
const encryption = await mintRecordEncryption({ keyAgreementKey });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryRecord.js","sourceRoot":"","sources":["../../src/recovery/recoveryRecord.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recoveryRecord.js","sourceRoot":"","sources":["../../src/recovery/recoveryRecord.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAgB7B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,UAAU,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,eAAe,EACf,WAAW,EAQZ;IAKC,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAA;IAClE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAChC,eAAe;QACf,WAAW;QACX,UAAU;KACX,CAAC,CAAA;IACF,MAAM,IAAI,GAAG;QACX,UAAU;QACV,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE;YACP,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5C,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB;QACD,UAAU;QACV,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAA;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACxC,IAAI,EAAE,IAA+D;KACtE,CAAC,CAAA;IACF,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC3E,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU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provisioner, adopt the winner's descriptor
|
|
57
57
|
* and re-mint its pending envelopes here before the push (see
|
|
58
58
|
* `remintPendingEnvelopes` in `remint.ts`).
|
|
59
|
+
*
|
|
60
|
+
* The engine calls this unconditionally on EVERY cycle -- that is what makes
|
|
61
|
+
* the ordering structural rather than a first-run special case -- so the
|
|
62
|
+
* seam MUST be memoized on a durable stamp: once provisioning has been
|
|
63
|
+
* observed complete for this `(space, collection)`, later calls return
|
|
64
|
+
* without re-reading the descriptor or re-deriving anything (DCW's
|
|
65
|
+
* `provisionedAt` stamp is the reference implementation). Without that
|
|
66
|
+
* memoization every sync cycle pays a descriptor round trip. The stamp must
|
|
67
|
+
* be cleared -- so provisioning runs again -- whenever the account's
|
|
68
|
+
* provisioning state can have changed under the replica: an unlock with a
|
|
69
|
+
* fresh key set, a re-bind to a different account pointer, or a recovery.
|
|
59
70
|
*/
|
|
60
71
|
ensureProvisioned: () => Promise<void>;
|
|
61
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/sync/engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAI/E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAMhE;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,UAAU,EAAE,CAAC,QAAQ,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,OAAO,CAAA;IAC5C;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,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,CAAC,IAAI,CAAC,UAAU;YAChC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe;YAC1C,MAAM;SACP,CAAC,CAAA;QACF,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,aAAa;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CACrB,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,IAAI,CAAC,YAAY,EACzC,IAAI,CAAC,UAAU,CAChB,CAAA;QACD,yEAAyE;QACzE,yEAAyE;QACzE,0DAA0D;QAC1D,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QAClD,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;YACvB,KAAK,IAAI,CAAC,IAAI,EAAE,CAAA;QAClB,CAAC,EAAE,KAAK,CAAC,CAAA;IACX,CAAC;IAEO,UAAU;QAChB,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;YAC9B,IAAI,CAAC,WAAW,EAAE,CAAA;YAClB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;QACzB,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,MAAkB;QAClC,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC3B,OAAM;QACR,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;CACF"}
|
package/dist/sync/remint.d.ts
CHANGED
|
@@ -34,8 +34,9 @@ import type { DocCipher, Json, SyncStore } from './types.js';
|
|
|
34
34
|
* Re-mints every pending (dirty, never-acked, live) row whose envelope the
|
|
35
35
|
* given cipher cannot route to an epoch it knows -- the create-loss path for
|
|
36
36
|
* an eager minter, run after adopting a published descriptor this client did
|
|
37
|
-
* not install itself (`ensureWalletSpaceEpochs`
|
|
38
|
-
*
|
|
37
|
+
* not install itself (`ensureWalletSpaceEpochs` returning an adopted
|
|
38
|
+
* descriptor for a collection it had already minted against; the envelope, not
|
|
39
|
+
* the `installed` flag, decides per row) and before the next push.
|
|
39
40
|
*
|
|
40
41
|
* Each such row is decrypted through `decryptStale` (the pre-adoption cipher,
|
|
41
42
|
* or a plaintext-projection read keyed by the row id), re-encrypted with
|
|
@@ -48,12 +49,24 @@ import type { DocCipher, Json, SyncStore } from './types.js';
|
|
|
48
49
|
* corrupt, rather than merely minted under a losing epoch, is not this
|
|
49
50
|
* helper's to settle.
|
|
50
51
|
*
|
|
52
|
+
* A replace the store SKIPS (`{ applied: false }` -- a local write bumped the
|
|
53
|
+
* row's revision between the snapshot and the replace, so the row now holds a
|
|
54
|
+
* body this pass never saw) is not counted as re-minted: the whole pass
|
|
55
|
+
* re-snapshots and re-probes, settling the row under its fresh revision. Only
|
|
56
|
+
* rows still unroutable are re-processed; the retry is bounded by
|
|
57
|
+
* {@link MAX_REMINT_ATTEMPTS}, and a pass that exhausts the bound throws
|
|
58
|
+
* rather than returning -- a row left sealed under the losing epoch MUST NOT
|
|
59
|
+
* be pushed, since it would land on the feed as a permanently unroutable
|
|
60
|
+
* entry.
|
|
61
|
+
*
|
|
62
|
+
* The store parameter is narrowed to one that implements `replacePending`
|
|
63
|
+
* (optional on {@link SyncStore} itself, since a lazy-minting consumer never
|
|
64
|
+
* re-mints): the requirement is a compile-time one, not a runtime throw.
|
|
65
|
+
*
|
|
51
66
|
* Idempotent: a re-run finds the re-minted rows readable and does nothing.
|
|
52
67
|
*
|
|
53
68
|
* @param options {object}
|
|
54
|
-
* @param options.store {SyncStore} must implement `replacePending
|
|
55
|
-
* absence throws on the first row actually needing a re-mint (a lazy-minting
|
|
56
|
-
* consumer never does)
|
|
69
|
+
* @param options.store {SyncStore} must implement `replacePending`
|
|
57
70
|
* @param options.cipher {DocCipher} built from the adopted (published)
|
|
58
71
|
* descriptor
|
|
59
72
|
* @param options.decryptStale {function} opens envelopes minted before the
|
|
@@ -61,10 +74,13 @@ import type { DocCipher, Json, SyncStore } from './types.js';
|
|
|
61
74
|
* look the plaintext up by row id instead of decrypting
|
|
62
75
|
* @param [options.signal] {AbortSignal} checked between rows
|
|
63
76
|
* @returns {Promise<{ pending: number; reminted: number }>} pending live
|
|
64
|
-
* rows scanned, and how many were re-minted
|
|
77
|
+
* rows the first pass scanned, and how many rows were re-minted (applied
|
|
78
|
+
* replaces only, across all passes)
|
|
65
79
|
*/
|
|
66
80
|
export declare function remintPendingEnvelopes({ store, cipher, decryptStale, signal }: {
|
|
67
|
-
store: SyncStore
|
|
81
|
+
store: SyncStore & {
|
|
82
|
+
replacePending: NonNullable<SyncStore['replacePending']>;
|
|
83
|
+
};
|
|
68
84
|
cipher: DocCipher;
|
|
69
85
|
decryptStale: (options: {
|
|
70
86
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remint.d.ts","sourceRoot":"","sources":["../../src/sync/remint.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"remint.d.ts","sourceRoot":"","sources":["../../src/sync/remint.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAW5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,KAAK,EACL,MAAM,EACN,YAAY,EACZ,MAAM,EACP,EAAE;IACD,KAAK,EAAE,SAAS,GAAG;QACjB,cAAc,EAAE,WAAW,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAA;KACzD,CAAA;IACD,MAAM,EAAE,SAAS,CAAA;IACjB,YAAY,EAAE,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxE,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA4DjD"}
|
package/dist/sync/remint.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { UnknownEpochError } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* How many full re-mint passes are attempted before giving up. A pass that
|
|
4
|
+
* ends with skipped rows (a local write bumped a row's revision between the
|
|
5
|
+
* snapshot and the replace) re-snapshots and retries only what is still
|
|
6
|
+
* unroutable; the bound keeps a hot-writing row from livelocking the pass.
|
|
7
|
+
*/
|
|
8
|
+
const MAX_REMINT_ATTEMPTS = 5;
|
|
2
9
|
/**
|
|
3
10
|
* Re-mints every pending (dirty, never-acked, live) row whose envelope the
|
|
4
11
|
* given cipher cannot route to an epoch it knows -- the create-loss path for
|
|
5
12
|
* an eager minter, run after adopting a published descriptor this client did
|
|
6
|
-
* not install itself (`ensureWalletSpaceEpochs`
|
|
7
|
-
*
|
|
13
|
+
* not install itself (`ensureWalletSpaceEpochs` returning an adopted
|
|
14
|
+
* descriptor for a collection it had already minted against; the envelope, not
|
|
15
|
+
* the `installed` flag, decides per row) and before the next push.
|
|
8
16
|
*
|
|
9
17
|
* Each such row is decrypted through `decryptStale` (the pre-adoption cipher,
|
|
10
18
|
* or a plaintext-projection read keyed by the row id), re-encrypted with
|
|
@@ -17,12 +25,24 @@ import { UnknownEpochError } from './types.js';
|
|
|
17
25
|
* corrupt, rather than merely minted under a losing epoch, is not this
|
|
18
26
|
* helper's to settle.
|
|
19
27
|
*
|
|
28
|
+
* A replace the store SKIPS (`{ applied: false }` -- a local write bumped the
|
|
29
|
+
* row's revision between the snapshot and the replace, so the row now holds a
|
|
30
|
+
* body this pass never saw) is not counted as re-minted: the whole pass
|
|
31
|
+
* re-snapshots and re-probes, settling the row under its fresh revision. Only
|
|
32
|
+
* rows still unroutable are re-processed; the retry is bounded by
|
|
33
|
+
* {@link MAX_REMINT_ATTEMPTS}, and a pass that exhausts the bound throws
|
|
34
|
+
* rather than returning -- a row left sealed under the losing epoch MUST NOT
|
|
35
|
+
* be pushed, since it would land on the feed as a permanently unroutable
|
|
36
|
+
* entry.
|
|
37
|
+
*
|
|
38
|
+
* The store parameter is narrowed to one that implements `replacePending`
|
|
39
|
+
* (optional on {@link SyncStore} itself, since a lazy-minting consumer never
|
|
40
|
+
* re-mints): the requirement is a compile-time one, not a runtime throw.
|
|
41
|
+
*
|
|
20
42
|
* Idempotent: a re-run finds the re-minted rows readable and does nothing.
|
|
21
43
|
*
|
|
22
44
|
* @param options {object}
|
|
23
|
-
* @param options.store {SyncStore} must implement `replacePending
|
|
24
|
-
* absence throws on the first row actually needing a re-mint (a lazy-minting
|
|
25
|
-
* consumer never does)
|
|
45
|
+
* @param options.store {SyncStore} must implement `replacePending`
|
|
26
46
|
* @param options.cipher {DocCipher} built from the adopted (published)
|
|
27
47
|
* descriptor
|
|
28
48
|
* @param options.decryptStale {function} opens envelopes minted before the
|
|
@@ -30,44 +50,62 @@ import { UnknownEpochError } from './types.js';
|
|
|
30
50
|
* look the plaintext up by row id instead of decrypting
|
|
31
51
|
* @param [options.signal] {AbortSignal} checked between rows
|
|
32
52
|
* @returns {Promise<{ pending: number; reminted: number }>} pending live
|
|
33
|
-
* rows scanned, and how many were re-minted
|
|
53
|
+
* rows the first pass scanned, and how many rows were re-minted (applied
|
|
54
|
+
* replaces only, across all passes)
|
|
34
55
|
*/
|
|
35
56
|
export async function remintPendingEnvelopes({ store, cipher, decryptStale, signal }) {
|
|
36
|
-
|
|
37
|
-
const pendingRows = rows.filter(row => !row.deleted && row.version === 0 && row.data !== null);
|
|
57
|
+
let pending;
|
|
38
58
|
let reminted = 0;
|
|
39
|
-
|
|
59
|
+
let skipped = [];
|
|
60
|
+
for (let attempt = 0; attempt < MAX_REMINT_ATTEMPTS; attempt += 1) {
|
|
40
61
|
if (signal?.aborted) {
|
|
41
62
|
break;
|
|
42
63
|
}
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
const rows = await store.getDirtyRows();
|
|
65
|
+
const pendingRows = rows.filter(row => !row.deleted && row.version === 0 && row.data !== null);
|
|
66
|
+
pending ??= pendingRows.length;
|
|
67
|
+
skipped = [];
|
|
68
|
+
for (const row of pendingRows) {
|
|
69
|
+
if (signal?.aborted) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
const envelope = row.data;
|
|
73
|
+
try {
|
|
74
|
+
await cipher.decrypt({ envelope });
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
if (!(err instanceof UnknownEpochError)) {
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const payload = await decryptStale({ id: row.id, envelope });
|
|
83
|
+
const { id: newId, envelope: remintedEnvelope } = await cipher.encrypt({
|
|
84
|
+
data: payload
|
|
85
|
+
});
|
|
86
|
+
const { applied } = await store.replacePending({
|
|
87
|
+
id: row.id,
|
|
88
|
+
newId,
|
|
89
|
+
envelope: remintedEnvelope,
|
|
90
|
+
...(row.revision !== undefined && { revision: row.revision })
|
|
91
|
+
});
|
|
92
|
+
if (applied) {
|
|
93
|
+
reminted += 1;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
skipped.push(row.id);
|
|
51
97
|
}
|
|
52
98
|
}
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
'descriptor does not carry, but this store implements no ' +
|
|
56
|
-
'`replacePending`. An eager-minting replica must supply it so the ' +
|
|
57
|
-
'create-loss re-mint can rewrite pre-feed envelopes.');
|
|
99
|
+
if (skipped.length === 0 || signal?.aborted) {
|
|
100
|
+
break;
|
|
58
101
|
}
|
|
59
|
-
const payload = await decryptStale({ id: row.id, envelope });
|
|
60
|
-
const { id: newId, envelope: remintedEnvelope } = await cipher.encrypt({
|
|
61
|
-
data: payload
|
|
62
|
-
});
|
|
63
|
-
await store.replacePending({
|
|
64
|
-
id: row.id,
|
|
65
|
-
newId,
|
|
66
|
-
envelope: remintedEnvelope,
|
|
67
|
-
...(row.revision !== undefined && { revision: row.revision })
|
|
68
|
-
});
|
|
69
|
-
reminted += 1;
|
|
70
102
|
}
|
|
71
|
-
|
|
103
|
+
if (skipped.length > 0 && !signal?.aborted) {
|
|
104
|
+
throw new Error(`Re-mint gave up after ${MAX_REMINT_ATTEMPTS} attempts: pending ` +
|
|
105
|
+
`row(s) ${skipped.join(', ')} kept being rewritten locally and are ` +
|
|
106
|
+
'still sealed under an epoch the adopted descriptor does not carry. ' +
|
|
107
|
+
'They must not be pushed; re-run the re-mint once local writes settle.');
|
|
108
|
+
}
|
|
109
|
+
return { pending: pending ?? 0, reminted };
|
|
72
110
|
}
|
|
73
111
|
//# sourceMappingURL=remint.js.map
|
package/dist/sync/remint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remint.js","sourceRoot":"","sources":["../../src/sync/remint.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C
|
|
1
|
+
{"version":3,"file":"remint.js","sourceRoot":"","sources":["../../src/sync/remint.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,mBAAmB,GA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,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;YAC5D,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;gBACrE,IAAI,EAAE,OAAO;aACd,CAAC,CAAA;YACF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC;gBAC7C,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,KAAK;gBACL,QAAQ,EAAE,gBAAgB;gBAC1B,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;aAC9D,CAAC,CAAA;YACF,IAAI,OAAO,EAAE,CAAC;gBACZ,QAAQ,IAAI,CAAC,CAAA;YACf,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YAC5C,MAAK;QACP,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,yBAAyB,mBAAmB,qBAAqB;YAC/D,UAAU,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wCAAwC;YACpE,qEAAqE;YACrE,uEAAuE,CAC1E,CAAA;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAA;AAC5C,CAAC"}
|
package/dist/sync/types.d.ts
CHANGED
|
@@ -155,6 +155,16 @@ export interface SyncStore {
|
|
|
155
155
|
* current token differs (a local write landed mid-re-mint), the replace is
|
|
156
156
|
* skipped -- the newer state stays as-is for the next pass.
|
|
157
157
|
*
|
|
158
|
+
* The outcome MUST be reported: resolve with `{ applied: true }` when the
|
|
159
|
+
* row's body was replaced, and `{ applied: false }` when the revision
|
|
160
|
+
* condition skipped it. A skip is not a failure, but it leaves a row still
|
|
161
|
+
* sealed under an epoch the published descriptor does not carry, and the
|
|
162
|
+
* caller (`remintPendingEnvelopes`) re-probes and retries it rather than
|
|
163
|
+
* counting it as re-minted -- a silently skipped row would otherwise be
|
|
164
|
+
* pushed to the feed as a permanently unroutable entry. A store that does
|
|
165
|
+
* not track a revision token replaces unconditionally and always reports
|
|
166
|
+
* `{ applied: true }`.
|
|
167
|
+
*
|
|
158
168
|
* Optional: only an eager-minting replica (one that mints envelopes at
|
|
159
169
|
* local write time against a cached descriptor) needs it, for the
|
|
160
170
|
* create-loss re-mint (`remintPendingEnvelopes`). A replica that mints
|
|
@@ -165,6 +175,8 @@ export interface SyncStore {
|
|
|
165
175
|
newId: string;
|
|
166
176
|
envelope: Json;
|
|
167
177
|
revision?: string | number;
|
|
168
|
-
}): Promise<
|
|
178
|
+
}): Promise<{
|
|
179
|
+
applied: boolean;
|
|
180
|
+
}>;
|
|
169
181
|
}
|
|
170
182
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/sync/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sync/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACV,IAAI,EACJ,cAAc,EACd,OAAO,EACP,WAAW,EACX,WAAW,EACX,SAAS,EACV,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAK,EACV,IAAI,EACJ,WAAW,EACX,cAAc,EACd,OAAO,EACR,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,M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;QAC1B,UAAU,EAAE,gBAAgB,CAAA;KAC7B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,cAAc,CAAC,CAAC,OAAO,EAAE;QACvB,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,IAAI,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAC3B,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAClC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/wallet-core",
|
|
3
3
|
"description": "Shared wallet-domain logic (WAS sync engine core and wallet Space layout contracts) for Interop wallet apps.",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|