@interop/wallet-core 0.23.1 → 0.25.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.
Files changed (125) hide show
  1. package/README.md +41 -22
  2. package/dist/clients/index.d.ts +6 -4
  3. package/dist/clients/index.d.ts.map +1 -1
  4. package/dist/clients/index.js +5 -3
  5. package/dist/clients/index.js.map +1 -1
  6. package/dist/clients/policy.d.ts +11 -3
  7. package/dist/clients/policy.d.ts.map +1 -1
  8. package/dist/clients/policy.js +12 -4
  9. package/dist/clients/policy.js.map +1 -1
  10. package/dist/clients/revocation.d.ts +24 -9
  11. package/dist/clients/revocation.d.ts.map +1 -1
  12. package/dist/clients/revocation.js +23 -10
  13. package/dist/clients/revocation.js.map +1 -1
  14. package/dist/clients/rosterPolicy.d.ts +23 -22
  15. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  16. package/dist/clients/rosterPolicy.js +50 -31
  17. package/dist/clients/rosterPolicy.js.map +1 -1
  18. package/dist/descriptors/acquire.d.ts +4 -1
  19. package/dist/descriptors/acquire.d.ts.map +1 -1
  20. package/dist/descriptors/acquire.js +29 -1
  21. package/dist/descriptors/acquire.js.map +1 -1
  22. package/dist/descriptors/index.d.ts +9 -1
  23. package/dist/descriptors/index.d.ts.map +1 -1
  24. package/dist/descriptors/index.js +9 -1
  25. package/dist/descriptors/index.js.map +1 -1
  26. package/dist/descriptors/logSource.d.ts +33 -0
  27. package/dist/descriptors/logSource.d.ts.map +1 -0
  28. package/dist/descriptors/logSource.js +49 -0
  29. package/dist/descriptors/logSource.js.map +1 -0
  30. package/dist/enrollment/enrollment.d.ts +2 -2
  31. package/dist/enrollment/enrollment.d.ts.map +1 -1
  32. package/dist/enrollment/enrollment.js +15 -10
  33. package/dist/enrollment/enrollment.js.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/keys/index.d.ts +15 -8
  37. package/dist/keys/index.d.ts.map +1 -1
  38. package/dist/keys/index.js +14 -8
  39. package/dist/keys/index.js.map +1 -1
  40. package/dist/keys/rosterLogStore.d.ts +53 -0
  41. package/dist/keys/rosterLogStore.d.ts.map +1 -0
  42. package/dist/keys/rosterLogStore.js +134 -0
  43. package/dist/keys/rosterLogStore.js.map +1 -0
  44. package/dist/keys/rosterStore.d.ts +20 -6
  45. package/dist/keys/rosterStore.d.ts.map +1 -1
  46. package/dist/keys/rosterStore.js +36 -17
  47. package/dist/keys/rosterStore.js.map +1 -1
  48. package/dist/keys/userKeyCascade.d.ts +14 -7
  49. package/dist/keys/userKeyCascade.d.ts.map +1 -1
  50. package/dist/keys/userKeyCascade.js +12 -3
  51. package/dist/keys/userKeyCascade.js.map +1 -1
  52. package/dist/keys/userKeyRoster.d.ts +50 -97
  53. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  54. package/dist/keys/userKeyRoster.js +44 -145
  55. package/dist/keys/userKeyRoster.js.map +1 -1
  56. package/dist/request/appKey.d.ts +255 -0
  57. package/dist/request/appKey.d.ts.map +1 -0
  58. package/dist/request/appKey.js +492 -0
  59. package/dist/request/appKey.js.map +1 -0
  60. package/dist/request/classify.d.ts +54 -3
  61. package/dist/request/classify.d.ts.map +1 -1
  62. package/dist/request/classify.js +106 -0
  63. package/dist/request/classify.js.map +1 -1
  64. package/dist/request/composeVp.d.ts +6 -7
  65. package/dist/request/composeVp.d.ts.map +1 -1
  66. package/dist/request/composeVp.js +44 -55
  67. package/dist/request/composeVp.js.map +1 -1
  68. package/dist/request/index.d.ts +4 -0
  69. package/dist/request/index.d.ts.map +1 -1
  70. package/dist/request/index.js +4 -0
  71. package/dist/request/index.js.map +1 -1
  72. package/dist/request/processRequest.d.ts +1 -4
  73. package/dist/request/processRequest.d.ts.map +1 -1
  74. package/dist/request/processRequest.js +17 -11
  75. package/dist/request/processRequest.js.map +1 -1
  76. package/dist/request/types.d.ts +45 -2
  77. package/dist/request/types.d.ts.map +1 -1
  78. package/dist/resourceLog/append.d.ts +103 -0
  79. package/dist/resourceLog/append.d.ts.map +1 -0
  80. package/dist/resourceLog/append.js +190 -0
  81. package/dist/resourceLog/append.js.map +1 -0
  82. package/dist/resourceLog/controller.d.ts +57 -0
  83. package/dist/resourceLog/controller.d.ts.map +1 -0
  84. package/dist/resourceLog/controller.js +81 -0
  85. package/dist/resourceLog/controller.js.map +1 -0
  86. package/dist/resourceLog/entry.d.ts +68 -0
  87. package/dist/resourceLog/entry.d.ts.map +1 -0
  88. package/dist/resourceLog/entry.js +167 -0
  89. package/dist/resourceLog/entry.js.map +1 -0
  90. package/dist/resourceLog/errors.d.ts +75 -0
  91. package/dist/resourceLog/errors.d.ts.map +1 -0
  92. package/dist/resourceLog/errors.js +76 -0
  93. package/dist/resourceLog/errors.js.map +1 -0
  94. package/dist/resourceLog/index.d.ts +26 -0
  95. package/dist/resourceLog/index.d.ts.map +1 -0
  96. package/dist/resourceLog/index.js +26 -0
  97. package/dist/resourceLog/index.js.map +1 -0
  98. package/dist/resourceLog/pin.d.ts +44 -0
  99. package/dist/resourceLog/pin.d.ts.map +1 -0
  100. package/dist/resourceLog/pin.js +32 -0
  101. package/dist/resourceLog/pin.js.map +1 -0
  102. package/dist/resourceLog/seal.d.ts +86 -0
  103. package/dist/resourceLog/seal.d.ts.map +1 -0
  104. package/dist/resourceLog/seal.js +99 -0
  105. package/dist/resourceLog/seal.js.map +1 -0
  106. package/dist/resourceLog/verify.d.ts +95 -0
  107. package/dist/resourceLog/verify.d.ts.map +1 -0
  108. package/dist/resourceLog/verify.js +435 -0
  109. package/dist/resourceLog/verify.js.map +1 -0
  110. package/dist/space/collections.d.ts +14 -11
  111. package/dist/space/collections.d.ts.map +1 -1
  112. package/dist/space/collections.js +14 -11
  113. package/dist/space/collections.js.map +1 -1
  114. package/dist/space/index.d.ts +2 -2
  115. package/dist/space/index.d.ts.map +1 -1
  116. package/dist/space/index.js +2 -2
  117. package/dist/space/index.js.map +1 -1
  118. package/dist/webvh/didWeb.d.ts +4 -6
  119. package/dist/webvh/didWeb.d.ts.map +1 -1
  120. package/dist/webvh/didWeb.js.map +1 -1
  121. package/dist/webvh/didWebvh.d.ts +1 -2
  122. package/dist/webvh/didWebvh.d.ts.map +1 -1
  123. package/dist/webvh/didWebvh.js +1 -6
  124. package/dist/webvh/didWebvh.js.map +1 -1
  125. package/package.json +11 -4
