@interop/wallet-core 0.30.0 → 0.31.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.
@@ -44,7 +44,9 @@ export type RecoveryLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdRes
44
44
  * `keyAgreement` verification method (an ordinary, unmarked Multikey entry)
45
45
  * and committing its update-key hash in `nextKeyHashes`. The code's update
46
46
  * key joins `updateKeys` nowhere. Idempotent: a posture already published is
47
- * a no-op, so re-running a torn issuance converges.
47
+ * a no-op, so re-running a torn issuance converges. The entry publishes
48
+ * conditionally on the log this call read; a race lost to a concurrent
49
+ * ceremony re-runs and rebases on the new head.
48
50
  *
49
51
  * @param options {object}
50
52
  * @param options.idStore {WebvhIdStore}
@@ -53,7 +55,7 @@ export type RecoveryLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdRes
53
55
  * @param options.recovery {RecoveryPublicKeys} the code's public halves
54
56
  * @returns {Promise<{ did: string }>}
55
57
  */
56
- export declare function publishRecoveryKey({ idStore, updateKeys, recovery }: {
58
+ export declare function publishRecoveryKey(options: {
57
59
  idStore: WebvhIdStore;
58
60
  updateKeys: ClientWebvhUpdateKeys;
59
61
  recovery: RecoveryPublicKeys;
@@ -68,6 +70,9 @@ export declare function publishRecoveryKey({ idStore, updateKeys, recovery }: {
68
70
  * caller's, and runs after this so the resolver's document no longer backs
69
71
  * the removed entry.
70
72
  *
73
+ * The entry publishes conditionally on the log this call read; a race lost to
74
+ * a concurrent ceremony re-runs and rebases on the new head.
75
+ *
71
76
  * @param options {object}
72
77
  * @param options.idStore {WebvhIdStore}
73
78
  * @param options.updateKeys {ClientWebvhUpdateKeys} the REVOKING client's
@@ -75,7 +80,7 @@ export declare function publishRecoveryKey({ idStore, updateKeys, recovery }: {
75
80
  * @param options.recovery {RecoveryPublicKeys} the code's public halves
76
81
  * @returns {Promise<{ did: string }>}
77
82
  */
78
- export declare function removeRecoveryKey({ idStore, updateKeys, recovery }: {
83
+ export declare function removeRecoveryKey(options: {
79
84
  idStore: WebvhIdStore;
80
85
  updateKeys: ClientWebvhUpdateKeys;
81
86
  recovery: RecoveryPublicKeys;
@@ -91,7 +96,10 @@ export declare function removeRecoveryKey({ idStore, updateKeys, recovery }: {
91
96
  * detected by the new client's update key already being authorized (no-op),
92
97
  * a torn one by the standing commitments (the commit step re-runs
93
98
  * convergently -- the spent code's hash is deliberately carried through the
94
- * commit entry, so a resumed commit can re-state the revealed key).
99
+ * commit entry, so a resumed commit can re-state the revealed key). Both
100
+ * entries publish conditionally on the read they were built on, and a race
101
+ * lost to a concurrent ceremony re-runs the continuation from the top -- the
102
+ * same resumable path a tear takes.
95
103
  *
96
104
  * @param options {object}
97
105
  * @param options.store {RecoveryLogStore} public log read + delegated PUT
@@ -111,7 +119,7 @@ export declare function removeRecoveryKey({ idStore, updateKeys, recovery }: {
111
119
  * when the add entry ran here, the final `did.json` projection for the
112
120
  * recovered session to republish
113
121
  */
114
- export declare function recoverWebvhClient({ store, recovery, newClientKeys, newClientUpdateSeeds, replacement }: {
122
+ export declare function recoverWebvhClient(options: {
115
123
  store: RecoveryLogStore;
116
124
  recovery: RecoveryPublicKeys & {
117
125
  updateSeed: Uint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryWebvh.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EACV,qBAAqB,EAErB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAE7B;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,wBAAwB,EACzB,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,wBAAwB,EAAE,MAAM,CAAA;CACjC,GAAG,MAAM,CAET;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,wBAAwB,EAAE,MAAM,CAAA;IAChC,kBAAkB,EAAE,MAAM,CAA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kB,GAAG;QAAE,UAAU,EAAE,UAAU,CAAA;KAAE,CAAA;IACzD,aAAa,EAAE,mBAAmB,CAAA;IAClC,oBAAoB,EAAE,qBAAqB,CAAA;IAC3C,WAAW,EAAE,kBAAkB,CAAA;CAChC,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAE5C"}
@@ -33,9 +33,8 @@
33
33
  * the authorized controller. Every step is idempotent/resumable: re-running
34
34
  * with the same key material converges without forking the log.
35
35
  */
36
- import { deriveNextKeyHash, logToJsonlString, updateDID } from '@interop/did-method-webvh';
37
- import { DID_LOG_RESOURCE } from '../space/collections.js';
38
- import { assertCarryOverCommitments, MULTIKEY_VM_TYPE, publishWebvhLog, readPublishedLog, relationIds, updateKeyMultibase, updateKeySigner } from '../webvh/didWebvh.js';
36
+ import { deriveNextKeyHash, updateDID } from '@interop/did-method-webvh';
37
+ import { assertCarryOverCommitments, MULTIKEY_VM_TYPE, publishUpdatedLog, putLogResource, readPublishedLog, relationIds, updateKeyMultibase, updateKeySigner, withLogConflictRetry } from '../webvh/didWebvh.js';
39
38
  /**
40
39
  * The verification-method id a code's key-agreement key publishes under --
41
40
  * the ordinary `<did>#<multibase>` form, indistinguishable by id from any
@@ -83,19 +82,18 @@ async function readLogOrThrow({ store }) {
83
82
  /**
84
83
  * Publishes `did.jsonl` through the narrow recovery seam -- the log only,
85
84
  * never `did.json` (the delegation covers nothing else; the recovered
86
- * session republishes the projection once it is the controller).
85
+ * session republishes the projection once it is the controller). The write is
86
+ * conditional on the read the entry was built on, and a lost race surfaces as
87
+ * a `WebvhLogConflictError` (the mapping lives in `putLogResource`).
87
88
  *
88
89
  * @param options {object}
89
90
  * @param options.store {RecoveryLogStore}
90
- * @param options.log {object}
91
+ * @param options.log {DIDLog}
92
+ * @param [options.ifMatch] {string} publish only if `did.jsonl` is unchanged
91
93
  * @returns {Promise<void>}
92
94
  */
93
- async function publishLogOnly({ store, log }) {
94
- await store.putIdResource({
95
- resourceId: DID_LOG_RESOURCE,
96
- content: logToJsonlString(log),
97
- contentType: 'text/jsonl'
98
- });
95
+ async function publishLogOnly({ store, log, ifMatch }) {
96
+ await putLogResource({ store, log, ifMatch });
99
97
  }
100
98
  /**
101
99
  * ISSUANCE (run by an enrolled client, root authority): publishes a recovery
@@ -103,7 +101,9 @@ async function publishLogOnly({ store, log }) {
103
101
  * `keyAgreement` verification method (an ordinary, unmarked Multikey entry)
104
102
  * and committing its update-key hash in `nextKeyHashes`. The code's update
105
103
  * key joins `updateKeys` nowhere. Idempotent: a posture already published is
106
- * a no-op, so re-running a torn issuance converges.
104
+ * a no-op, so re-running a torn issuance converges. The entry publishes
105
+ * conditionally on the log this call read; a race lost to a concurrent
106
+ * ceremony re-runs and rebases on the new head.
107
107
  *
108
108
  * @param options {object}
109
109
  * @param options.idStore {WebvhIdStore}
@@ -112,7 +112,16 @@ async function publishLogOnly({ store, log }) {
112
112
  * @param options.recovery {RecoveryPublicKeys} the code's public halves
113
113
  * @returns {Promise<{ did: string }>}
114
114
  */
115
- export async function publishRecoveryKey({ idStore, updateKeys, recovery }) {
115
+ export async function publishRecoveryKey(options) {
116
+ return withLogConflictRetry(() => publishRecoveryKeyOnce(options));
117
+ }
118
+ /**
119
+ * One attempt of {@link publishRecoveryKey}, re-invoked by the conflict retry.
120
+ *
121
+ * @param options {object} see {@link publishRecoveryKey}
122
+ * @returns {Promise<{ did: string }>}
123
+ */
124
+ async function publishRecoveryKeyOnce({ idStore, updateKeys, recovery }) {
116
125
  const published = await readLogOrThrow({ store: idStore });
117
126
  const { did, doc } = published;
118
127
  const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
@@ -156,10 +165,7 @@ export async function publishRecoveryKey({ idStore, updateKeys, recovery }) {
156
165
  capabilityInvocation: relationIds(doc.capabilityInvocation),
157
166
  capabilityDelegation: relationIds(doc.capabilityDelegation)
158
167
  });
159
- if (!updated.webDoc) {
160
- throw new Error('did:webvh: updateDID returned no webDoc despite the did:web alsoKnownAs.');
161
- }
162
- await publishWebvhLog({ idStore, log: updated.log, webDoc: updated.webDoc });
168
+ await publishUpdatedLog({ idStore, updated, ifMatch: published.etag });
163
169
  return { did: updated.did };
164
170
  }
165
171
  /**
@@ -170,6 +176,9 @@ export async function publishRecoveryKey({ idStore, updateKeys, recovery }) {
170
176
  * caller's, and runs after this so the resolver's document no longer backs
171
177
  * the removed entry.
172
178
  *
179
+ * The entry publishes conditionally on the log this call read; a race lost to
180
+ * a concurrent ceremony re-runs and rebases on the new head.
181
+ *
173
182
  * @param options {object}
174
183
  * @param options.idStore {WebvhIdStore}
175
184
  * @param options.updateKeys {ClientWebvhUpdateKeys} the REVOKING client's
@@ -177,7 +186,16 @@ export async function publishRecoveryKey({ idStore, updateKeys, recovery }) {
177
186
  * @param options.recovery {RecoveryPublicKeys} the code's public halves
178
187
  * @returns {Promise<{ did: string }>}
179
188
  */
180
- export async function removeRecoveryKey({ idStore, updateKeys, recovery }) {
189
+ export async function removeRecoveryKey(options) {
190
+ return withLogConflictRetry(() => removeRecoveryKeyOnce(options));
191
+ }
192
+ /**
193
+ * One attempt of {@link removeRecoveryKey}, re-invoked by the conflict retry.
194
+ *
195
+ * @param options {object} see {@link removeRecoveryKey}
196
+ * @returns {Promise<{ did: string }>}
197
+ */
198
+ async function removeRecoveryKeyOnce({ idStore, updateKeys, recovery }) {
181
199
  const published = await readLogOrThrow({ store: idStore });
182
200
  const { did, doc } = published;
183
201
  const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
@@ -212,10 +230,7 @@ export async function removeRecoveryKey({ idStore, updateKeys, recovery }) {
212
230
  capabilityInvocation: relationIds(doc.capabilityInvocation),
213
231
  capabilityDelegation: relationIds(doc.capabilityDelegation)
214
232
  });
215
- if (!updated.webDoc) {
216
- throw new Error('did:webvh: updateDID returned no webDoc despite the did:web alsoKnownAs.');
217
- }
218
- await publishWebvhLog({ idStore, log: updated.log, webDoc: updated.webDoc });
233
+ await publishUpdatedLog({ idStore, updated, ifMatch: published.etag });
219
234
  return { did: updated.did };
220
235
  }
221
236
  /**
@@ -227,7 +242,10 @@ export async function removeRecoveryKey({ idStore, updateKeys, recovery }) {
227
242
  * detected by the new client's update key already being authorized (no-op),
228
243
  * a torn one by the standing commitments (the commit step re-runs
229
244
  * convergently -- the spent code's hash is deliberately carried through the
230
- * commit entry, so a resumed commit can re-state the revealed key).
245
+ * commit entry, so a resumed commit can re-state the revealed key). Both
246
+ * entries publish conditionally on the read they were built on, and a race
247
+ * lost to a concurrent ceremony re-runs the continuation from the top -- the
248
+ * same resumable path a tear takes.
231
249
  *
232
250
  * @param options {object}
233
251
  * @param options.store {RecoveryLogStore} public log read + delegated PUT
@@ -247,7 +265,16 @@ export async function removeRecoveryKey({ idStore, updateKeys, recovery }) {
247
265
  * when the add entry ran here, the final `did.json` projection for the
248
266
  * recovered session to republish
249
267
  */
250
- export async function recoverWebvhClient({ store, recovery, newClientKeys, newClientUpdateSeeds, replacement }) {
268
+ export async function recoverWebvhClient(options) {
269
+ return withLogConflictRetry(() => recoverWebvhClientOnce(options));
270
+ }
271
+ /**
272
+ * One attempt of {@link recoverWebvhClient}, re-invoked by the conflict retry.
273
+ *
274
+ * @param options {object} see {@link recoverWebvhClient}
275
+ * @returns {Promise<{ did: string, webDoc?: object }>}
276
+ */
277
+ async function recoverWebvhClientOnce({ store, recovery, newClientKeys, newClientUpdateSeeds, replacement }) {
251
278
  let published = await readLogOrThrow({ store });
252
279
  // Already complete (a torn earlier run finished the add entry): the new
253
280
  // client's update key is authorized, which only the add entry writes.
@@ -288,7 +315,11 @@ export async function recoverWebvhClient({ store, recovery, newClientKeys, newCl
288
315
  ])
289
316
  ]
290
317
  });
291
- await publishLogOnly({ store, log: updated.log });
318
+ await publishLogOnly({
319
+ store,
320
+ log: updated.log,
321
+ ifMatch: published.etag
322
+ });
292
323
  published = await readLogOrThrow({ store });
293
324
  }
294
325
  // The add-and-retire entry: the new client's verification methods and
@@ -358,7 +389,9 @@ export async function recoverWebvhClient({ store, recovery, newClientKeys, newCl
358
389
  capabilityInvocation: withReference(doc.capabilityInvocation, signingVmId),
359
390
  capabilityDelegation: withReference(doc.capabilityDelegation, signingVmId)
360
391
  });
361
- await publishLogOnly({ store, log: updated.log });
392
+ // Conditional on the read this entry was built on: the re-read above when
393
+ // the commit entry ran here, the first read when it was skipped.
394
+ await publishLogOnly({ store, log: updated.log, ifMatch: published.etag });
362
395
  return { did: updated.did, webDoc: updated.webDoc };
363
396
  }
364
397
  //# sourceMappingURL=recoveryWebvh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryWebvh.js","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACV,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAQ7B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,GAAG,EACH,wBAAwB,EAIzB;IACC,OAAO,GAAG,GAAG,IAAI,wBAAwB,EAAE,CAAA;AAC7C,CAAC;AAYD;;;;GAIG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACrD,YACE,OAAO,GAAG,4DAA4D;QACpE,4CAA4C;QAE9C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAA;IAC5C,CAAC;CACF;AAYD;;;;;;GAMG;AACH,KAAK,UAAU,cAAc,CAAC,EAC5B,KAAK,EAGN;IACC,4EAA4E;IAC5E,MA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,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;AACrD,CAAC"}
@@ -9,12 +9,19 @@ import type { DidWebKeyMap } from './didWeb.js';
9
9
  */
10
10
  export interface WebvhIdStore {
11
11
  /**
12
- * The raw text body of an `id` collection resource (the JSON-Lines log), or
13
- * `undefined` when it is not published.
12
+ * The raw text body of an `id` collection resource (the JSON-Lines log)
13
+ * together with its ETag validator, or `undefined` when it is not published.
14
+ * The `etag` is the compare-and-swap token a ceremony hands back as
15
+ * {@link putIdResource}'s `ifMatch`; it is absent against a backend that does
16
+ * not version resources, in which case the ceremony's publish degrades to an
17
+ * unconditional write.
14
18
  */
15
19
  getIdResourceRaw(options: {
16
20
  resourceId: string;
17
- }): Promise<string | undefined>;
21
+ }): Promise<{
22
+ text: string;
23
+ etag?: string;
24
+ } | undefined>;
18
25
  /**
19
26
  * The parsed JSON body of an `id` collection resource (the DID document), or
20
27
  * `undefined` when it is not published.
@@ -23,12 +30,22 @@ export interface WebvhIdStore {
23
30
  resourceId: string;
24
31
  }): Promise<unknown>;
25
32
  /**
26
- * Writes (upserts) an `id` collection resource.
33
+ * Writes (upserts) an `id` collection resource, optionally conditionally:
34
+ * `ifMatch` writes only if the resource's current ETag matches (an
35
+ * update-if-unchanged), `ifNoneMatch` writes only if the resource is absent
36
+ * (a create-if-absent). With neither the write is unconditional.
37
+ *
38
+ * Contract: a failed precondition MUST surface as an error whose `name` is
39
+ * `'PreconditionFailedError'` (was-client's class; any implementation may
40
+ * throw its own error carrying that name), which this module maps to
41
+ * {@link WebvhLogConflictError}.
27
42
  */
28
43
  putIdResource(options: {
29
44
  resourceId: string;
30
45
  content: object | string;
31
46
  contentType?: string;
47
+ ifMatch?: string;
48
+ ifNoneMatch?: boolean;
32
49
  }): Promise<void>;
33
50
  /**
34
51
  * Writes (upserts) `keys.json` in the private `key-map` collection.
@@ -134,6 +151,54 @@ export declare function updateKeyMultibase({ seed }: {
134
151
  export declare function updateKeySigner({ seed }: {
135
152
  seed: Uint8Array;
136
153
  }): Promise<Signer>;
154
+ /**
155
+ * Thrown when a conditional publish of `did.jsonl` lost a race to a concurrent
156
+ * ceremony: the log moved on between the read this ceremony built its entry on
157
+ * and the PUT that would have appended it. The `cause` is the store's
158
+ * precondition error. A ceremony that meets one either re-runs (rebasing its
159
+ * entry on the new head -- what {@link withLogConflictRetry} does) or refuses,
160
+ * but it never overwrites the winner's entry.
161
+ */
162
+ export declare class WebvhLogConflictError extends Error {
163
+ constructor(message?: string, options?: {
164
+ cause?: unknown;
165
+ });
166
+ }
167
+ /**
168
+ * Re-runs `run` when it fails with a {@link WebvhLogConflictError}, up to three
169
+ * total attempts, then rethrows. The retry IS the rebase: every ceremony in
170
+ * this module re-reads the published head and rebuilds its entry on it, and
171
+ * every one of them detects its own completion from durable state alone, so a
172
+ * naive re-run after a lost race appends on top of the winner instead of over
173
+ * it. A ceremony whose preconditions no longer hold after the re-read (the
174
+ * retrying client was itself revoked, the staged key it was about to reveal is
175
+ * no longer committed) surfaces its own typed refusal instead of looping.
176
+ *
177
+ * @param run {Function} the ceremony body, re-invokable from the top
178
+ * @returns {Promise<*>} whatever the ceremony returns
179
+ */
180
+ export declare function withLogConflictRetry<T>(run: () => Promise<T>): Promise<T>;
181
+ /**
182
+ * PUTs the serialized log to `did.jsonl`, forwarding the conditional-write
183
+ * preconditions and mapping a failed one to {@link WebvhLogConflictError}. The
184
+ * single place that mapping exists: the store seam is app-implemented, so the
185
+ * precondition error is matched on `err.name` rather than by `instanceof`,
186
+ * keeping the check implementation-agnostic. With neither precondition the PUT
187
+ * is unconditional -- the degradation on a backend that serves no ETags.
188
+ *
189
+ * @param options {object}
190
+ * @param options.store {object} anything with the seam's `putIdResource`
191
+ * @param options.log {DIDLog}
192
+ * @param [options.ifMatch] {string} publish only if the log is unchanged
193
+ * @param [options.ifNoneMatch] {boolean} publish only if the log is absent
194
+ * @returns {Promise<void>}
195
+ */
196
+ export declare function putLogResource({ store, log, ifMatch, ifNoneMatch }: {
197
+ store: Pick<WebvhIdStore, 'putIdResource'>;
198
+ log: DIDLog;
199
+ ifMatch?: string;
200
+ ifNoneMatch?: boolean;
201
+ }): Promise<void>;
137
202
  /**
138
203
  * Publishes an already-created log: PUT `did.jsonl` (`text/jsonl`) then PUT
139
204
  * `did.json` from `webDoc` (`application/did+json`, adopting the webvh
@@ -142,16 +207,54 @@ export declare function updateKeySigner({ seed }: {
142
207
  * the publish tail no longer sets per-resource policies. The shared publish
143
208
  * tail of the create and rotate paths.
144
209
  *
210
+ * The log PUT carries the caller's precondition (`ifMatch`, the ETag of the
211
+ * read the entry was built on, or `ifNoneMatch` for a create), so a ceremony
212
+ * that lost a race to a concurrent one fails with
213
+ * {@link WebvhLogConflictError} instead of silently erasing the winner's entry.
214
+ * The `did.json` projection PUT stays unconditional by design: it runs only
215
+ * after the log's compare-and-swap was WON, so it is already serialized behind
216
+ * that win; the log is the source of truth and the projection a derived cache;
217
+ * and {@link concludeWithPublishedLog} re-derives and republishes the
218
+ * projection from the resolved log on every ceremony's no-op path, healing any
219
+ * lag a race or a torn publish leaves behind.
220
+ *
145
221
  * @param options {object}
146
222
  * @param options.idStore {WebvhIdStore}
147
223
  * @param options.log {DIDLog}
148
224
  * @param options.webDoc {object}
225
+ * @param [options.ifMatch] {string} publish only if `did.jsonl` is unchanged
226
+ * @param [options.ifNoneMatch] {boolean} publish only if `did.jsonl` is absent
149
227
  * @returns {Promise<void>}
150
228
  */
151
- export declare function publishWebvhLog({ idStore, log, webDoc }: {
229
+ export declare function publishWebvhLog({ idStore, log, webDoc, ifMatch, ifNoneMatch }: {
152
230
  idStore: WebvhIdStore;
153
231
  log: DIDLog;
154
232
  webDoc: object;
233
+ ifMatch?: string;
234
+ ifNoneMatch?: boolean;
235
+ }): Promise<void>;
236
+ /**
237
+ * The shared guard-and-publish tail of every ceremony that extends the log
238
+ * through `updateDID`: the parallel `webDoc` must be there (it is, whenever
239
+ * `alsoKnownAsWeb` was passed), then log and projection are published under the
240
+ * caller's compare-and-swap token.
241
+ *
242
+ * @param options {object}
243
+ * @param options.idStore {WebvhIdStore}
244
+ * @param options.updated {object} the `updateDID` result
245
+ * @param options.updated.log {DIDLog}
246
+ * @param [options.updated.webDoc] {object}
247
+ * @param [options.ifMatch] {string} the ETag of the read this entry was built
248
+ * on
249
+ * @returns {Promise<void>}
250
+ */
251
+ export declare function publishUpdatedLog({ idStore, updated, ifMatch }: {
252
+ idStore: WebvhIdStore;
253
+ updated: {
254
+ log: DIDLog;
255
+ webDoc?: object;
256
+ };
257
+ ifMatch?: string;
155
258
  }): Promise<void>;
156
259
  /**
157
260
  * The verified state of the published log: the log itself, the resolved DID
@@ -164,6 +267,12 @@ export interface PublishedWebvhLog {
164
267
  doc: DIDDoc;
165
268
  updateKeys: string[];
166
269
  nextKeyHashes: string[];
270
+ /**
271
+ * The `did.jsonl` ETag observed by the read that produced this state -- the
272
+ * `ifMatch` token for the publish of any entry built on it. Absent against a
273
+ * backend that serves no ETags, where the publish degrades to unconditional.
274
+ */
275
+ etag?: string;
167
276
  }
168
277
  /**
169
278
  * Reads and resolves the published `did.jsonl`, or returns `undefined` when
@@ -190,7 +299,9 @@ export declare function readPublishedLog({ idStore }: {
190
299
  * unconditionally rather than compared first: the write is idempotent and one
191
300
  * request either way, and the resolved log is the source of truth for what the
192
301
  * projection must say. A ceremony that no-ops on the log therefore still heals
193
- * a torn earlier publish.
302
+ * a torn earlier publish. The projection PUT is deliberately unconditional
303
+ * here too: healing it is the whole point, and the log it was derived from is
304
+ * the state this call just read and resolved.
194
305
  *
195
306
  * @param options {object}
196
307
  * @param options.idStore {WebvhIdStore}
@@ -236,6 +347,12 @@ export declare function effectiveParameters(log: DIDLog): Array<{
236
347
  * client-held update keys a lost seed is lost update authority, and no KMS
237
348
  * repair path exists by design.
238
349
  *
350
+ * The create publishes `did.jsonl` create-if-absent, so two concurrent signups
351
+ * cannot double-create the log: the loser re-runs (see
352
+ * {@link withLogConflictRetry}) and takes the adoption path against the
353
+ * winner's log -- adopting it when it holds this client's seeds, and raising
354
+ * the lost-seed refusal when it does not.
355
+ *
239
356
  * @param options {object}
240
357
  * @param options.idStore {WebvhIdStore}
241
358
  * @param options.wasServerUrl {string}
@@ -246,7 +363,7 @@ export declare function effectiveParameters(log: DIDLog): Array<{
246
363
  * @param options.updateKeys {ClientWebvhUpdateKeys} already durably persisted
247
364
  * @returns {Promise<{ did: string }>}
248
365
  */
249
- export declare function ensureDidWebvh({ idStore, wasServerUrl, spaceId, didWebKeys, clientKeys, updateKeys }: {
366
+ export declare function ensureDidWebvh(options: {
250
367
  idStore: WebvhIdStore;
251
368
  wasServerUrl: string;
252
369
  spaceId: string;
@@ -277,6 +394,11 @@ export declare function ensureDidWebvh({ idStore, wasServerUrl, spaceId, didWebK
277
394
  * than left to the resolver, so a diverged client fails with a statement of
278
395
  * what diverged instead of persisting rolled seeds and then failing opaquely.
279
396
  *
397
+ * The entry publishes conditionally on the log this ceremony read, so a
398
+ * concurrent ceremony's entry is never erased; a lost race re-runs from the top
399
+ * (see {@link withLogConflictRetry}), which mints and persists a fresh staged
400
+ * seed again -- the documented cost of a torn rotation, one unused staged key.
401
+ *
280
402
  * @param options {object}
281
403
  * @param options.idStore {WebvhIdStore}
282
404
  * @param options.updateKeys {ClientWebvhUpdateKeys} the current seeds
@@ -284,7 +406,7 @@ export declare function ensureDidWebvh({ idStore, wasServerUrl, spaceId, didWebK
284
406
  * that changes the log's authorized update keys
285
407
  * @returns {Promise<{ did: string }>}
286
408
  */
287
- export declare function rotateWebvhUpdateKey({ idStore, updateKeys, persistUpdateKeys }: {
409
+ export declare function rotateWebvhUpdateKey(options: {
288
410
  idStore: WebvhIdStore;
289
411
  updateKeys: ClientWebvhUpdateKeys;
290
412
  persistUpdateKeys: (next: ClientWebvhUpdateKeys) => Promise<void>;
@@ -348,13 +470,18 @@ export declare function relationIds(relation: Array<string | {
348
470
  * (no-op). Re-running with the same key set converges without forking the
349
471
  * log.
350
472
  *
473
+ * Each entry publishes conditionally on the read it was built on (the add
474
+ * entry on the mid-ceremony re-read), so a concurrent ceremony -- a revocation,
475
+ * another enrollment -- can never be erased by this one; a lost race re-runs
476
+ * from the top (see {@link withLogConflictRetry}) and rebases on the new head.
477
+ *
351
478
  * @param options {object}
352
479
  * @param options.idStore {WebvhIdStore}
353
480
  * @param options.updateKeys {ClientWebvhUpdateKeys} THIS client's seeds
354
481
  * @param options.newClient {WebvhEnrollmentKeys} the enrollee's public halves
355
482
  * @returns {Promise<{ did: string }>}
356
483
  */
357
- export declare function enrollWebvhClient({ idStore, updateKeys, newClient }: {
484
+ export declare function enrollWebvhClient(options: {
358
485
  idStore: WebvhIdStore;
359
486
  updateKeys: ClientWebvhUpdateKeys;
360
487
  newClient: WebvhEnrollmentKeys;
@@ -1 +1 @@
1
- {"version":3,"file":"didWebvh.d.ts","sourceRoot":"","sources":["../../src/webvh/didWebvh.ts"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EACN,MAAM,EAEP,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAO3D,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC9E;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChE;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE;QACrB,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACj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