@interop/wallet-core 0.22.0 → 0.23.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/dist/clients/listing.d.ts +3 -3
- package/dist/clients/listing.js +3 -3
- 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/dist/webvh/didWeb.d.ts +7 -1
- package/dist/webvh/didWeb.d.ts.map +1 -1
- package/dist/webvh/didWeb.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +5 -2
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +42 -26
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/listClients.d.ts +3 -3
- package/package.json +1 -1
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,EAChC,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,uBAAuB,EACvB,uBAAuB,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BAAiB,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":"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E,OAAO,EAAE,GAAG,gBAAgB,CAAC;QAC/C,MAAM;QACN,KAAK,EAAE,UAAU;KAClB,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAChC,eAAe;QACf,WAAW;QACX,UAAU;KACX,CAAC,CAAA;IACF,MAAM,SAAS,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC;QACtC,QAAQ,EAAE,OAAgB;KAC3B,CAAC,CAKD,CAAA;IAED,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC7D,CAAC;IACD,MAAM,OAAO,GAAG,kBAAkB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;IACpE,CAAC;IACD,IACE,SAAS,CAAC,UAAU,KAAK,IAAI;QAC7B,OAAO,SAAS,CAAC,UAAU,KAAK,QAAQ,EACxC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,OAAO;QACL,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,GAAG,CAAC,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK;YACxD,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE;YAC5B,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;QACP,UAAU,EAAE,SAAS,CAAC,UAAmB;KAC1C,CAAA;AACH,CAAC"}
|
package/dist/sync/engine.d.ts
CHANGED
|
@@ -56,6 +56,17 @@ export interface SyncEngineDeps {
|
|
|
56
56
|
* descriptor create to another 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,CAAA;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB
|
|
1
|
+
{"version":3,"file":"engine.d.ts","s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AM;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,GAAG,CAAC,CAAA;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG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AAK,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,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,SA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B;;;;;;;;;;;;;;;;;;;;;;;;;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/dist/webvh/didWeb.d.ts
CHANGED
|
@@ -22,10 +22,16 @@ export interface DidWebKey {
|
|
|
22
22
|
* The key-id map persisted as `keys.json` in the private `key-map` collection:
|
|
23
23
|
* the durable mapping from DID relationship to KMS key, since the KMS protocol
|
|
24
24
|
* has no list-keys endpoint and key ids are server-generated.
|
|
25
|
+
*
|
|
26
|
+
* `assertionMethod` is optional: the account document's `assertionMethod`
|
|
27
|
+
* relation lists client keys only (membership there authorizes appends to
|
|
28
|
+
* co-managed resource logs under the App Connect Resource Log Profile), so no
|
|
29
|
+
* KMS-held assertion key is published. The member persists where a legacy
|
|
30
|
+
* `keys.json` already carries one.
|
|
25
31
|
*/
|
|
26
32
|
export interface DidWebKeyMap {
|
|
27
33
|
authentication: DidWebKey;
|
|
28
|
-
assertionMethod
|
|
34
|
+
assertionMethod?: DidWebKey;
|
|
29
35
|
keyAgreement: DidWebKey;
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"didWeb.d.ts","sourceRoot":"","sources":["../../src/webvh/didWeb.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED
|
|
1
|
+
{"version":3,"file":"didWeb.d.ts","sourceRoot":"","sources":["../../src/webvh/didWeb.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,SAAS,CAAA;IACzB,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B,YAAY,EAAE,SAAS,CAAA;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
package/dist/webvh/didWeb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"didWeb.js","sourceRoot":"","sources":["../../src/webvh/didWeb.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"didWeb.js","sourceRoot":"","sources":["../../src/webvh/didWeb.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AA6BH;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAC1C,CAAC"}
|
package/dist/webvh/didWebvh.d.ts
CHANGED
|
@@ -371,8 +371,11 @@ export declare function enrollWebvhClient({ idStore, updateKeys, newClient }: {
|
|
|
371
371
|
* artifact, so the bindings are rediscovered by public key material instead.
|
|
372
372
|
* List the keystore once -- each listed description carries `keyUrl`, the
|
|
373
373
|
* key's canonical invocation URL (the signable handle its alias-overridden
|
|
374
|
-
* `id` erases) -- then match `did.json`'s
|
|
375
|
-
*
|
|
374
|
+
* `id` erases) -- then match `did.json`'s relationship verification methods
|
|
375
|
+
* by `publicKeyMultibase` and rewrite `keys.json` from what matched. The
|
|
376
|
+
* `authentication` and `keyAgreement` bindings are required; `assertionMethod`
|
|
377
|
+
* lists client keys only in current documents, so its binding is rebuilt only
|
|
378
|
+
* where a legacy document still publishes a KMS-backed assertion key.
|
|
376
379
|
* When `did.jsonl` is published, its resolved DID is recorded in the `webvh`
|
|
377
380
|
* block; there is nothing else to repair there, since the log's update keys are
|
|
378
381
|
* client-held seeds that no keystore listing could recover.
|