@@ -13,13 +13,18 @@
13
13
  * strict validation of the local client-key record each client keeps its own
14
14
  * key material in (storage and wrapping stay app-side).
15
15
  * - `ensureUserKeyRoster` / `addUserKeyRosterRecipient` / `readUserKeyRoster` /
16
- * `userKeyRosterRecipientResolver` -- the `key-map/user-key.json` roster over the
17
- * was-client descriptor-store seam, with the three client-side guards a
18
- * resource-hosted descriptor needs (`epochsMac`, the latest-seen epoch pin,
19
- * and a recipient resolver backed by the locally verified did:webvh
20
- * document).
21
- * - `userKeyRosterDescriptorStore` -- that descriptor store, built from a bare
22
- * signing client for the login-time direct read.
16
+ * `userKeyRosterRecipientResolver` -- the user key roster over the
17
+ * was-client descriptor-store seam, with the client-side guards a
18
+ * resource-hosted descriptor needs (the governing resource log, the
19
+ * latest-seen epoch pin, and a recipient resolver backed by the locally
20
+ * verified did:webvh document).
21
+ * - `userKeyRosterDescriptorStore` / `logGovernedDescriptorStore` -- that
22
+ * descriptor store: reads resolve to the roster log's verified head
23
+ * (`key-map/user-key.jsonl`), writes append signed entries; built from a
24
+ * bare signing client for the login-time direct read. Sealable
25
+ * (`SealableEncryptionDescriptorStore` / `isSealableDescriptorStore`):
26
+ * `seal()` appends the idempotent backstop entry when the log's head still
27
+ * anchors before the account document's latest membership change.
23
28
  * - `rosterRecipientKid` -- the one builder of a client's roster kid, shared by
