@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
@@ -1,36 +1,38 @@
1
- import { convergeUserKeyRosterToDocument, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, readUserKeyRoster } from '../keys/index.js';
1
+ import { convergeUserKeyRosterToDocument, isSealableDescriptorStore, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, readUserKeyRoster } from '../keys/index.js';
2
+ import { ResourceLogContinuityError, ResourceLogIntegrityError } from '../resourceLog/index.js';
2
3
  import { verifyAccountLog } from '../webvh/index.js';
3
4
  /**
4
- * Whether a thrown error is one of the three roster refusals -- a rolled-back
5
- * or replayed roster, an epoch configuration that fails authentication, and a
6
- * current epoch this client cannot unwrap. They are the continuity class that
7
- * refuses a session rather than degrading it, so both entry points rethrow
8
- * them instead of warning and carrying on.
5
+ * Whether a thrown error is one of the roster refusals -- a fabricated or
6
+ * discontinuous roster log, a rolled-back or replayed roster, an epoch
7
+ * configuration that fails authentication, and a current epoch this client
8
+ * cannot unwrap. They are the continuity class that refuses a session rather
9
+ * than degrading it, so both entry points rethrow them instead of warning and
10
+ * carrying on.
9
11
  *
10
12
  * @param err {unknown}
11
13
  * @returns {boolean}
12
14
  */
