@interop/wallet-core 0.68.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -13
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +12 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +9 -2
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +10 -0
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +14 -2
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +19 -4
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +83 -35
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +13 -14
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.js +12 -12
- package/dist/clientAnnex/rosterDeliveredEpochs.js.map +1 -1
- package/dist/descriptors/index.d.ts +21 -46
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +21 -45
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +45 -56
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +64 -74
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +13 -1
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +11 -2
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/keys/collectionLogStore.d.ts +73 -0
- package/dist/keys/collectionLogStore.d.ts.map +1 -0
- package/dist/keys/collectionLogStore.js +60 -0
- package/dist/keys/collectionLogStore.js.map +1 -0
- package/dist/keys/index.d.ts +18 -6
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +18 -6
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +44 -6
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +51 -238
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +2 -1
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +67 -34
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +80 -30
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyCascade.d.ts +26 -1
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +29 -2
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +5 -0
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +5 -0
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts +54 -16
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +50 -22
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/resourceLog/controller.d.ts +18 -6
- package/dist/resourceLog/controller.d.ts.map +1 -1
- package/dist/resourceLog/controller.js +5 -3
- package/dist/resourceLog/controller.js.map +1 -1
- package/dist/resourceLog/errors.d.ts +17 -43
- package/dist/resourceLog/errors.d.ts.map +1 -1
- package/dist/resourceLog/errors.js +17 -50
- package/dist/resourceLog/errors.js.map +1 -1
- package/dist/resourceLog/index.d.ts +4 -1
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +4 -1
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/logClass.d.ts +69 -0
- package/dist/resourceLog/logClass.d.ts.map +1 -0
- package/dist/resourceLog/logClass.js +43 -0
- package/dist/resourceLog/logClass.js.map +1 -0
- package/dist/space/collections.d.ts +22 -2
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +18 -0
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +4 -3
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +4 -3
- package/dist/space/index.js.map +1 -1
- package/dist/space/provisioning.d.ts +16 -6
- package/dist/space/provisioning.d.ts.map +1 -1
- package/dist/space/provisioning.js +11 -7
- package/dist/space/provisioning.js.map +1 -1
- package/dist/sync/engine.d.ts +4 -2
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/index.d.ts +9 -6
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -5
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/push.d.ts +0 -29
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +30 -28
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/types.d.ts +39 -21
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +13 -7
- package/dist/sync/types.js.map +1 -1
- package/dist/unlock/retire.d.ts +8 -1
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +8 -1
- package/dist/unlock/retire.js.map +1 -1
- package/package.json +4 -4
- package/dist/descriptors/acquire.d.ts +0 -122
- package/dist/descriptors/acquire.d.ts.map +0 -1
- package/dist/descriptors/acquire.js +0 -100
- package/dist/descriptors/acquire.js.map +0 -1
- package/dist/descriptors/cipher.d.ts +0 -71
- package/dist/descriptors/cipher.d.ts.map +0 -1
- package/dist/descriptors/cipher.js +0 -109
- package/dist/descriptors/cipher.js.map +0 -1
- package/dist/descriptors/errors.d.ts +0 -44
- package/dist/descriptors/errors.d.ts.map +0 -1
- package/dist/descriptors/errors.js +0 -46
- package/dist/descriptors/errors.js.map +0 -1
- package/dist/descriptors/refresh.d.ts +0 -62
- package/dist/descriptors/refresh.d.ts.map +0 -1
- package/dist/descriptors/refresh.js +0 -69
- package/dist/descriptors/refresh.js.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { resourceLogStore } from '@interop/was-client/log';
|
|
2
|
+
import { collectionDescriptorLogPinId } from '../descriptors/logSource.js';
|
|
3
|
+
import { logGovernedDescriptorStore } from './rosterLogStore.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builds the log-governed, sealable descriptor store over one collection's
|
|
6
|
+
* governing history log.
|
|
7
|
+
*
|
|
8
|
+
* Reads resolve to the log's verified head (chain, entry proofs, external
|
|
9
|
+
* authorization against the independently verified account document, and the
|
|
10
|
+
* chain-head pin, all checked before a descriptor is handed out); writes are
|
|
11
|
+
* signed appends of the full next state; `create` is the guarded genesis that
|
|
12
|
+
* declares the Collection governed -- the epoch[0] install
|
|
13
|
+
* ({@link ensureIndexedFirstEpoch}) is what runs it. `seal()` is the backstop
|
|
14
|
+
* for a rotation that no-op'd and so left the log anchored before the account
|
|
15
|
+
* document's latest membership change, and `setMinimumControllerVersion` is
|
|
16
|
+
* the post-edit anchor a ceremony sets so its appends never resolve to a
|
|
17
|
+
* cached pre-edit view.
|
|
18
|
+
*
|
|
19
|
+
* The signer is the same `ResourceLogSigner` the roster takes: an enrolled
|
|
20
|
+
* client's account key ({@link userKeyRosterLogSigner}), or a standing
|
|
21
|
+
* credential's ladder VM on a credential-anchored account.
|
|
22
|
+
*
|
|
23
|
+
* The store's class is `collection-descriptor`, so a ladder-signed append is
|
|
24
|
+
* admitted on `assertionMethod` membership at the anchored version alone.
|
|
25
|
+
* The ceremony-tail license binds the user key roster log only: a descriptor
|
|
26
|
+
* append escrows one recipient into one collection, lands as a hash-chained
|
|
27
|
+
* entry attributable to that credential, and is auditable by the account's
|
|
28
|
+
* clients.
|
|
29
|
+
*
|
|
30
|
+
* @param options {object}
|
|
31
|
+
* @param options.collection {Collection} the collection handle whose
|
|
32
|
+
* `meta/log` is the log; its `spaceId` and `id` are what the pin slot is
|
|
33
|
+
* derived from, and its capability wiring is what every request rides
|
|
34
|
+
* @param options.resolveController {function}
|
|
35
|
+
* `() => Promise<WebvhResourceLogController>` -- the caller's currently
|
|
36
|
+
* verified controller view (`webvhResourceLogController` over a
|
|
37
|
+
* `verifyAccountLog` result), resolved per operation
|
|
38
|
+
* @param options.pinStore {ResourceLogPinStore} this client's chain-head
|
|
39
|
+
* pins, keyed per log
|
|
40
|
+
* @param options.signer {ResourceLogSigner} the signing key the appends
|
|
41
|
+
* this store writes are proved by. It must be listed under
|
|
42
|
+
* `assertionMethod` in the account document at the version the append
|
|
43
|
+
* anchors at, so a ceremony that strikes a key builds its collection stores
|
|
44
|
+
* on one its own edit leaves standing
|
|
45
|
+
* @returns {SealableEncryptionDescriptorStore}
|
|
46
|
+
*/
|
|
47
|
+
export function collectionDescriptorLogStore({ collection, resolveController, pinStore, signer }) {
|
|
48
|
+
return logGovernedDescriptorStore({
|
|
49
|
+
log: resourceLogStore({ collection }),
|
|
50
|
+
resolveController,
|
|
51
|
+
pinStore,
|
|
52
|
+
logId: collectionDescriptorLogPinId({
|
|
53
|
+
spaceId: collection.spaceId,
|
|
54
|
+
collectionId: collection.id
|
|
55
|
+
}),
|
|
56
|
+
signer,
|
|
57
|
+
logClass: 'collection-descriptor'
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=collectionLogStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectionLogStore.js","sourceRoot":"","sources":["../../src/keys/collectionLogStore.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAK1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAE1E,OAAO,EACL,0BAA0B,EAE3B,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,MAAM,EAMP;IACC,OAAO,0BAA0B,CAAC;QAChC,GAAG,EAAE,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAC;QACrC,iBAAiB;QACjB,QAAQ;QACR,KAAK,EAAE,4BAA4B,CAAC;YAClC,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,YAAY,EAAE,UAAU,CAAC,EAAE;SAC5B,CAAC;QACF,MAAM;QACN,QAAQ,EAAE,uBAAuB;KAClC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/keys/index.d.ts
CHANGED
|
@@ -22,13 +22,23 @@
|
|
|
22
22
|
* current epoch, refusing a `currentEpoch` that names no epoch in its own
|
|
23
23
|
* list" (`UserKeyRosterIntegrityError`); every roster and collection
|
|
24
24
|
* descriptor read that needs the current epoch goes through it.
|
|
25
|
-
* - `
|
|
26
|
-
*
|
|
25
|
+
* - `collectionDescriptorLogStore` -- the same store over ONE encrypted
|
|
26
|
+
* collection's governing history log (the collection's `meta/log`
|
|
27
|
+
* sub-resource, whose verified head state is its `encryption` descriptor).
|
|
28
|
+
* It derives its own chain-head pin slot from the collection handle, and
|
|
29
|
+
* carries the `collection-descriptor` log class, whose ladder-signed
|
|
30
|
+
* appends admit on `assertionMethod` membership alone.
|
|
31
|
+
* - `userKeyRosterDescriptorStore` -- the same store over the user key roster:
|
|
32
|
+
* reads resolve to the roster log's verified head
|
|
27
33
|
* (`key-map/user-key.jsonl`), writes append signed entries; built from a
|
|
28
34
|
* bare signing client for the login-time direct read. Sealable
|
|
29
35
|
* (`SealableEncryptionDescriptorStore` / `isSealableDescriptorStore`):
|
|
30
36
|
* `seal()` appends the idempotent backstop entry when the log's head still
|
|
31
37
|
* anchors before the account document's latest membership change.
|
|
38
|
+
*
|
|
39
|
+
* Those two builders are the subpath's whole store surface. Each states its
|
|
40
|
+
* log class at construction, and the generic wrapper under them takes a
|
|
41
|
+
* caller-chosen class and log id, so it stays module-internal.
|
|
32
42
|
* - `rosterRecipientKid` -- the one builder of a client's roster kid, shared by
|
|
33
43
|
* the enrollment wrap and the roster read. A retiring rotation names no kid:
|
|
34
44
|
* it converges onto the account document instead.
|
|
@@ -52,9 +62,10 @@
|
|
|
52
62
|
* names (also the completion sweep's driver).
|
|
53
63
|
* - `rotateRosterToDocumentAndCascade` -- the shared roster-and-cascade tail
|
|
54
64
|
* every account-membership ceremony ends with (a client disconnected, a
|
|
55
|
-
* standing unlock credential retired): the post-edit minimum controller
|
|
56
|
-
*
|
|
57
|
-
*
|
|
65
|
+
* standing unlock credential retired): the post-edit minimum controller
|
|
66
|
+
* version on the roster store AND on every log-governed collection store
|
|
67
|
+
* the fan-out touches, the convergence rotation with its seal backstop, and
|
|
68
|
+
* the collection fan-out onto the fresh user key.
|
|
58
69
|
* - `retireRosterRecipientAndCascade` -- the same tail for a ceremony that
|
|
59
70
|
* rotates BEFORE its document edit (the two forgets): the minimum
|
|
60
71
|
* controller version at the caller's anchor, one named recipient retired
|
|
@@ -82,8 +93,9 @@ export { anchorRosterStoreAt, retireRosterRecipientAndCascade, rotateRosterToDoc
|
|
|
82
93
|
export type { CascadeCollections, RosterCascadeResult, RosterSealReport, UserKeyAdoptedHook } from './userKeyRosterCascade.js';
|
|
83
94
|
export type { DescriptorStoreRead, UserKeyRosterReadResult } from './userKeyRoster.js';
|
|
84
95
|
export type { KeyAgreementDocument } from '../resourceLog/document.js';
|
|
96
|
+
export { collectionDescriptorLogStore } from './collectionLogStore.js';
|
|
85
97
|
export { userKeyRosterDescriptorStore, userKeyRosterPinId } from './rosterStore.js';
|
|
86
|
-
export {
|
|
98
|
+
export { isSealableDescriptorStore } from './rosterLogStore.js';
|
|
87
99
|
export type { SealableEncryptionDescriptorStore } from './rosterLogStore.js';
|
|
88
100
|
export { ensureIndexedFirstEpoch, ensureWalletSpaceEpochs, WalletSpaceProvisioningError, walletSpaceProvisioner } from './spaceEpochs.js';
|
|
89
101
|
export type { WalletSpaceEpochsResult } from './spaceEpochs.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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;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,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,cAAc,EACd,8BAA8B,EAC9B,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,sBAAsB,EACtB,8BAA8B,EAC9B,iBAAiB,EACjB,8BAA8B,EAC9B,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACpB,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,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAA;AAE5E,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,kBAAkB,CAAA;AACzB,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
CHANGED
|
@@ -22,13 +22,23 @@
|
|
|
22
22
|
* current epoch, refusing a `currentEpoch` that names no epoch in its own
|
|
23
23
|
* list" (`UserKeyRosterIntegrityError`); every roster and collection
|
|
24
24
|
* descriptor read that needs the current epoch goes through it.
|
|
25
|
-
* - `
|
|
26
|
-
*
|
|
25
|
+
* - `collectionDescriptorLogStore` -- the same store over ONE encrypted
|
|
26
|
+
* collection's governing history log (the collection's `meta/log`
|
|
27
|
+
* sub-resource, whose verified head state is its `encryption` descriptor).
|
|
28
|
+
* It derives its own chain-head pin slot from the collection handle, and
|
|
29
|
+
* carries the `collection-descriptor` log class, whose ladder-signed
|
|
30
|
+
* appends admit on `assertionMethod` membership alone.
|
|
31
|
+
* - `userKeyRosterDescriptorStore` -- the same store over the user key roster:
|
|
32
|
+
* reads resolve to the roster log's verified head
|
|
27
33
|
* (`key-map/user-key.jsonl`), writes append signed entries; built from a
|
|
28
34
|
* bare signing client for the login-time direct read. Sealable
|
|
29
35
|
* (`SealableEncryptionDescriptorStore` / `isSealableDescriptorStore`):
|
|
30
36
|
* `seal()` appends the idempotent backstop entry when the log's head still
|
|
31
37
|
* anchors before the account document's latest membership change.
|
|
38
|
+
*
|
|
39
|
+
* Those two builders are the subpath's whole store surface. Each states its
|
|
40
|
+
* log class at construction, and the generic wrapper under them takes a
|
|
41
|
+
* caller-chosen class and log id, so it stays module-internal.
|
|
32
42
|
* - `rosterRecipientKid` -- the one builder of a client's roster kid, shared by
|
|
33
43
|
* the enrollment wrap and the roster read. A retiring rotation names no kid:
|
|
34
44
|
* it converges onto the account document instead.
|
|
@@ -52,9 +62,10 @@
|
|
|
52
62
|
* names (also the completion sweep's driver).
|
|
53
63
|
* - `rotateRosterToDocumentAndCascade` -- the shared roster-and-cascade tail
|
|
54
64
|
* every account-membership ceremony ends with (a client disconnected, a
|
|
55
|
-
* standing unlock credential retired): the post-edit minimum controller
|
|
56
|
-
*
|
|
57
|
-
*
|
|
65
|
+
* standing unlock credential retired): the post-edit minimum controller
|
|
66
|
+
* version on the roster store AND on every log-governed collection store
|
|
67
|
+
* the fan-out touches, the convergence rotation with its seal backstop, and
|
|
68
|
+
* the collection fan-out onto the fresh user key.
|
|
58
69
|
* - `retireRosterRecipientAndCascade` -- the same tail for a ceremony that
|
|
59
70
|
* rotates BEFORE its document edit (the two forgets): the minimum
|
|
60
71
|
* controller version at the caller's anchor, one named recipient retired
|
|
@@ -76,8 +87,9 @@ export { assertEnrolledClientKeyRecord, decodeClientKeyRecord, encodeClientKeyRe
|
|
|
76
87
|
export { addUserKeyRosterRecipient, convergeUserKeyRosterToDocument, currentEpochOf, enrolledClientRosterRecipients, ensureUserKeyRoster, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, userKeyRosterLogSigner, userKeyRosterRecipientResolver, readUserKeyRoster, replaceUserKeyRosterRecipients, rosterRecipientKid, rosterRecipientsToRetire, rosterWrapsRecipient, rotateUserKeyRoster } from './userKeyRoster.js';
|
|
77
88
|
export { cascadeCollectionsToUserKey, userKeyAsRecipient, rotateCollectionEpochsToUserKey, unwrapUserKeyGenerations } from './userKeyCascade.js';
|
|
78
89
|
export { anchorRosterStoreAt, retireRosterRecipientAndCascade, rotateRosterToDocumentAndCascade } from './userKeyRosterCascade.js';
|
|
90
|
+
export { collectionDescriptorLogStore } from './collectionLogStore.js';
|
|
79
91
|
export { userKeyRosterDescriptorStore, userKeyRosterPinId } from './rosterStore.js';
|
|
80
|
-
export {
|
|
92
|
+
export { isSealableDescriptorStore } from './rosterLogStore.js';
|
|
81
93
|
export { ensureIndexedFirstEpoch, ensureWalletSpaceEpochs, WalletSpaceProvisioningError, walletSpaceProvisioner } from './spaceEpochs.js';
|
|
82
94
|
export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
|
|
83
95
|
export { wasClientLabelsStore } from './wasLabelsStore.js';
|
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
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG5D,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAA;AAQ7B,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,cAAc,EACd,8BAA8B,EAC9B,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,sBAAsB,EACtB,8BAA8B,EAC9B,iBAAiB,EACjB,8BAA8B,EAC9B,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAK5B,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,2BAA2B,CAAA;AAalC,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAG/D,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -1,7 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The log-governed descriptor store: was-client's generic
|
|
6
|
+
* `logGovernedDescriptorStore` (reads resolve to the VERIFIED head entry's
|
|
7
|
+
* state, writes become signed log appends, a lost race is the
|
|
8
|
+
* `PreconditionFailedError` the recipient loops rebase on, and `seal()` is
|
|
9
|
+
* the sealing sweep) wrapped with the two things the wallet adds, the
|
|
10
|
+
* post-edit minimum controller version and the log's CLASS.
|
|
11
|
+
*
|
|
12
|
+
* The class is stated once, at construction, and the store applies it to
|
|
13
|
+
* every controller view it resolves (`controllerForLogClass`), so both the
|
|
14
|
+
* read-side verification and every append run under the rule the log's class
|
|
15
|
+
* names -- the ceremony-tail license for the user key roster log,
|
|
16
|
+
* `assertionMethod` membership alone for a per-collection encryption
|
|
17
|
+
* descriptor log. Parameterizing the admission rule here is what keeps a
|
|
18
|
+
* call site from exempting itself: a store cannot be built without saying
|
|
19
|
+
* which class of log it governs.
|
|
20
|
+
*
|
|
21
|
+
* This is the enforcement point for "roster state is adopted only from a
|
|
22
|
+
* verified log head": there is no read path around the verifier, and the
|
|
23
|
+
* retired detached `epochsSig` has no successor to check -- the entry
|
|
24
|
+
* proof's controller versionId in the did:webvh document took over its job
|
|
25
|
+
* wholesale.
|
|
26
|
+
*
|
|
27
|
+
* The store is {@link SealableEncryptionDescriptorStore}: `seal()` exposes
|
|
28
|
+
* the resource-log sealing sweep through the descriptor-store seam, so the
|
|
29
|
+
* ceremonies and the login sweep can close the one durable gap the recipient
|
|
30
|
+
* machinery leaves -- a rotation that no-ops (the retiree held no
|
|
31
|
+
* current-epoch wrap) appends nothing, leaving the log's head carrying a
|
|
32
|
+
* controller version before the membership change it should have sealed.
|
|
33
|
+
*/
|
|
34
|
+
import { EPOCH_CONFIGURATION_STATE_TYPE, type EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
35
|
+
import type { ResourceLogPinStore, ResourceLogSigner, ResourceLogStore } from '@interop/vh-resource-log';
|
|
36
|
+
import { type ResourceLogClass, type WebvhResourceLogController } from '../resourceLog/index.js';
|
|
5
37
|
export { EPOCH_CONFIGURATION_STATE_TYPE };
|
|
6
38
|
/**
|
|
7
39
|
* An `EncryptionDescriptorStore` whose resource is governed by a resource
|
|
@@ -52,7 +84,9 @@ export declare function isSealableDescriptorStore(store: EncryptionDescriptorSto
|
|
|
52
84
|
* orchestrator does not leave that freshness to the injected resolver's
|
|
53
85
|
* wiring: it calls `setMinimumControllerVersion` with the view built from the edit's
|
|
54
86
|
* own post-edit log, and a resolver still serving a stale cached view is
|
|
55
|
-
* superseded by it (see the interface doc).
|
|
87
|
+
* superseded by it (see the interface doc). Whichever view wins, the store
|
|
88
|
+
* hands it out under its own log class's admission rule, so a minimum
|
|
89
|
+
* version set by a ceremony cannot smuggle in another class's rule.
|
|
56
90
|
*
|
|
57
91
|
* @param options {object}
|
|
58
92
|
* @param options.log {ResourceLogStore} the log's transport seam
|
|
@@ -66,13 +100,17 @@ export declare function isSealableDescriptorStore(store: EncryptionDescriptorSto
|
|
|
66
100
|
* `resourceLogPinId`
|
|
67
101
|
* @param options.signer {ResourceLogSigner} this client's enrolled signing
|
|
68
102
|
* key, for the appends this store writes
|
|
103
|
+
* @param options.logClass {ResourceLogClass} which class of log this store
|
|
104
|
+
* governs, which is what decides the admission rule its ladder-signed
|
|
105
|
+
* appends run under
|
|
69
106
|
* @returns {SealableEncryptionDescriptorStore}
|
|
70
107
|
*/
|
|
71
|
-
export declare function logGovernedDescriptorStore({ log, resolveController, pinStore, logId, signer }: {
|
|
108
|
+
export declare function logGovernedDescriptorStore({ log, resolveController, pinStore, logId, signer, logClass }: {
|
|
72
109
|
log: ResourceLogStore;
|
|
73
110
|
resolveController: () => Promise<WebvhResourceLogController>;
|
|
74
111
|
pinStore: ResourceLogPinStore;
|
|
75
112
|
logId: string;
|
|
76
113
|
signer: ResourceLogSigner;
|
|
114
|
+
logClass: ResourceLogClass;
|
|
77
115
|
}): SealableEncryptionDescriptorStore;
|
|
78
116
|
//# sourceMappingURL=rosterLogStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterLogStore.d.ts","sourceRoot":"","sources":["../../src/keys/rosterLogStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rosterLogStore.d.ts","sourceRoot":"","sources":["../../src/keys/rosterLogStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAEL,8BAA8B,EAC9B,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,8BAA8B,EAAE,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,iCAAkC,SAAQ,yBAAyB;IAClF,IAAI,IAAI,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAA;IAClC,2BAA2B,CAAC,OAAO,EAAE;QACnC,UAAU,EAAE,0BAA0B,CAAA;KACvC,GAAG,IAAI,CAAA;CACT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,yBAAyB,GAC/B,KAAK,IAAI,iCAAiC,CAM5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,GAAG,EACH,iBAAiB,EACjB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACT,EAAE;IACD,GAAG,EAAE,gBAAgB,CAAA;IACrB,iBAAiB,EAAE,MAAM,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAC5D,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,iBAAiB,CAAA;IACzB,QAAQ,EAAE,gBAAgB,CAAA;CAC3B,GAAG,iCAAiC,CA2DpC"}
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* The log-governed descriptor store:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
5
|
+
* The log-governed descriptor store: was-client's generic
|
|
6
|
+
* `logGovernedDescriptorStore` (reads resolve to the VERIFIED head entry's
|
|
7
|
+
* state, writes become signed log appends, a lost race is the
|
|
8
|
+
* `PreconditionFailedError` the recipient loops rebase on, and `seal()` is
|
|
9
|
+
* the sealing sweep) wrapped with the two things the wallet adds, the
|
|
10
|
+
* post-edit minimum controller version and the log's CLASS.
|
|
11
|
+
*
|
|
12
|
+
* The class is stated once, at construction, and the store applies it to
|
|
13
|
+
* every controller view it resolves (`controllerForLogClass`), so both the
|
|
14
|
+
* read-side verification and every append run under the rule the log's class
|
|
15
|
+
* names -- the ceremony-tail license for the user key roster log,
|
|
16
|
+
* `assertionMethod` membership alone for a per-collection encryption
|
|
17
|
+
* descriptor log. Parameterizing the admission rule here is what keeps a
|
|
18
|
+
* call site from exempting itself: a store cannot be built without saying
|
|
19
|
+
* which class of log it governs.
|
|
18
20
|
*
|
|
19
21
|
* This is the enforcement point for "roster state is adopted only from a
|
|
20
22
|
* verified log head": there is no read path around the verifier, and the
|
|
@@ -29,10 +31,8 @@
|
|
|
29
31
|
* current-epoch wrap) appends nothing, leaving the log's head carrying a
|
|
30
32
|
* controller version before the membership change it should have sealed.
|
|
31
33
|
*/
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { buildResourceLogEntry, buildResourceLogGenesis, confirmAppend, isResourceLogConflictError, ResourceLogClosedError, sealResourceLog, verifyResourceLog, verifyResourceLogAppend } from '@interop/vh-resource-log';
|
|
35
|
-
import { EPOCH_CONFIGURATION_STATE_TYPE, readGovernedEpochConfiguration } from '../descriptors/logSource.js';
|
|
34
|
+
import { logGovernedDescriptorStore as wasLogGovernedDescriptorStore, EPOCH_CONFIGURATION_STATE_TYPE } from '@interop/was-client/edv';
|
|
35
|
+
import { controllerForLogClass } from '../resourceLog/index.js';
|
|
36
36
|
export { EPOCH_CONFIGURATION_STATE_TYPE };
|
|
37
37
|
/**
|
|
38
38
|
* Whether a descriptor store is log-governed and sealable -- the guard the
|
|
@@ -50,26 +50,6 @@ export function isSealableDescriptorStore(store) {
|
|
|
50
50
|
return (typeof candidate.seal === 'function' &&
|
|
51
51
|
typeof candidate.setMinimumControllerVersion === 'function');
|
|
52
52
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Translates the log-store port's CAS conflict (the library's
|
|
55
|
-
* `ResourceLogConflictError`, matched by `name` -- it is minted in the store
|
|
56
|
-
* adapter's package, which may resolve its own library copy) into the
|
|
57
|
-
* `PreconditionFailedError` the `EncryptionDescriptorStore` port documents
|
|
58
|
-
* and was-client's edv recipient loops rebase on. Any other error -- an
|
|
59
|
-
* untranslated `PreconditionFailedError` included -- returns unchanged.
|
|
60
|
-
*
|
|
61
|
-
* @param err {unknown}
|
|
62
|
-
* @returns {unknown} the error to rethrow
|
|
63
|
-
*/
|
|
64
|
-
function asDescriptorStoreConflict(err) {
|
|
65
|
-
if (isResourceLogConflictError(err)) {
|
|
66
|
-
return new PreconditionFailedError(err.message, {
|
|
67
|
-
status: 412,
|
|
68
|
-
cause: err
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return err;
|
|
72
|
-
}
|
|
73
53
|
/**
|
|
74
54
|
* Builds the log-governed `EncryptionDescriptorStore`.
|
|
75
55
|
*
|
|
@@ -80,7 +60,9 @@ function asDescriptorStoreConflict(err) {
|
|
|
80
60
|
* orchestrator does not leave that freshness to the injected resolver's
|
|
81
61
|
* wiring: it calls `setMinimumControllerVersion` with the view built from the edit's
|
|
82
62
|
* own post-edit log, and a resolver still serving a stale cached view is
|
|
83
|
-
* superseded by it (see the interface doc).
|
|
63
|
+
* superseded by it (see the interface doc). Whichever view wins, the store
|
|
64
|
+
* hands it out under its own log class's admission rule, so a minimum
|
|
65
|
+
* version set by a ceremony cannot smuggle in another class's rule.
|
|
84
66
|
*
|
|
85
67
|
* @param options {object}
|
|
86
68
|
* @param options.log {ResourceLogStore} the log's transport seam
|
|
@@ -94,22 +76,34 @@ function asDescriptorStoreConflict(err) {
|
|
|
94
76
|
* `resourceLogPinId`
|
|
95
77
|
* @param options.signer {ResourceLogSigner} this client's enrolled signing
|
|
96
78
|
* key, for the appends this store writes
|
|
79
|
+
* @param options.logClass {ResourceLogClass} which class of log this store
|
|
80
|
+
* governs, which is what decides the admission rule its ladder-signed
|
|
81
|
+
* appends run under
|
|
97
82
|
* @returns {SealableEncryptionDescriptorStore}
|
|
98
83
|
*/
|
|
99
|
-
export function logGovernedDescriptorStore({ log, resolveController, pinStore, logId, signer }) {
|
|
100
|
-
// The verified log observed by the most recent read on this store instance;
|
|
101
|
-
// a replace builds its entry on that head, pinned to the same read's etag,
|
|
102
|
-
// so a stale head loses the CAS instead of forking.
|
|
103
|
-
let lastVerified = null;
|
|
104
|
-
// The controller view `lastVerified` was verified under: the library's
|
|
105
|
-
// pre-write pass reads the head's controller version as an index into
|
|
106
|
-
// THAT view's version list, so a replace may only run it against a view
|
|
107
|
-
// this one is a prefix of.
|
|
108
|
-
let lastVerifiedView = null;
|
|
84
|
+
export function logGovernedDescriptorStore({ log, resolveController, pinStore, logId, signer, logClass }) {
|
|
109
85
|
// The minimum controller version a post-edit ceremony set (see the
|
|
110
86
|
// interface doc).
|
|
111
87
|
let minimumControllerVersion = null;
|
|
88
|
+
/**
|
|
89
|
+
* The view every operation runs under: the freshest of the resolved and
|
|
90
|
+
* minimum views, narrowed to this store's log class.
|
|
91
|
+
*
|
|
92
|
+
* @returns {Promise<WebvhResourceLogController>}
|
|
93
|
+
*/
|
|
112
94
|
async function currentController() {
|
|
95
|
+
return controllerForLogClass({
|
|
96
|
+
controller: await resolvedController(),
|
|
97
|
+
logClass
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The freshness half: the injected resolver's view, superseded by the
|
|
102
|
+
* minimum a post-edit ceremony set when the resolver is behind it.
|
|
103
|
+
*
|
|
104
|
+
* @returns {Promise<WebvhResourceLogController>}
|
|
105
|
+
*/
|
|
106
|
+
async function resolvedController() {
|
|
113
107
|
const resolved = await resolveController();
|
|
114
108
|
if (minimumControllerVersion === null) {
|
|
115
109
|
return resolved;
|
|
@@ -124,199 +118,18 @@ export function logGovernedDescriptorStore({ log, resolveController, pinStore, l
|
|
|
124
118
|
}
|
|
125
119
|
return resolved;
|
|
126
120
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
expectedMethod: RESOURCE_LOG_METHOD,
|
|
137
|
-
pin: await pinStore.read({ logId })
|
|
138
|
-
});
|
|
139
|
-
await pinStore.write({ logId, pin: confirmed.pin });
|
|
140
|
-
lastVerified = confirmed;
|
|
141
|
-
lastVerifiedView = controller;
|
|
142
|
-
}
|
|
143
|
-
const store = {
|
|
144
|
-
async read() {
|
|
145
|
-
let view = null;
|
|
146
|
-
const current = await readGovernedEpochConfiguration({
|
|
147
|
-
store: log,
|
|
148
|
-
resolveController: async () => {
|
|
149
|
-
view = await currentController();
|
|
150
|
-
return view;
|
|
151
|
-
},
|
|
152
|
-
pinStore,
|
|
153
|
-
logId
|
|
154
|
-
});
|
|
155
|
-
if (current === null) {
|
|
156
|
-
lastVerified = null;
|
|
157
|
-
lastVerifiedView = null;
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
lastVerified = current.verified;
|
|
161
|
-
lastVerifiedView = view;
|
|
162
|
-
return {
|
|
163
|
-
descriptor: current.descriptor,
|
|
164
|
-
etag: current.etag
|
|
165
|
-
};
|
|
166
|
-
},
|
|
167
|
-
async replace(descriptor, { ifMatch }) {
|
|
168
|
-
if (ifMatch === undefined) {
|
|
169
|
-
throw new Error('Cannot replace the governed descriptor: the backend returned no ' +
|
|
170
|
-
'validator, and the profile forbids an unconditional write.');
|
|
171
|
-
}
|
|
172
|
-
// An append builds on the head this instance last verified. A replace
|
|
173
|
-
// that no read on this instance precedes -- a caller seeding was-client's
|
|
174
|
-
// compare-and-swap from a read another instance made -- acquires that
|
|
175
|
-
// head now, the one acquisition the seed was meant to save; the
|
|
176
|
-
// caller's validator still guards the append, so a seed behind the
|
|
177
|
-
// served log loses the compare-and-swap as it would anywhere.
|
|
178
|
-
if (lastVerified === null) {
|
|
179
|
-
await store.read();
|
|
180
|
-
}
|
|
181
|
-
if (lastVerified === null) {
|
|
182
|
-
throw new Error('Cannot replace the governed descriptor: the log is absent.');
|
|
183
|
-
}
|
|
184
|
-
if (lastVerified.terminal) {
|
|
185
|
-
throw new ResourceLogClosedError({ nextLog: lastVerified.terminal });
|
|
186
|
-
}
|
|
187
|
-
const controller = await currentController();
|
|
188
|
-
// The pre-write pass's precondition, enforced rather than assumed: the
|
|
189
|
-
// view that verified `lastVerified` must be a prefix of this one (the
|
|
190
|
-
// account log is append-only, so carrying its head version is enough).
|
|
191
|
-
// A resolver that regressed is reported as the port's conflict class,
|
|
192
|
-
// so the edv machinery re-reads under the current view and rebases
|
|
193
|
-
// instead of the pass refusing on a bound that indexes another list.
|
|
194
|
-
const verifiedHead = lastVerifiedView?.versionIds[lastVerifiedView.versionIds.length - 1];
|
|
195
|
-
if (verifiedHead !== undefined &&
|
|
196
|
-
!controller.versionIds.includes(verifiedHead)) {
|
|
197
|
-
throw new PreconditionFailedError('Cannot replace the governed descriptor: the controller view ' +
|
|
198
|
-
`resolved for this write does not carry version "${verifiedHead}", ` +
|
|
199
|
-
'which the preceding read verified against; re-read and retry.', { status: 412 });
|
|
200
|
-
}
|
|
201
|
-
const entry = await buildResourceLogEntry({
|
|
202
|
-
head: lastVerified.head,
|
|
203
|
-
state: toState(descriptor),
|
|
204
|
-
controller,
|
|
205
|
-
signer
|
|
206
|
-
});
|
|
207
|
-
// The library's pre-write pass, run BEFORE the append lands: the entry
|
|
208
|
-
// is verified as a reader would verify it at its ordinal (shape, chain,
|
|
209
|
-
// proof, membership at the head's controller version, and the
|
|
210
|
-
// controller's `admitAppend` hook carrying the ceremony-tail license).
|
|
211
|
-
// Read-back would refuse the same entry anyway, but only after it
|
|
212
|
-
// poisoned the served log for every reader.
|
|
213
|
-
await verifyResourceLogAppend({
|
|
214
|
-
entry,
|
|
215
|
-
controller,
|
|
216
|
-
head: lastVerified
|
|
217
|
-
});
|
|
218
|
-
// A stale validator throws the library's conflict error here,
|
|
219
|
-
// translated back to the PreconditionFailedError the edv machinery's
|
|
220
|
-
// CAS loop re-reads and rebases on (the descriptor-store port's
|
|
221
|
-
// documented class). An untranslated PreconditionFailedError from a
|
|
222
|
-
// store passes through unchanged, already satisfying the port.
|
|
223
|
-
try {
|
|
224
|
-
await log.append(entry, { ifMatch });
|
|
225
|
-
}
|
|
226
|
-
catch (err) {
|
|
227
|
-
throw asDescriptorStoreConflict(err);
|
|
228
|
-
}
|
|
229
|
-
await settle({ entry, controller });
|
|
230
|
-
},
|
|
231
|
-
async create(descriptor) {
|
|
232
|
-
// A held pin means this client has already verified a roster log in
|
|
233
|
-
// this slot, so there is nothing to create. The pinned read refuses an
|
|
234
|
-
// absent log as a rollback (a host hiding the pinned log must not be
|
|
235
|
-
// answered with a fresh genesis over it); a served one is the lost
|
|
236
|
-
// create race, translated so the edv machinery re-reads and adopts it.
|
|
237
|
-
if ((await pinStore.read({ logId })) !== null) {
|
|
238
|
-
await readGovernedEpochConfiguration({
|
|
239
|
-
store: log,
|
|
240
|
-
resolveController: currentController,
|
|
241
|
-
pinStore,
|
|
242
|
-
logId
|
|
243
|
-
});
|
|
244
|
-
throw new PreconditionFailedError('The resource log create lost its guarded-create race: a log is ' +
|
|
245
|
-
'already pinned and served; re-read and adopt it.', { status: 412 });
|
|
246
|
-
}
|
|
247
|
-
const controller = await currentController();
|
|
248
|
-
const genesis = await buildResourceLogGenesis({
|
|
249
|
-
state: toState(descriptor),
|
|
250
|
-
method: RESOURCE_LOG_METHOD,
|
|
251
|
-
controller,
|
|
252
|
-
signer
|
|
253
|
-
});
|
|
254
|
-
// The pre-write pass for a genesis: verified as a one-entry log before
|
|
255
|
-
// anything is created, so a non-member signer never leaves behind a
|
|
256
|
-
// log no reader accepts. `pin: null` is deliberate: the candidate is
|
|
257
|
-
// not served history, and continuity belongs to the read-back.
|
|
258
|
-
try {
|
|
259
|
-
await verifyResourceLog({
|
|
260
|
-
entries: [genesis],
|
|
261
|
-
controller,
|
|
262
|
-
expectedMethod: RESOURCE_LOG_METHOD,
|
|
263
|
-
pin: null
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
catch (err) {
|
|
267
|
-
// A refused genesis against a log that already exists is a lost
|
|
268
|
-
// create race (matched by name: the class may come from another
|
|
269
|
-
// library copy), translated to the port's conflict class so the edv
|
|
270
|
-
// machinery re-reads and adopts the winner's descriptor. With no log
|
|
271
|
-
// served, or on any other class (a port bug), the error propagates
|
|
272
|
-
// with nothing adopted.
|
|
273
|
-
if (!(err instanceof Error && err.name === 'ResourceLogIntegrityError')) {
|
|
274
|
-
throw err;
|
|
275
|
-
}
|
|
276
|
-
if ((await log.read()) === null) {
|
|
277
|
-
throw err;
|
|
278
|
-
}
|
|
279
|
-
throw new PreconditionFailedError('The resource log create lost its guarded-create race: the genesis ' +
|
|
280
|
-
`was refused pre-write (${err.message}) and a log is already ` +
|
|
281
|
-
'served; re-read and adopt it.', { status: 412, cause: err });
|
|
282
|
-
}
|
|
283
|
-
// A lost guarded-create race throws the library's conflict error,
|
|
284
|
-
// translated so the edv machinery re-reads and adopts the winner's
|
|
285
|
-
// descriptor.
|
|
286
|
-
try {
|
|
287
|
-
await log.create(genesis);
|
|
288
|
-
}
|
|
289
|
-
catch (err) {
|
|
290
|
-
throw asDescriptorStoreConflict(err);
|
|
291
|
-
}
|
|
292
|
-
await settle({ entry: genesis, controller });
|
|
293
|
-
},
|
|
294
|
-
async seal() {
|
|
295
|
-
const controller = await currentController();
|
|
296
|
-
// Reuse the log view the most recent read or confirmed append on this
|
|
297
|
-
// store instance verified: a rotation that just appended carries a
|
|
298
|
-
// version past the removal, so the sweep resolves noop with no
|
|
299
|
-
// re-fetch, and a stale view is safe (sealResourceLog's append path
|
|
300
|
-
// re-reads before writing).
|
|
301
|
-
const { sealed, verified } = await sealResourceLog({
|
|
302
|
-
store: log,
|
|
303
|
-
controller,
|
|
304
|
-
expectedMethod: RESOURCE_LOG_METHOD,
|
|
305
|
-
pinStore,
|
|
306
|
-
logId,
|
|
307
|
-
signer,
|
|
308
|
-
...(lastVerified === null ? {} : { verified: lastVerified })
|
|
309
|
-
});
|
|
310
|
-
if (verified !== null) {
|
|
311
|
-
lastVerified = verified;
|
|
312
|
-
lastVerifiedView = controller;
|
|
313
|
-
}
|
|
314
|
-
return sealed ? 'sealed' : 'noop';
|
|
315
|
-
},
|
|
121
|
+
const store = wasLogGovernedDescriptorStore({
|
|
122
|
+
log,
|
|
123
|
+
resolveController: currentController,
|
|
124
|
+
pinStore,
|
|
125
|
+
logId,
|
|
126
|
+
signer
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
...store,
|
|
316
130
|
setMinimumControllerVersion({ controller }) {
|
|
317
131
|
minimumControllerVersion = controller;
|
|
318
132
|
}
|
|
319
133
|
};
|
|
320
|
-
return store;
|
|
321
134
|
}
|
|
322
135
|
//# sourceMappingURL=rosterLogStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterLogStore.js","sourceRoot":"","sources":["../../src/keys/rosterLogStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"rosterLogStore.js","sourceRoot":"","sources":["../../src/keys/rosterLogStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EACL,0BAA0B,IAAI,6BAA6B,EAC3D,8BAA8B,EAE/B,MAAM,yBAAyB,CAAA;AAMhC,OAAO,EACL,qBAAqB,EAGtB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,8BAA8B,EAAE,CAAA;AA8BzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAgC;IAEhC,MAAM,SAAS,GAAG,KAAmD,CAAA;IACrE,OAAO,CACL,OAAO,SAAS,CAAC,IAAI,KAAK,UAAU;QACpC,OAAO,SAAS,CAAC,2BAA2B,KAAK,UAAU,CAC5D,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,GAAG,EACH,iBAAiB,EACjB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EAQT;IACC,mEAAmE;IACnE,kBAAkB;IAClB,IAAI,wBAAwB,GAAsC,IAAI,CAAA;IAEtE;;;;;OAKG;IACH,KAAK,UAAU,iBAAiB;QAC9B,OAAO,qBAAqB,CAAC;YAC3B,UAAU,EAAE,MAAM,kBAAkB,EAAE;YACtC,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,UAAU,kBAAkB;QAC/B,MAAM,QAAQ,GAAG,MAAM,iBAAiB,EAAE,CAAA;QAC1C,IAAI,wBAAwB,KAAK,IAAI,EAAE,CAAC;YACtC,OAAO,QAAQ,CAAA;QACjB,CAAC;QACD,MAAM,WAAW,GACf,wBAAwB,CAAC,UAAU,CACjC,wBAAwB,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAC/C,CAAA;QACH,uEAAuE;QACvE,sEAAsE;QACtE,oDAAoD;QACpD,IACE,WAAW,KAAK,SAAS;YACzB,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,EAC1C,CAAC;YACD,OAAO,wBAAwB,CAAA;QACjC,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,KAAK,GAAG,6BAA6B,CAAC;QAC1C,GAAG;QACH,iBAAiB,EAAE,iBAAiB;QACpC,QAAQ;QACR,KAAK;QACL,MAAM;KACP,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,KAAK;QACR,2BAA2B,CAAC,EAAE,UAAU,EAAE;YACxC,wBAAwB,GAAG,UAAU,CAAA;QACvC,CAAC;KACF,CAAA;AACH,CAAC"}
|