24
29
  * the enrollment wrap, the roster read, and the rotation that retires it.
25
30
  * - `convergeUserKeyRosterToDocument` -- the standing detector for a revocation
@@ -42,9 +47,10 @@
42
47
  */
43
48
  export { mintUserKey, userKeyVaultKeys } from './userKey.js';
44
49
  export { assertEnrolledClientKeyRecord, decodeClientKeyRecord, encodeClientKeyRecord, parseClientRecordUserKey, parseClientRecordWebvhKeys } from './clientKeyRecord.js';
45
- export { addUserKeyRosterRecipient, convergeUserKeyRosterToDocument, ensureUserKeyRoster, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, userKeyRosterEpochsSigner, userKeyRosterRecipientResolver, readUserKeyRoster, rosterRecipientKid, rotateUserKeyRoster, verifyUserKeyRosterEpochsSig } from './userKeyRoster.js';
50
+ export { addUserKeyRosterRecipient, convergeUserKeyRosterToDocument, ensureUserKeyRoster, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, userKeyRosterLogSigner, userKeyRosterRecipientResolver, readUserKeyRoster, rosterRecipientKid, rotateUserKeyRoster } from './userKeyRoster.js';
46
51
  export { cascadeCollectionsToUserKey, userKeyAsRecipient, rotateCollectionEpochsToUserKey, unwrapUserKeyGenerations } from './userKeyCascade.js';
47
52
  export { userKeyRosterDescriptorStore } from './rosterStore.js';
53
+ export { EPOCH_CONFIGURATION_STATE_TYPE, isSealableDescriptorStore, logGovernedDescriptorStore } from './rosterLogStore.js';
48
54
  export { ensureWalletSpaceEpochs } from './spaceEpochs.js';
49
55
  export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
50
56
  export { wasClientLabelsStore } from './wasLabelsStore.js';