13
15
  function isRosterRefusal(err) {
14
- return (err instanceof UserKeyRosterContinuityError ||
16
+ return (err instanceof ResourceLogContinuityError ||
17
+ err instanceof ResourceLogIntegrityError ||
18
+ err instanceof UserKeyRosterContinuityError ||
15
19
  err instanceof UserKeyRosterIntegrityError ||
16
20
  err instanceof UserKeyRosterUnwrapError);
17
21
  }
18
22
  /**
19
23
  * The login-time roster read. See the module doc for the failure semantics.
20
24
  *
21
- * A read that adopts an epoch from the roster (a rotation by another client,
22
- * or this client's first read) must trace it to the account document, so the
23
- * account log is fetched and verified lazily on exactly that path (via
24
- * `pointer`). A log that cannot be fetched then lands in the
25
- * transport-failure class -- the session carries on under the cached key,
26
- * WITHOUT adopting the unverifiable rotation -- while a roster whose epoch
27
- * configuration no enrolled client signed is a refusal like the other three.
25
+ * Every read traces to the account document through the log-governed store
26
+ * itself: the roster resolves only from the roster log's verified head, whose
27
+ * entry proofs are checked against the locally verified account log. A log
28
+ * that cannot be fetched lands in the transport-failure class -- the session
29
+ * carries on under the cached key, WITHOUT adopting an unverifiable rotation
30
+ * -- while a roster no enrolled client signed onto the log, and a log that
31
+ * conflicts with the chain-head pin, are refusals like the other three.
28
32
  *
29
33
  * @param options {object}
30
34
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
31
35
  * store
32
- * @param options.pointer {AccountLogPointer} where the account log lives,
33
- * for the lazy document verification above
34
36
  * @param [options.userKey] {UserKey} this client's cached user key; omitted (a
35
37
  * freshly enrolled client's first read) the key is always taken from the
36
38
  * roster
@@ -45,14 +47,13 @@ function isRosterRefusal(err) {
45
47
  * @returns {Promise<UserKeyRosterReadResult | null>} the read, or `null` when
46
48
  * the account has no roster yet or the server could not be reached
47
49
  */
48
- export async function checkUserKeyRosterAtLogin({ store, pointer, userKey, clientKeyAgreementKey, pinnedEpochId, onRosterRead }) {
50
+ export async function checkUserKeyRosterAtLogin({ store, userKey, clientKeyAgreementKey, pinnedEpochId, onRosterRead }) {
49
51
  try {
50
52
  const read = await readUserKeyRoster({
51
53
  store,
52
54
  ...(userKey ? { userKey } : {}),
53
55
  clientKeyAgreementKey,
54
- pinnedEpochId,
55
- resolveDocument: async () => (await verifyAccountLog(pointer)).doc
56
+ pinnedEpochId
56
57
  });
57
58
  if (!read) {
58
59
  return null;
@@ -98,33 +99,30 @@ export async function checkUserKeyRosterAtLogin({ store, pointer, userKey, clien
98
99
  * @param options.descriptor {CollectionEncryption} the start's roster read
99
100
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
100
101
  * (identity) key-agreement key
101
- * @param options.signEpochs {EpochsSigner} this client's epoch-configuration
102
- * signer (`userKeyRosterEpochsSigner`), for the rotation this call may perform
103
102
  * @param [options.pinnedEpochId] {string} the locally pinned latest-seen
104
103
  * roster epoch
105
104
  * @param [options.onUserKeyAdopted] {Function} called with the
106
105
  * {@link AdoptedUserKey} of a rotation, before the fan-out runs
107
- * @returns {Promise<object>} whether the roster rotated on this call, the
108
- * stale recipient kids found, and the key + descriptor to fan out with
106
+ * @returns {Promise<object>} whether the roster rotated on this call,
107
+ * whether the seal backstop had to append (`sealed`), the stale recipient
108
+ * kids found, and the key + descriptor to fan out with
109
109
  */
110
- export async function convergeUserKeyRosterToAccount({ pointer, store, userKey, descriptor, clientKeyAgreementKey, signEpochs, pinnedEpochId, onUserKeyAdopted }) {
110
+ export async function convergeUserKeyRosterToAccount({ pointer, store, userKey, descriptor, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted }) {
111
111
  const unchanged = {
112
112
  rotated: false,
113
+ sealed: false,
113
114
  staleRecipientIds: [],
114
115
  userKey,
115
116
  descriptor
116
117
  };
117
118
  let rotated;
118
119
  let staleRecipientIds;
119
- let accountDocument;
120
120
  try {
121
121
  const { doc } = await verifyAccountLog(pointer);
122
- accountDocument = doc;
123
122
  const converged = await convergeUserKeyRosterToDocument({
124
123
  store,
125
124
  document: doc,
126
- descriptor,
127
- signEpochs
125
+ descriptor
128
126
  });
129
127
  rotated = converged.rotated;
130
128
  staleRecipientIds = converged.staleRecipientIds;
@@ -136,8 +134,29 @@ export async function convergeUserKeyRosterToAccount({ pointer, store, userKey,
136
134
  console.warn('Could not converge the wrap-set roster onto the account document:', err);
137
135
  return unchanged;
138
136
  }
137
+ // The seal backstop, on a sealable (log-governed) store: a converged
138
+ // recipient set can still leave the roster log's head anchored before the
139
+ // membership change -- the torn revocation whose rotation no-op'd (the
140
+ // revoked client held no current-epoch wrap), which the recipient
141
+ // convergence above finds nothing to rotate for. "A governed log's head
142
+ // anchor predates the membership change" is the durable signal; sealing it
143
+ // is idempotent, so every start may try. Refusal classes rethrow exactly
144
+ // like the convergence's; anything else (transport) warns and leaves the
145
+ // seal to the next start.
146
+ let sealed = false;
147
+ if (isSealableDescriptorStore(store)) {
148
+ try {
149
+ sealed = (await store.seal()) === 'sealed';
150
+ }
151
+ catch (err) {
152
+ if (isRosterRefusal(err)) {
153
+ throw err;
154
+ }
155
+ console.warn('Could not seal the wrap-set roster log:', err);
156
+ }
157
+ }
139
158
  if (!rotated) {
140
- return unchanged;
159
+ return { ...unchanged, sealed };
141
160
  }
142
161
  console.warn('The wrap-set roster still wrapped the current key to ' +
143
162
  `${staleRecipientIds.length} recipient(s) the account document no ` +
@@ -151,8 +170,7 @@ export async function convergeUserKeyRosterToAccount({ pointer, store, userKey,
151
170
  store,
152
171
  userKey,
153
172
  clientKeyAgreementKey,
154
- pinnedEpochId,
155
- document: accountDocument
173
+ pinnedEpochId
156
174
  });
157
175
  }
158
176
  catch (err) {
@@ -175,6 +193,7 @@ export async function convergeUserKeyRosterToAccount({ pointer, store, userKey,
175
193
  });
176
194
  return {
177
195
  rotated: true,
196
+ sealed,
178
197
  staleRecipientIds,
179
198
  userKey: read.userKey,
180
199
  descriptor: read.descriptor
@@ -1 +1 @@
1
- {"version":3,"file":"rosterPolicy.js","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AAoDA,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB,EAIlB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAapD;;;;;;;;;GASG;AACH,SAAS,eAAe,CAAC,GAAY;IACnC,OAAO,CACL,GAAG,YAAY,4BAA4B;QAC3C,GAAG,YAAY,2BAA2B;QAC1C,GAAG,YAAY,wBAAwB,CACxC,CAAA;AACH,CAAC;AAED;;;;;;;;;;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YACnE,kBAAkB,EACpB,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAA;IACH,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,oEAAoE;YACpE,MAAM,CACT,CAAA;IACH,CAAC;IACD,MAAM,gBAAgB,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAA;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,iBAAiB;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"rosterPolicy.js","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AAsDA,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB,EAGlB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAapD;;;;;;;;;;GAUG;AACH,SAAS,eAAe,CAAC,GAAY;IACnC,OAAO,CACL,GAAG,YAAY,0BAA0B;QACzC,GAAG,YAAY,yBAAyB;QACxC,GAAG,YAAY,4BAA4B;QAC3C,GAAG,YAAY,2BAA2B;QAC1C,GAAG,YAAY,wBAAwB,CACxC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAC9C,KAAK,EACL,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,YAAY,EAOb;IACC,IAAI,CAAC;QACH,MAAM,IA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;SACd,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,GAAG,CAAA;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,mEAAmE;YACnE,kBAAkB,EACpB,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAA;IACH,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,oEAAoE;YACpE,MAAM,CACT,CAAA;IACH,CAAC;IACD,MAAM,gBAAgB,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAA;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM;QACN,iBAAiB;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAA;AACH,CAAC"}
@@ -80,7 +80,10 @@ export declare function wasDescriptorSource({ was, spaceId }: {
80
80
  * @param options.collectionId {string}
81
81
  * @param [options.onFetchError] {function} observes a swallowed fetch
82
82
  * failure (the thrown-fetch branch only; an empty description is not an
83
- * error). Errors from the cache itself throw through
83
+ * error). Errors from the cache itself throw through, as do a log-governed
84
+ * source's refusal classes (a fabricated or discontinuous log is a security
85
+ * signal, not an outage the cache should paper over) -- except a continuity
86
+ * `rollback`, which falls back to the cache like any transport hiccup
84
87
  * @returns {Promise<CollectionEncryption | undefined>}
85
88
  */
86
89
  export declare function acquireDescriptor({ source, cache, collectionId, onFetchError }: {
@@ -1 +1 @@
1
- {"version":3,"file":"acquire.d.ts","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;A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b,EAAE;IACD,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAoB5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,MAAM,EACN,KAAK,EACL,aAAa,EACb,YAAY,EACb,EAAE;IACD,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAiBhD"}
@@ -1,3 +1,25 @@
1
+ /**
2
+ * Whether a thrown fetch failure is a resource-log refusal the cache must NOT
3
+ * paper over: a fabricated log (`ResourceLogIntegrityError`), or a log that
4
+ * is not the continuation of the pinned history
5
+ * (`ResourceLogContinuityError`) -- EXCEPT continuity reason `rollback`,
6
+ * which is reconcilable divergence (possibly replication lag): the pin is
7
+ * never regressed and nothing rolled-back is adopted, so serving the cached
8
+ * copy in the meantime is exactly the offline posture. Matched on `err.name`
9
+ * rather than `instanceof`, which keeps this file dependency-light and
10
+ * survives a linked or duplicated copy of the package.
11
+ *
12
+ * @param err {unknown}
13
+ * @returns {boolean}
14
+ */
15
+ function isLogRefusal(err) {
16
+ const name = err?.name;
17
+ if (name === 'ResourceLogIntegrityError') {
18
+ return true;
19
+ }
20
+ return (name === 'ResourceLogContinuityError' &&
21
+ err.reason !== 'rollback');
22
+ }
1
23
  /**
2
24
  * The {@link EncryptionDescriptorSource} over a was-client handle: reads the
3
25
  * collection's Description in the given Space and returns its `encryption`
@@ -35,7 +57,10 @@ export function wasDescriptorSource({ was, spaceId }) {
35
57
  * @param options.collectionId {string}
36
58
  * @param [options.onFetchError] {function} observes a swallowed fetch
37
59
  * failure (the thrown-fetch branch only; an empty description is not an
38
- * error). Errors from the cache itself throw through
60
+ * error). Errors from the cache itself throw through, as do a log-governed
61
+ * source's refusal classes (a fabricated or discontinuous log is a security
62
+ * signal, not an outage the cache should paper over) -- except a continuity
63
+ * `rollback`, which falls back to the cache like any transport hiccup
39
64
  * @returns {Promise<CollectionEncryption | undefined>}
40
65
  */
41
66
  export async function acquireDescriptor({ source, cache, collectionId, onFetchError }) {
@@ -53,6 +78,9 @@ export async function acquireDescriptor({ source, cache, collectionId, onFetchEr
53
78
  return cache.readDescriptor({ collectionId });
54
79
  }
55
80
  catch (err) {
81
+ if (isLogRefusal(err)) {
82
+ throw err;
83
+ }
56
84
  onFetchError?.(err, { collectionId });
57
85
  return cache.readDescriptor({ collectionId });
58
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"acquire.js","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AAuDA;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,GAAG,EACH,OAAO,EAIR;IACC,OAAO;QACL,KAAK,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE;YACzC,MAAM,WAAW,GAAG,MAAM,GAAG;iBAC1B,KAAK,CAAC,OAAO,CAAC;iBACd,UAAU,CAAC,YAAY,CAAC;iBACxB,QAAQ,EAAE,CAAA;YACb,OAAO,WAAW,EAAE,UAAU,IAAI,SAAS,CAAA;QAC7C,CAAC;KACF,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,MAAM,EACN,KAAK,EACL,Y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;YAClE,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,0EAA0E;QAC1E,+DAA+D;QAC/D,OAAO,KAAK,CAAC,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;IAC/C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,GAAG,CAAA;QACX,CAAC;QACD,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,CAAC,CAAA;QACrC,OAAO,KAAK,CAAC,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,MAAM,EACN,KAAK,EACL,aAAa,EACb,YAAY,EAMb;IACC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,aAAa,CAAC,GAAG,CACf,KAAK,EAAC,YAAY,EAAC,EAAE,CACnB;QACE,YAAY;QACZ,MAAM,iBAAiB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;KAC9D,CACb,CACF,CAAA;IACD,MAAM,WAAW,GAAyC,EAAE,CAAA;IAC5D,KAAK,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,IAAI,QAAQ,EAAE,CAAC;QAClD,IAAI,UAAU,EAAE,CAAC;YACf,WAAW,CAAC,YAAY,CAAC,GAAG,UAAU,CAAA;QACxC,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
@@ -20,7 +20,14 @@
20
20
  * description is ambiguous, since WAS masks an unauthorized read as an
21
21
  * absent one). No descriptor anywhere means a plaintext collection, or an
22
22
  * encrypted one whose epoch[0] install has not landed -- which a caller that
23
- * has declared the collection encrypted must refuse fail-closed.
23
+ * has declared the collection encrypted must refuse fail-closed. A
24
+ * log-governed source's refusal classes rethrow instead of falling back
25
+ * (except a continuity rollback, which is reconcilable divergence).
26
+ * - `logGovernedDescriptorSource` -- the `EncryptionDescriptorSource` for
27
+ * collections whose descriptor is governed by a resource log: every read
28
+ * (including the unknown-epoch refresh) re-verifies the log and resolves to
29
+ * its verified head state, refusing a head that is not a
30
+ * `WasEpochConfiguration`.
24
31
  * - `DescriptorRefreshPolicy` -- the once-per-collection-per-session
25
32
  * unknown-epoch refresh guard, plus the refresh-and-re-read-once wrapper
26
33
  * for hosts whose reads scan rows and count unknown-epoch skips.
@@ -31,6 +38,7 @@
31
38
  */
32
39
  export { acquireDescriptor, acquireDescriptors, wasDescriptorSource } from './acquire.js';
33
40
  export type { EncryptionDescriptorCache, EncryptionDescriptorSource } from './acquire.js';
41
+ export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedDescriptorSource } from './logSource.js';
34
42
  export { DescriptorRefreshPolicy } from './refresh.js';
35
43
  export { createRefreshingEdvDocCipher } from './cipher.js';
36
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA"}
@@ -20,7 +20,14 @@
20
20
  * description is ambiguous, since WAS masks an unauthorized read as an
21
21
  * absent one). No descriptor anywhere means a plaintext collection, or an
22
22
  * encrypted one whose epoch[0] install has not landed -- which a caller that
23
- * has declared the collection encrypted must refuse fail-closed.
23
+ * has declared the collection encrypted must refuse fail-closed. A
24
+ * log-governed source's refusal classes rethrow instead of falling back
25
+ * (except a continuity rollback, which is reconcilable divergence).
26
+ * - `logGovernedDescriptorSource` -- the `EncryptionDescriptorSource` for
27
+ * collections whose descriptor is governed by a resource log: every read
28
+ * (including the unknown-epoch refresh) re-verifies the log and resolves to
29
+ * its verified head state, refusing a head that is not a
30
+ * `WasEpochConfiguration`.
24
31
  * - `DescriptorRefreshPolicy` -- the once-per-collection-per-session
25
32
  * unknown-epoch refresh guard, plus the refresh-and-re-read-once wrapper
26
33
  * for hosts whose reads scan rows and count unknown-epoch skips.
@@ -30,6 +37,7 @@
30
37
  * instance.
31
38
  */
32
39
  export { acquireDescriptor, acquireDescriptors, wasDescriptorSource } from './acquire.js';
40
+ export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedDescriptorSource } from './logSource.js';
33
41
  export { DescriptorRefreshPolicy } from './refresh.js';
34
42
  export { createRefreshingEdvDocCipher } from './cipher.js';
35
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAMrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAMrB,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { type ResourceLogStore } from '@interop/was-client/log';
2
+ import { type ResourceLogController, type ResourceLogPinStore } from '../resourceLog/index.js';
3
+ import type { EncryptionDescriptorSource } from './acquire.js';
4
+ /**
5
+ * The state-document schema identifier an encryption descriptor carries in a
6
+ * governed log entry, per WAS-EC.
7
+ */
8
+ export declare const EPOCH_CONFIGURATION_STATE_TYPE = "WasEpochConfiguration";
9
+ /**
10
+ * Builds the {@link EncryptionDescriptorSource} over per-collection resource
11
+ * logs. An absent log resolves `undefined` exactly like an absent
12
+ * Collection Description `encryption` member (a plaintext collection, or one
13
+ * whose provisioning has not landed); verification failures throw through --
14
+ * {@link acquireDescriptor} rethrows the refusal classes rather than falling
15
+ * back to the cache.
16
+ *
17
+ * @param options {object}
18
+ * @param options.logFor {function} `(collectionId) => ResourceLogStore` --
19
+ * the collection's governing log's transport seam
20
+ * @param options.resolveController {function}
21
+ * `() => Promise<ResourceLogController>` -- the caller's currently verified
22
+ * controller view, resolved per operation
23
+ * @param options.pinStoreFor {function} `(collectionId) =>
24
+ * ResourceLogPinStore` -- this client's chain-head pin for the collection's
25
+ * log
26
+ * @returns {EncryptionDescriptorSource}
27
+ */
28
+ export declare function logGovernedDescriptorSource({ logFor, resolveController, pinStoreFor }: {
29
+ logFor: (collectionId: string) => ResourceLogStore;
30
+ resolveController: () => Promise<ResourceLogController>;
31
+ pinStoreFor: (collectionId: string) => ResourceLogPinStore;
32
+ }): EncryptionDescriptorSource;
33
+ //# sourceMappingURL=logSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logSource.d.ts","sourceRoot":"","sources":["../../src/descriptors/logSource.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AAE9D;;;GAGG;AACH,eAAO,MAAM,8BAA8B,0BAA0B,CAAA;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,MAAM,EACN,iBAAiB,EACjB,WAAW,EACZ,EAAE;IACD,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,gBAAgB,CAAA;IAClD,iBAAiB,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACvD,WAAW,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,mBAAmB,CAAA;CAC3D,GAAG,0BAA0B,CAuB7B"}
@@ -0,0 +1,49 @@
1
+ import { WAS_RESOURCE_LOG_METHOD } from '@interop/was-client/log';
2
+ import { readResourceLog, ResourceLogIntegrityError } from '../resourceLog/index.js';
3
+ /**
4
+ * The state-document schema identifier an encryption descriptor carries in a
5
+ * governed log entry, per WAS-EC.
6
+ */
7
+ export const EPOCH_CONFIGURATION_STATE_TYPE = 'WasEpochConfiguration';
8
+ /**
9
+ * Builds the {@link EncryptionDescriptorSource} over per-collection resource
10
+ * logs. An absent log resolves `undefined` exactly like an absent
11
+ * Collection Description `encryption` member (a plaintext collection, or one
12
+ * whose provisioning has not landed); verification failures throw through --
13
+ * {@link acquireDescriptor} rethrows the refusal classes rather than falling
14
+ * back to the cache.
15
+ *
16
+ * @param options {object}
17
+ * @param options.logFor {function} `(collectionId) => ResourceLogStore` --
18
+ * the collection's governing log's transport seam
19
+ * @param options.resolveController {function}
20
+ * `() => Promise<ResourceLogController>` -- the caller's currently verified
21
+ * controller view, resolved per operation
22
+ * @param options.pinStoreFor {function} `(collectionId) =>
23
+ * ResourceLogPinStore` -- this client's chain-head pin for the collection's
24
+ * log
25
+ * @returns {EncryptionDescriptorSource}
26
+ */
27
+ export function logGovernedDescriptorSource({ logFor, resolveController, pinStoreFor }) {
28
+ return {
29
+ async collectionEncryption({ collectionId }) {
30
+ const controller = await resolveController();
31
+ const current = await readResourceLog({
32
+ store: logFor(collectionId),
33
+ controller,
34
+ expectedMethod: WAS_RESOURCE_LOG_METHOD,
35
+ pinStore: pinStoreFor(collectionId)
36
+ });
37
+ if (current === null) {
38
+ return undefined;
39
+ }
40
+ const state = current.verified.state;
41
+ if (state.type !== EPOCH_CONFIGURATION_STATE_TYPE) {
42
+ throw new ResourceLogIntegrityError(`The governed descriptor log carries state of type ` +
43
+ `"${state.type}", not "${EPOCH_CONFIGURATION_STATE_TYPE}".`);
44
+ }
45
+ return state;
46
+ }
47
+ };
48
+ }
49
+ //# sourceMappingURL=logSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logSource.js","sourceRoot":"","sources":["../../src/descriptors/logSource.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,uBAAuB,EAExB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,eAAe,EACf,yBAAyB,EAG1B,MAAM,yBAAyB,CAAA;AAGhC;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,uBAAuB,CAAA;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAC1C,MAAM,EACN,iBAAiB,EACjB,WAAW,EAKZ;IACC,OAAO;QACL,KAAK,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE;YACzC,MAAM,UAAU,GAAG,MAAM,iBAAiB,EAAE,CAAA;YAC5C,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;gBACpC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC;gBAC3B,UAAU;gBACV,cAAc,EAAE,uBAAuB;gBACvC,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC;aACpC,CAAC,CAAA;YACF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;YACpC,IAAI,KAAK,CAAC,IAAI,KAAK,8BAA8B,EAAE,CAAC;gBAClD,MAAM,IAAI,yBAAyB,CACjC,oDAAoD;oBAClD,IAAI,KAAK,CAAC,IAAI,WAAW,8BAA8B,IAAI,CAC9D,CAAA;YACH,CAAC;YACD,OAAO,KAA6B,CAAA;QACtC,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * Push, not pull, in the recovery-anchor order (decryption material before
16
16
  * authorization): the enrolling client wraps the user key to the new client's
17
- * key-agreement key in `key-map/user-key.json` FIRST, then writes the two
17
+ * key-agreement key in `key-map/user-key.jsonl` FIRST, then writes the two
18
18
  * did:webvh log entries (commit, then add-VMs-and-update-key). No
19
19
  * authorized-but-blind window exists at any point, and both tear points
20
20
  * resume by re-running the ceremony with the same code -- a tear after the
@@ -127,7 +127,7 @@ export declare function mintEnrollmentRequest(): Promise<{
127
127
  * client's own (identity) key-agreement key, unwrapping each epoch for
128
128
  * re-wrapping
129
129
  * @param options.userKeyRosterStore {EncryptionDescriptorStore} the account's
130
- * `key-map/user-key.json` descriptor store
130
+ * `key-map/user-key.jsonl` descriptor store
131
131
  * @param options.idStore {WebvhIdStore} the account's `id` collection
132
132
  * @returns {Promise<object>} the account's did:webvh, plus the enrollee's
133
133
  * own identity as this call already knows it: its did:key and its signing-key
@@ -1 +1 @@
1
- {"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAYxE,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAU7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAQ1D;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAA;AAEnD;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBAE7C,OAAO,SAC+C;CAKzD;AA+DD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;CAC3B,GAAG,MAAM,CAKT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACL,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,iBAAiB,CAsDpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;CAC3B,GAAG,MAAM,CAET;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;CAC3B,GAAG,MAAM,CAKT;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBA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AkB,EAAE,yBAAyB,CAAA;IAC7C,OAAO,EAAE,YAAY,CAAA;CACtB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB3E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,UAAU,EACV,eAAe,EACf,OAAO,EACR,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,qBAAqB,CAAA;IACtC,OAAO,EAAE,cAAc,CAAA;CACxB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,CAwEvD"}
@@ -5,8 +5,9 @@ import { enrollWebvhClient, mintClientWebvhUpdateKeys, updateKeyMultibase } from
5
5
  import { clientSigningKeyMultibase, isWebvhDid, webvhZcapClient } from '../webvh/zcap.js';
6
6
  import { AccountLogMissingError, verifyAccountLog } from '../webvh/verifyLog.js';
7
7
  import { addUserKeyRosterRecipient } from '../keys/userKeyRoster.js';
8
- import { readUserKeyRoster, rosterRecipientKid } from '../keys/userKeyRoster.js';
8
+ import { readUserKeyRoster, rosterRecipientKid, userKeyRosterLogSigner } from '../keys/userKeyRoster.js';
9
9
  import { userKeyRosterDescriptorStore } from '../keys/rosterStore.js';
10
+ import { memoryResourceLogPinStore, webvhResourceLogController } from '../resourceLog/index.js';
10
11
  import { CONNECT_CODE_PREFIX } from './connectCode.js';
11
12
  /**
12
13
  * The connect-code payload version this build mints and accepts.
@@ -221,7 +222,7 @@ export async function mintEnrollmentRequest() {
221
222
  * client's own (identity) key-agreement key, unwrapping each epoch for
222
223
  * re-wrapping
223
224
  * @param options.userKeyRosterStore {EncryptionDescriptorStore} the account's
224
- * `key-map/user-key.json` descriptor store
225
+ * `key-map/user-key.jsonl` descriptor store
225
226
  * @param options.idStore {WebvhIdStore} the account's `id` collection
226
227
  * @returns {Promise<object>} the account's did:webvh, plus the enrollee's
227
228
  * own identity as this call already knows it: its did:key and its signing-key
@@ -311,21 +312,25 @@ export async function completeEnrollmentCore({ clientSeed, webvhUpdateKeys, poin
311
312
  }
312
313
  // The first roster read: signed with the `<did:webvh>#<multibase>` keyId
313
314
  // the add entry just published, unwrapping the user key the enrolling client
314
- // escrowed to this client's key-agreement key. The verified document just
315
- // resolved above is what the roster's epoch-configuration signature is
316
- // checked against -- a first read adopts whatever epoch the roster serves,
317
- // so it must trace to a key the document backs, not to the served
318
- // descriptor's own MAC.
315
+ // escrowed to this client's key-agreement key. The account log just
316
+ // verified above is the controller the roster log's entry proofs are
317
+ // checked against -- a first read adopts whatever head the log serves, so
318
+ // every entry must trace to keys the document backs, not to the served
319
+ // descriptor's own MAC. First contact: the chain-head pin this read
320
+ // establishes is session-local here; the app's durable pin is established
321
+ // by its own first login read.
319
322
  const zcapClient = webvhZcapClient({ keyAgent, did });
320
323
  const store = userKeyRosterDescriptorStore({
321
324
  storageServerUrl: pointer.host,
322
325
  zcapClient,
323
- spaceId: pointer.spaceId
326
+ spaceId: pointer.spaceId,
327
+ resolveController: async () => webvhResourceLogController({ did, log: verified.log }),
328
+ pinStore: memoryResourceLogPinStore(),
329
+ signer: userKeyRosterLogSigner({ keyAgent })
324
330
  });
325
331
  const read = await readUserKeyRoster({
326
332
  store,
327
- clientKeyAgreementKey: keyAgreementKey,
328
- document: verified.doc
333
+ clientKeyAgreementKey: keyAgreementKey
329
334
  });
330
335
  if (!read) {
331
336
  throw new Error('The account has no user key roster; it must finish provisioning before ' +
@@ -1 +1 @@
1
- {"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,eAAe,EACf,4BAA4B,EAC7B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,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AqE;IACrE,0EAA0E;IAC1E,uEAAuE;IACvE,oEAAoE;IACpE,0EAA0E;IAC1E,+BAA+B;IAC/B,MAAM,UAAU,GAAG,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;IACrD,MAAM,KAAK,GAAG,4BAA4B,CAAC;QACzC,gBAAgB,EAAE,OAAO,CAAC,IAAI;QAC9B,UAAU;QACV,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,iBAAiB,EAAE,KAAK,IAAI,EAAE,CAC5B,0BAA0B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;QACxD,QAAQ,EAAE,yBAAyB,EAAE;QACrC,MAAM,EAAE,sBAAsB,CAAC,EAAE,QAAQ,EAAE,CAAC;KAC7C,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC;QACnC,KAAK;QACL,qBAAqB,EAAE,eAAe;KACvC,CAAC,CAAA;IACF,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,yEAAyE;YACvE,2BAA2B,CAC9B,CAAA;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAA;AACrE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@
20
20
  * hosted DID log, its per-client update-key rotation, the client enrollment
21
21
  * entries, and ZCap signing under the did:webvh verification-method id.
22
22
  * - `@interop/wallet-core/keys` -- the user key and its
23
- * `key-map/user-key.json` wrap-set roster.
23
+ * `key-map/user-key.jsonl` wrap-set roster log.
24
24
  * - `@interop/wallet-core/descriptors` -- collection encryption-descriptor
25
25
  * acquisition (fetch / cache / offline fallback) and the unknown-epoch
26
26
  * refresh policy, including a self-refreshing EDV document cipher.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@
20
20
  * hosted DID log, its per-client update-key rotation, the client enrollment
21
21
  * entries, and ZCap signing under the did:webvh verification-method id.
22
22
  * - `@interop/wallet-core/keys` -- the user key and its
23
- * `key-map/user-key.json` wrap-set roster.
23
+ * `key-map/user-key.jsonl` wrap-set roster log.
24
24
  * - `@interop/wallet-core/descriptors` -- collection encryption-descriptor
25
25
  * acquisition (fetch / cache / offline fallback) and the unknown-epoch
26
26
  * refresh policy, including a self-refreshing EDV document cipher.
@@ -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
@@ -44,11 +49,13 @@ export { mintUserKey, userKeyVaultKeys } from './userKey.js';
44
49
  export type { UserKey } from './userKey.js';
45
50
  export { assertEnrolledClientKeyRecord, decodeClientKeyRecord, encodeClientKeyRecord, parseClientRecordUserKey, parseClientRecordWebvhKeys } from './clientKeyRecord.js';
46
51
  export type { ClientKeyRecord, ClientKeyRecordJson, EnrolledClientKeyRecord } from './clientKeyRecord.js';
47
- export { addUserKeyRosterRecipient, convergeUserKeyRosterToDocument, ensureUserKeyRoster, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, userKeyRosterEpochsSigner, userKeyRosterRecipientResolver, readUserKeyRoster, rosterRecipientKid, rotateUserKeyRoster, verifyUserKeyRosterEpochsSig } from './userKeyRoster.js';
52
+ export { addUserKeyRosterRecipient, convergeUserKeyRosterToDocument, ensureUserKeyRoster, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, userKeyRosterLogSigner, userKeyRosterRecipientResolver, readUserKeyRoster, rosterRecipientKid, rotateUserKeyRoster } from './userKeyRoster.js';
48
53
  export { cascadeCollectionsToUserKey, userKeyAsRecipient, rotateCollectionEpochsToUserKey, unwrapUserKeyGenerations } from './userKeyCascade.js';
49
54
  export type { CollectionUserKeyRotationOutcome, UserKeyCascadeResult } from './userKeyCascade.js';
50
55
  export type { UserKeyRosterReadResult, RosterRecipientDocument } from './userKeyRoster.js';
51
56
  export { userKeyRosterDescriptorStore } from './rosterStore.js';
57
+ export { EPOCH_CONFIGURATION_STATE_TYPE, isSealableDescriptorStore, logGovernedDescriptorStore } from './rosterLogStore.js';
58
+ export type { SealableEncryptionDescriptorStore } from './rosterLogStore.js';
52
59
  export { ensureWalletSpaceEpochs } from './spaceEpochs.js';
53
60
  export type { WalletSpaceEpochsResult } from './spaceEpochs.js';
54
61
  export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;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