@@ -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,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O,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"}
@@ -0,0 +1,53 @@
1
+ import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
2
+ import { type ResourceLogStore } from '@interop/was-client/log';
3
+ import { type ResourceLogController, type ResourceLogPinStore, type ResourceLogSigner } from '../resourceLog/index.js';
4
+ import { EPOCH_CONFIGURATION_STATE_TYPE } from '../descriptors/logSource.js';
5
+ export { EPOCH_CONFIGURATION_STATE_TYPE };
6
+ /**
7
+ * An `EncryptionDescriptorStore` whose resource is governed by a resource
8
+ * log, and can therefore be SEALED: `seal()` runs the sealing sweep
9
+ * (`sealResourceLog`) against the caller's currently verified controller
10
+ * view, appending the idempotent no-op backstop entry when the log's head
11
+ * still anchors before the controller's latest membership change --
12
+ * `'sealed'` -- and writing nothing when the log is already sealed, absent,
13
+ * or has no membership change to seal against -- `'noop'`.
14
+ */
15
+ export interface SealableEncryptionDescriptorStore extends EncryptionDescriptorStore {
16
+ seal(): Promise<'sealed' | 'noop'>;
17
+ }
18
+ /**
19
+ * Whether a descriptor store is log-governed and sealable -- the guard the
20
+ * ceremonies and sweeps use to run the seal backstop only where a governing
21
+ * log exists (an ordinary Collection-Description-backed store has nothing to
22
+ * seal).
23
+ *
24
+ * @param store {EncryptionDescriptorStore}
25
+ * @returns {boolean}
26
+ */
27
+ export declare function isSealableDescriptorStore(store: EncryptionDescriptorStore): store is SealableEncryptionDescriptorStore;
28
+ /**
29
+ * Builds the log-governed `EncryptionDescriptorStore`.
30
+ *
31
+ * The controller view is resolved per operation (never held), so a caller
32
+ * that just edited the account document -- a revocation about to rotate the
33
+ * roster -- writes entries anchored at the post-edit head it now verifies,
34
+ * which is exactly what makes its rotation the sealing append.
35
+ *
36
+ * @param options {object}
37
+ * @param options.log {ResourceLogStore} the log's transport seam
38
+ * @param options.resolveController {function} `() => Promise<ResourceLogController>`
39
+ * -- the caller's currently verified controller view
40
+ * (`webvhResourceLogController` over a `verifyAccountLog` result)
41
+ * @param options.pinStore {ResourceLogPinStore} this client's chain-head pin
42
+ * for this log
43
+ * @param options.signer {ResourceLogSigner} this client's enrolled signing
44
+ * key, for the appends this store writes
45
+ * @returns {SealableEncryptionDescriptorStore}
46
+ */
47
+ export declare function logGovernedDescriptorStore({ log, resolveController, pinStore, signer }: {
48
+ log: ResourceLogStore;
49
+ resolveController: () => Promise<ResourceLogController>;
50
+ pinStore: ResourceLogPinStore;
51
+ signer: ResourceLogSigner;
52
+ }): SealableEncryptionDescriptorStore;
53
+ //# sourceMappingURL=rosterLogStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rosterLogStore.d.ts","sourceRoot":"","sources":["../../src/keys/rosterLogStore.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAQL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEvB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,8BAA8B,EAAE,CAAA;AAEzC;;;;;;;;GAQG;AACH,MAAM,WAAW,iCAAkC,SAAQ,yBAAyB;IAClF,IAAI,IAAI,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAA;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,yBAAyB,GAC/B,KAAK,IAAI,iCAAiC,CAK5C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,GAAG,EACH,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACP,EAAE;IACD,GAAG,EAAE,gBAAgB,CAAA;IACrB,iBAAiB,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACvD,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,iBAAiB,CAAA;CAC1B,GAAG,iCAAiC,CAoHpC"}
@@ -0,0 +1,134 @@
1
+ import { confirmAppend, WAS_RESOURCE_LOG_METHOD } from '@interop/was-client/log';
2
+ import { buildResourceLogEntry, buildResourceLogGenesis, readResourceLog, ResourceLogClosedError, ResourceLogIntegrityError, sealResourceLog, verifyResourceLog } from '../resourceLog/index.js';
3
+ import { EPOCH_CONFIGURATION_STATE_TYPE } from '../descriptors/logSource.js';
4
+ export { EPOCH_CONFIGURATION_STATE_TYPE };
5
+ /**
6
+ * Whether a descriptor store is log-governed and sealable -- the guard the
7
+ * ceremonies and sweeps use to run the seal backstop only where a governing
8
+ * log exists (an ordinary Collection-Description-backed store has nothing to
9
+ * seal).
10
+ *
11
+ * @param store {EncryptionDescriptorStore}
12
+ * @returns {boolean}
13
+ */
14
+ export function isSealableDescriptorStore(store) {
15
+ return (typeof store.seal ===
16
+ 'function');
17
+ }
18
+ /**
19
+ * Builds the log-governed `EncryptionDescriptorStore`.
20
+ *
21
+ * The controller view is resolved per operation (never held), so a caller
22
+ * that just edited the account document -- a revocation about to rotate the
23
+ * roster -- writes entries anchored at the post-edit head it now verifies,
24
+ * which is exactly what makes its rotation the sealing append.
25
+ *
26
+ * @param options {object}
27
+ * @param options.log {ResourceLogStore} the log's transport seam
28
+ * @param options.resolveController {function} `() => Promise<ResourceLogController>`
29
+ * -- the caller's currently verified controller view
30
+ * (`webvhResourceLogController` over a `verifyAccountLog` result)
31
+ * @param options.pinStore {ResourceLogPinStore} this client's chain-head pin
32
+ * for this log
33
+ * @param options.signer {ResourceLogSigner} this client's enrolled signing
34
+ * key, for the appends this store writes
35
+ * @returns {SealableEncryptionDescriptorStore}
36
+ */
37
+ export function logGovernedDescriptorStore({ log, resolveController, pinStore, signer }) {
38
+ // The verified log observed by the most recent read on this store instance;
39
+ // a replace builds its entry on that head, pinned to the same read's etag,
40
+ // so a stale head loses the CAS instead of forking.
41
+ let lastVerified = null;
42
+ function toState(descriptor) {
43
+ const { history: _history, ...rest } = descriptor;
44
+ return { ...rest, type: EPOCH_CONFIGURATION_STATE_TYPE };
45
+ }
46
+ async function settle({ entry, controller }) {
47
+ const readBack = await confirmAppend({ store: log, entry });
48
+ const confirmed = await verifyResourceLog({
49
+ entries: readBack.entries,
50
+ controller,
51
+ expectedMethod: WAS_RESOURCE_LOG_METHOD,
52
+ pin: await pinStore.read()
53
+ });
54
+ await pinStore.write(confirmed.pin);
55
+ lastVerified = confirmed;
56
+ }
57
+ return {
58
+ async read() {
59
+ const controller = await resolveController();
60
+ const current = await readResourceLog({
61
+ store: log,
62
+ controller,
63
+ expectedMethod: WAS_RESOURCE_LOG_METHOD,
64
+ pinStore
65
+ });
66
+ if (current === null) {
67
+ lastVerified = null;
68
+ return null;
69
+ }
70
+ const state = current.verified.state;
71
+ if (state.type !== EPOCH_CONFIGURATION_STATE_TYPE) {
72
+ throw new ResourceLogIntegrityError(`The governed descriptor log carries state of type ` +
73
+ `"${state.type}", not "${EPOCH_CONFIGURATION_STATE_TYPE}".`);
74
+ }
75
+ lastVerified = current.verified;
76
+ return {
77
+ descriptor: state,
78
+ etag: current.etag
79
+ };
80
+ },
81
+ async replace(descriptor, { ifMatch }) {
82
+ if (lastVerified === null) {
83
+ throw new Error('Cannot replace the governed descriptor: replace must follow a ' +
84
+ 'read on the same store instance.');
85
+ }
86
+ if (ifMatch === undefined) {
87
+ throw new Error('Cannot replace the governed descriptor: the backend returned no ' +
88
+ 'validator, and the profile forbids an unconditional write.');
89
+ }
90
+ if (lastVerified.terminal) {
91
+ throw new ResourceLogClosedError({ nextLog: lastVerified.terminal });
92
+ }
93
+ const controller = await resolveController();
94
+ const entry = await buildResourceLogEntry({
95
+ head: lastVerified.head,
96
+ state: toState(descriptor),
97
+ controller,
98
+ signer
99
+ });
100
+ // A stale validator throws PreconditionFailedError here, which the edv
101
+ // machinery's CAS loop re-reads and rebases on.
102
+ await log.append(entry, { ifMatch });
103
+ await settle({ entry, controller });
104
+ },
105
+ async create(descriptor) {
106
+ const controller = await resolveController();
107
+ const genesis = await buildResourceLogGenesis({
108
+ state: toState(descriptor),
109
+ method: WAS_RESOURCE_LOG_METHOD,
110
+ controller,
111
+ signer
112
+ });
113
+ // A lost guarded-create race throws PreconditionFailedError, and the
114
+ // edv machinery re-reads and adopts the winner's descriptor.
115
+ await log.create(genesis);
116
+ await settle({ entry: genesis, controller });
117
+ },
118
+ async seal() {
119
+ const controller = await resolveController();
120
+ const { sealed, verified } = await sealResourceLog({
121
+ store: log,
122
+ controller,
123
+ expectedMethod: WAS_RESOURCE_LOG_METHOD,
124
+ pinStore,
125
+ signer
126
+ });
127
+ if (verified !== null) {
128
+ lastVerified = verified;
129
+ }
130
+ return sealed ? 'sealed' : 'noop';
131
+ }
132
+ };
133
+ }
134
+ //# sourceMappingURL=rosterLogStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rosterLogStore.js","sourceRoot":"","sources":["../../src/keys/rosterLogStore.ts"],"names":[],"mappings":"AA6BA,OAAO,EACL,aAAa,EACb,uBAAuB,EAExB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EAKlB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,8BAA8B,EAAE,CAAA;AAezC;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAgC;IAEhC,OAAO,CACL,OAAQ,KAAoD,CAAC,IAAI;QACjE,UAAU,CACX,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAA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GAAG,MAAM,uBAAuB,CAAC;gBAC5C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC;gBAC1B,MAAM,EAAE,uBAAuB;gBAC/B,UAAU;gBACV,MAAM;aACP,CAAC,CAAA;YACF,qEAAqE;YACrE,6DAA6D;YAC7D,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YACzB,MAAM,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;QAC9C,CAAC;QAED,KAAK,CAAC,IAAI;YACR,MAAM,UAAU,GAAG,MAAM,iBAAiB,EAAE,CAAA;YAC5C,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,eAAe,CAAC;gBACjD,KAAK,EAAE,GAAG;gBACV,UAAU;gBACV,cAAc,EAAE,uBAAuB;gBACvC,QAAQ;gBACR,MAAM;aACP,CAAC,CAAA;YACF,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACtB,YAAY,GAAG,QAAQ,CAAA;YACzB,CAAC;YACD,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAA;QACnC,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1,18 +1,32 @@
1
1
  import type { ZcapClient } from '@interop/ezcap';
2
- import { type EncryptionDescriptorStore } from '@interop/was-client/edv';
2
+ import type { ResourceLogController, ResourceLogPinStore, ResourceLogSigner } from '../resourceLog/index.js';
3
+ import { type SealableEncryptionDescriptorStore } from './rosterLogStore.js';
3
4
  /**
4
- * Builds the compare-and-swap descriptor store over `key-map/user-key.json` in
5
- * a data Space.
5
+ * Builds the log-governed descriptor store over the user key roster in a
6
+ * data Space: reads resolve to the verified head of
7
+ * `key-map/user-key.jsonl`, writes append to it.
6
8
  *
7
9
  * @param options {object}
8
10
  * @param options.storageServerUrl {string}
9
11
  * @param options.zcapClient {ZcapClient} the session's root signing client
10
12
  * @param options.spaceId {string} the data Space id
11
- * @returns {EncryptionDescriptorStore}
13
+ * @param options.resolveController {function}
14
+ * `() => Promise<ResourceLogController>` -- the caller's currently verified
15
+ * controller view (`webvhResourceLogController` over a `verifyAccountLog`
16
+ * result), resolved per operation so post-edit writers anchor at the head
17
+ * they just verified
18
+ * @param options.pinStore {ResourceLogPinStore} this client's chain-head
19
+ * pin for the roster log
20
+ * @param options.signer {ResourceLogSigner} this client's enrolled signing
21
+ * key ({@link userKeyRosterLogSigner})
22
+ * @returns {SealableEncryptionDescriptorStore}
12
23
  */
13
- export declare function userKeyRosterDescriptorStore({ storageServerUrl, zcapClient, spaceId }: {
24
+ export declare function userKeyRosterDescriptorStore({ storageServerUrl, zcapClient, spaceId, resolveController, pinStore, signer }: {
14
25
  storageServerUrl: string;
15
26
  zcapClient: ZcapClient;
16
27
  spaceId: string;
17
- }): EncryptionDescriptorStore;
28
+ resolveController: () => Promise<ResourceLogController>;
29
+ pinStore: ResourceLogPinStore;
30
+ signer: ResourceLogSigner;
31
+ }): SealableEncryptionDescriptorStore;
18
32
  //# sourceMappingURL=rosterStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rosterStore.d.ts","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAA;AAMhC;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,UAAU,EACV,OAAO,EACR,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,yBAAyB,CAQ5B"}
1
+ {"version":3,"file":"rosterStore.d.ts","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,yBAAyB,CAAA;AAKhC,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACP,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACvD,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,iBAAiB,CAAA;CAC1B,GAAG,iCAAiC,CAapC"}
@@ -2,37 +2,56 @@
2
2
  * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
3
  */
4
4
  /**
5
- * The descriptor store over a Space's user key wrap-set roster
6
- * (`key-map/user-key.json`). Standalone rather than a method on a wallet's
7
- * remote-store class, because the login-time direct read checks the roster
8
- * BEFORE any storage client (or cipher) is built: it takes the bare signing
9
- * client instead of a store instance.
5
+ * The descriptor store over a Space's user key wrap-set roster -- since the
6
+ * roster became log-governed, over its resource log (`key-map/user-key.jsonl`).
7
+ * Standalone rather than a method on a wallet's remote-store class, because the
8
+ * login-time direct read checks the roster BEFORE any storage client (or
9
+ * cipher) is built: it takes the bare signing client instead of a store
10
+ * instance.
10
11
  *
11
- * The `plaintext` collection override is load-bearing. Without it the client
12
- * decides plaintext vs encrypted by describing the collection first, and a 404
13
- * from an absent Space or collection then surfaces as an encryption error
14
- * rather than as an absent roster.
12
+ * The `plaintext` collection override is load-bearing twice over. Without it
13
+ * the client decides plaintext vs encrypted by describing the collection
14
+ * first, and a 404 from an absent Space or collection then surfaces as an
15
+ * encryption error rather than as an absent roster; and on an encrypted
16
+ * collection the EDV codec would compute the write preconditions itself, so
17
+ * the log's compare-and-swap append guard would not be honored.
15
18
  */
16
19
  import { WasClient } from '@interop/was-client';
17
- import { resourceDescriptorStore } from '@interop/was-client/edv';
18
- import { KEY_MAP_COLLECTION, USER_KEY_ROSTER_RESOURCE } from '../space/collections.js';
20
+ import { resourceLogStore } from '@interop/was-client/log';
21
+ import { KEY_MAP_COLLECTION, USER_KEY_ROSTER_LOG_RESOURCE } from '../space/collections.js';
22
+ import { logGovernedDescriptorStore } from './rosterLogStore.js';
19
23
  /**
20
- * Builds the compare-and-swap descriptor store over `key-map/user-key.json` in
21
- * a data Space.
24
+ * Builds the log-governed descriptor store over the user key roster in a
25
+ * data Space: reads resolve to the verified head of
26
+ * `key-map/user-key.jsonl`, writes append to it.
22
27
  *
23
28
  * @param options {object}
24
29
  * @param options.storageServerUrl {string}
25
30
  * @param options.zcapClient {ZcapClient} the session's root signing client
26
31
  * @param options.spaceId {string} the data Space id
27
- * @returns {EncryptionDescriptorStore}
32
+ * @param options.resolveController {function}
33
+ * `() => Promise<ResourceLogController>` -- the caller's currently verified
34
+ * controller view (`webvhResourceLogController` over a `verifyAccountLog`
35
+ * result), resolved per operation so post-edit writers anchor at the head
36
+ * they just verified
37
+ * @param options.pinStore {ResourceLogPinStore} this client's chain-head
38
+ * pin for the roster log
39
+ * @param options.signer {ResourceLogSigner} this client's enrolled signing
40
+ * key ({@link userKeyRosterLogSigner})
41
+ * @returns {SealableEncryptionDescriptorStore}
28
42
  */
29
- export function userKeyRosterDescriptorStore({ storageServerUrl, zcapClient, spaceId }) {
43
+ export function userKeyRosterDescriptorStore({ storageServerUrl, zcapClient, spaceId, resolveController, pinStore, signer }) {
30
44
  const was = new WasClient({ serverUrl: storageServerUrl, zcapClient });
31
45
  const collection = was
32
46
  .space(spaceId)
33
47
  .collection(KEY_MAP_COLLECTION.id, { encryption: 'plaintext' });
34
- return resourceDescriptorStore({
35
- resource: collection.resource(USER_KEY_ROSTER_RESOURCE)
48
+ return logGovernedDescriptorStore({
49
+ log: resourceLogStore({
50
+ resource: collection.resource(USER_KEY_ROSTER_LOG_RESOURCE)
51
+ }),
52
+ resolveController,
53
+ pinStore,
54
+ signer
36
55
  });
37
56
  }
38
57
  //# sourceMappingURL=rosterStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rosterStore.js","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EACL,uBAAuB,EAExB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,yBAAyB,CAAA;AAEhC;;;;;;;;;GASG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,UAAU,EACV,OAAO,EAKR;IACC,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAA;IACtE,MAAM,UAAU,GAAG,GAAG;SACnB,KAAK,CAAC,OAAO,CAAC;SACd,UAAU,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAA;IACjE,OAAO,uBAAuB,CAAC;QAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,wBAAwB,CAAC;KACxD,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"rosterStore.js","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAM1D,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,0BAA0B,EAE3B,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,MAAM,EAQP;IACC,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAA;IACtE,MAAM,UAAU,GAAG,GAAG;SACnB,KAAK,CAAC,OAAO,CAAC;SACd,UAAU,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAA;IACjE,OAAO,0BAA0B,CAAC;QAChC,GAAG,EAAE,gBAAgB,CAAC;YACpB,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,4BAA4B,CAAC;SAC5D,CAAC;QACF,iBAAiB;QACjB,QAAQ;QACR,MAAM;KACP,CAAC,CAAA;AACJ,CAAC"}
@@ -65,11 +65,13 @@ export declare function unwrapUserKeyGenerations({ descriptor, clientKeyAgreemen
65
65
  }): Promise<UserKey[]>;
66
66
  /**
67
67
  * What one collection's cascade step did: `noop` (already on the current user
68
- * key), `escrowed` (the current user key's wrap was completed into history
69
- * with no stale epoch to rotate), or `rotated` (a fresh epoch sealed to the
70
- * current user key, the stale generations retired).
68
+ * key), `sealed` (already on the current user key, but the collection's
69
+ * governing log still anchored before the membership change -- the backstop
70
+ * append landed), `escrowed` (the current user key's wrap was completed into
71
+ * history with no stale epoch to rotate), or `rotated` (a fresh epoch sealed
72
+ * to the current user key, the stale generations retired).
71
73
  */
72
- export type CollectionUserKeyRotationOutcome = 'noop' | 'escrowed' | 'rotated';
74
+ export type CollectionUserKeyRotationOutcome = 'noop' | 'sealed' | 'escrowed' | 'rotated';
73
75
  /**
74
76
  * Brings ONE encrypted collection's epoch roster onto the current user key --
75
77
  * the per-collection op of the revocation cascade and of the completion sweep:
@@ -79,8 +81,13 @@ export type CollectionUserKeyRotationOutcome = 'noop' | 'escrowed' | 'rotated';
79
81
  * a fresh epoch minted without the stale generations. Two requests per
80
82
  * collection; app recipients and other readers ride through untouched (the
81
83
  * default did:key resolver re-wraps them).
82
- * - **Current already** and fully escrowed: no write at all, so a naive
83
- * re-run after a mid-cascade crash converges with zero redundant epochs.
84
+ * - **Current already** and fully escrowed: no epoch write at all, so a naive
85
+ * re-run after a mid-cascade crash converges with zero redundant epochs. On
86
+ * a log-governed (sealable) store this is exactly where an unsealed log can
87
+ * hide -- the rotation that should have re-anchored the log never wrote --
88
+ * so the store's seal backstop runs here (`sealed` when it appended);
89
+ * rotated and escrowed writes seal by construction, anchored at the
90
+ * caller's current controller head.
84
91
  * - **No epochs**: refused fail-closed (see the module doc) -- provisioning
85
92
  * installs every encrypted collection's epoch[0], so the cascade never
86
93
  * mints a first epoch.
@@ -138,7 +145,7 @@ export interface UserKeyCascadeResult {
138
145
  * own task so a throwing check lands in that collection's `failed` entry
139
146
  * (e.g. a standard collection an account never provisioned server-side)
140
147
  * @param options.rosterDescriptor {CollectionEncryption} the freshly read
141
- * `key-map/user-key.json` roster (the source of the user key generations)
148
+ * `key-map/user-key.jsonl` roster (the source of the user key generations)
142
149
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
143
150
  * (identity) key-agreement key, unwrapping the generations
144
151
  * @param options.userKey {UserKey} the roster's current user key
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyCascade.d.ts","sourceRoot":"","sources":["../../src/keys/userKeyCascade.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAKL,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAA;AAChC,OAAO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,WAAW,EAAE,OAAO,EAAE,CAAA;CACvB,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAmG5C;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gCAAgC,CAAC,CAAA;IAC1D,MAAM,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,2BAA2B,CAAC,EAChD,aAAa,EACb,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,OAAO,EACR,EAAE;IACD,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,yBAAyB,CAAA;IAC7D,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACxD,gBAAgB,EAAE,oBAAoB,CAAA;IACtC,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAwBhC"}
@@ -1,4 +1,5 @@
1
1
  import { addRecipient, epochKeyIdFor, replaceRecipient, unwrapEpochSecret } from '@interop/was-client/edv';
2
+ import { isSealableDescriptorStore } from './rosterLogStore.js';
2
3
  import { userKeyVaultKeys } from './userKey.js';
3
4
  /**
4
5
  * A user key presented as an epoch-roster recipient: the kid is the
@@ -57,8 +58,13 @@ export async function unwrapUserKeyGenerations({ descriptor, clientKeyAgreementK
57
58
  * a fresh epoch minted without the stale generations. Two requests per
58
59
  * collection; app recipients and other readers ride through untouched (the
59
60
  * default did:key resolver re-wraps them).
60
- * - **Current already** and fully escrowed: no write at all, so a naive
61
- * re-run after a mid-cascade crash converges with zero redundant epochs.
61
+ * - **Current already** and fully escrowed: no epoch write at all, so a naive
62
+ * re-run after a mid-cascade crash converges with zero redundant epochs. On
63
+ * a log-governed (sealable) store this is exactly where an unsealed log can
64
+ * hide -- the rotation that should have re-anchored the log never wrote --
65
+ * so the store's seal backstop runs here (`sealed` when it appended);
66
+ * rotated and escrowed writes seal by construction, anchored at the
67
+ * caller's current controller head.
62
68
  * - **No epochs**: refused fail-closed (see the module doc) -- provisioning
63
69
  * installs every encrypted collection's epoch[0], so the cascade never
64
70
  * mints a first epoch.
@@ -99,6 +105,9 @@ export async function rotateCollectionEpochsToUserKey({ store, userKey, generati
99
105
  if (staleKids.length === 0) {
100
106
  const escrowComplete = (descriptor.epochs ?? []).every(epoch => epoch.recipients.some(entry => entry.header.kid === userKeyKid));
101
107
  if (currentKids.has(userKeyKid) && escrowComplete) {
108
+ if (isSealableDescriptorStore(store)) {
109
+ return (await store.seal()) === 'sealed' ? 'sealed' : 'noop';
110
+ }
102
111
  return 'noop';
103
112
  }
104
113
  }
@@ -170,7 +179,7 @@ export async function rotateCollectionEpochsToUserKey({ store, userKey, generati
170
179
  * own task so a throwing check lands in that collection's `failed` entry
171
180
  * (e.g. a standard collection an account never provisioned server-side)
172
181
  * @param options.rosterDescriptor {CollectionEncryption} the freshly read
173
- * `key-map/user-key.json` roster (the source of the user key generations)
182
+ * `key-map/user-key.jsonl` roster (the source of the user key generations)
174
183
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
175
184
  * (identity) key-agreement key, unwrapping the generations
176
185
  * @param options.userKey {UserKey} the roster's current user key
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyCascade.js","sourceRoot":"","sources":["../../src/keys/userKeyCascade.ts"],"names":[],"mappings":"AA+BA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAGlB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAgB,MAAM,cAAc,CAAA;AAE7D;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,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