@interop/wallet-core 0.44.0 → 0.46.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 (103) hide show
  1. package/dist/clients/revocation.d.ts +2 -25
  2. package/dist/clients/revocation.d.ts.map +1 -1
  3. package/dist/clients/revocation.js +25 -96
  4. package/dist/clients/revocation.js.map +1 -1
  5. package/dist/keyring/record.d.ts +4 -3
  6. package/dist/keyring/record.d.ts.map +1 -1
  7. package/dist/keyring/record.js.map +1 -1
  8. package/dist/keys/index.d.ts +7 -0
  9. package/dist/keys/index.d.ts.map +1 -1
  10. package/dist/keys/index.js +6 -0
  11. package/dist/keys/index.js.map +1 -1
  12. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  13. package/dist/keys/rosterLogStore.js +18 -1
  14. package/dist/keys/rosterLogStore.js.map +1 -1
  15. package/dist/keys/userKeyRosterCascade.d.ts +121 -0
  16. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -0
  17. package/dist/keys/userKeyRosterCascade.js +125 -0
  18. package/dist/keys/userKeyRosterCascade.js.map +1 -0
  19. package/dist/recovery/index.d.ts +1 -1
  20. package/dist/recovery/index.d.ts.map +1 -1
  21. package/dist/recovery/index.js +1 -1
  22. package/dist/recovery/index.js.map +1 -1
  23. package/dist/recovery/recoveryDelegation.d.ts +27 -40
  24. package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
  25. package/dist/recovery/recoveryDelegation.js +119 -53
  26. package/dist/recovery/recoveryDelegation.js.map +1 -1
  27. package/dist/recovery/recoveryWebvh.d.ts +9 -2
  28. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  29. package/dist/recovery/recoveryWebvh.js +4 -2
  30. package/dist/recovery/recoveryWebvh.js.map +1 -1
  31. package/dist/resourceLog/controller.d.ts +38 -3
  32. package/dist/resourceLog/controller.d.ts.map +1 -1
  33. package/dist/resourceLog/controller.js +106 -10
  34. package/dist/resourceLog/controller.js.map +1 -1
  35. package/dist/resourceLog/errors.d.ts +22 -1
  36. package/dist/resourceLog/errors.d.ts.map +1 -1
  37. package/dist/resourceLog/errors.js +23 -1
  38. package/dist/resourceLog/errors.js.map +1 -1
  39. package/dist/resourceLog/index.d.ts +8 -6
  40. package/dist/resourceLog/index.d.ts.map +1 -1
  41. package/dist/resourceLog/index.js +7 -5
  42. package/dist/resourceLog/index.js.map +1 -1
  43. package/dist/resourceLog/license.d.ts +44 -0
  44. package/dist/resourceLog/license.d.ts.map +1 -0
  45. package/dist/resourceLog/license.js +63 -0
  46. package/dist/resourceLog/license.js.map +1 -0
  47. package/dist/resourceLog/verify.d.ts +3 -2
  48. package/dist/resourceLog/verify.d.ts.map +1 -1
  49. package/dist/resourceLog/verify.js +30 -8
  50. package/dist/resourceLog/verify.js.map +1 -1
  51. package/dist/unlock/index.d.ts +22 -8
  52. package/dist/unlock/index.d.ts.map +1 -1
  53. package/dist/unlock/index.js +21 -8
  54. package/dist/unlock/index.js.map +1 -1
  55. package/dist/unlock/ladder.d.ts +76 -0
  56. package/dist/unlock/ladder.d.ts.map +1 -1
  57. package/dist/unlock/ladder.js +111 -1
  58. package/dist/unlock/ladder.js.map +1 -1
  59. package/dist/unlock/retire.d.ts +126 -0
  60. package/dist/unlock/retire.d.ts.map +1 -0
  61. package/dist/unlock/retire.js +83 -0
  62. package/dist/unlock/retire.js.map +1 -0
  63. package/dist/unlock/standingWebvh.d.ts +50 -3
  64. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  65. package/dist/unlock/standingWebvh.js +78 -9
  66. package/dist/unlock/standingWebvh.js.map +1 -1
  67. package/dist/unlock/unlockRecord.d.ts +28 -8
  68. package/dist/unlock/unlockRecord.d.ts.map +1 -1
  69. package/dist/unlock/unlockRecord.js +93 -13
  70. package/dist/unlock/unlockRecord.js.map +1 -1
  71. package/dist/webvh/companion.d.ts +681 -0
  72. package/dist/webvh/companion.d.ts.map +1 -0
  73. package/dist/webvh/companion.js +1151 -0
  74. package/dist/webvh/companion.js.map +1 -0
  75. package/dist/webvh/delegatedLogStore.d.ts +67 -0
  76. package/dist/webvh/delegatedLogStore.d.ts.map +1 -0
  77. package/dist/webvh/delegatedLogStore.js +104 -0
  78. package/dist/webvh/delegatedLogStore.js.map +1 -0
  79. package/dist/webvh/didWebvh.d.ts +109 -5
  80. package/dist/webvh/didWebvh.d.ts.map +1 -1
  81. package/dist/webvh/didWebvh.js +186 -21
  82. package/dist/webvh/didWebvh.js.map +1 -1
  83. package/dist/webvh/index.d.ts +34 -5
  84. package/dist/webvh/index.d.ts.map +1 -1
  85. package/dist/webvh/index.js +31 -5
  86. package/dist/webvh/index.js.map +1 -1
  87. package/dist/webvh/listClients.d.ts +33 -0
  88. package/dist/webvh/listClients.d.ts.map +1 -1
  89. package/dist/webvh/listClients.js +27 -0
  90. package/dist/webvh/listClients.js.map +1 -1
  91. package/dist/webvh/standingZcap.d.ts +48 -0
  92. package/dist/webvh/standingZcap.d.ts.map +1 -0
  93. package/dist/webvh/standingZcap.js +54 -0
  94. package/dist/webvh/standingZcap.js.map +1 -0
  95. package/dist/webvh/wasIdStore.d.ts +36 -6
  96. package/dist/webvh/wasIdStore.d.ts.map +1 -1
  97. package/dist/webvh/wasIdStore.js +32 -13
  98. package/dist/webvh/wasIdStore.js.map +1 -1
  99. package/dist/webvh/zcap.d.ts +24 -0
  100. package/dist/webvh/zcap.d.ts.map +1 -1
  101. package/dist/webvh/zcap.js +42 -0
  102. package/dist/webvh/zcap.js.map +1 -1
  103. package/package.json +9 -9
@@ -0,0 +1,125 @@
1
+ import { webvhResourceLogController } from '../resourceLog/index.js';
2
+ import { cascadeCollectionsToUserKey } from './userKeyCascade.js';
3
+ import { isSealableDescriptorStore } from './rosterLogStore.js';
4
+ import { convergeUserKeyRosterToDocument, readUserKeyRoster } from './userKeyRoster.js';
5
+ /**
6
+ * Resolves the collection ids the fan-out covers, whether they are a fixed set
7
+ * or a listing the app performs.
8
+ *
9
+ * @param options {object}
10
+ * @param options.collections {CascadeCollections}
11
+ * @returns {Promise<string[]>}
12
+ */
13
+ async function collectionIdsOf({ collections }) {
14
+ const { collectionIds } = collections;
15
+ return typeof collectionIds === 'function'
16
+ ? await collectionIds()
17
+ : collectionIds;
18
+ }
19
+ /**
20
+ * Runs the roster rotation (with its seal backstop) and the collection
21
+ * fan-out over the document a ceremony's own edit just published. See the
22
+ * module doc for the order and the convergence story.
23
+ *
24
+ * @param options {object}
25
+ * @param options.rosterStore {EncryptionDescriptorStore} the
26
+ * `key-map/user-key.jsonl` roster store
27
+ * @param options.did {string} the account's did:webvh
28
+ * @param options.doc {DIDDoc} the document as the ceremony's edit left it
29
+ * @param options.log {DIDLog} the post-edit log, which the controller floor
30
+ * is built from
31
+ * @param [options.userKey] {UserKey} this client's cached user key
32
+ * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
33
+ * (identity) key-agreement key -- its roster entry
34
+ * @param [options.pinnedEpochId] {string} the locally pinned latest-seen
35
+ * roster epoch
36
+ * @param [options.onUserKeyAdopted] {Function} persists a rotated key:
37
+ * called with `{ userKey, latestEpochId, descriptor }` after the roster read
38
+ * and BEFORE the fan-out. The key and the epoch pin must persist atomically
39
+ * @param options.collections {CascadeCollections} the fan-out's work
40
+ * @returns {Promise<RosterCascadeResult>}
41
+ */
42
+ export async function rotateRosterToDocumentAndCascade({ rosterStore, did, doc, log, userKey, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections }) {
43
+ // The post-edit anchoring guarantee: the roster appends -- and the seal
44
+ // backstop's removal detection -- must run under a controller view that
45
+ // includes the edit the ceremony just published, or the rotation anchors
46
+ // pre-edit and the log stays unsealed with the seal blind to the removal.
47
+ // Rather than leaving that to the injected store's own controller wiring,
48
+ // the view built from the edit's post-edit log is set as the store's floor;
49
+ // a fresher resolved view still wins.
50
+ if (isSealableDescriptorStore(rosterStore)) {
51
+ rosterStore.setControllerFloor({
52
+ controller: webvhResourceLogController({ did, log })
53
+ });
54
+ }
55
+ // The roster rotation, recipients resolved from that same document.
56
+ // Whether there IS a roster is settled BY the convergence call itself: a
57
+ // `null` descriptor back means the account has no `key-map/user-key.jsonl`
58
+ // yet (its collections are not encrypted yet), so there is nothing to
59
+ // rotate. The document edit has already landed, so the membership change IS
60
+ // in force -- a completed ceremony with nothing rotated, not a failure.
61
+ // Pairing-free: rather than naming the removed party's kid, the rotation
62
+ // retires every current-epoch recipient the post-edit document no longer
63
+ // keys -- which is exactly that party's entry, plus anything an earlier torn
64
+ // run left behind, in one rotation.
65
+ const converged = await convergeUserKeyRosterToDocument({
66
+ store: rosterStore,
67
+ document: doc
68
+ });
69
+ if (converged.descriptor === null) {
70
+ return { rotated: false, collections: { outcomes: {}, failed: [] } };
71
+ }
72
+ // The rotation's own verified result is threaded into the adopting read, so
73
+ // one run acquires the roster once for both halves of the stage (the
74
+ // continuity and possession checks still run on the threaded descriptor).
75
+ const read = await readUserKeyRoster({
76
+ store: rosterStore,
77
+ descriptor: converged.descriptor,
78
+ ...(userKey ? { userKey } : {}),
79
+ clientKeyAgreementKey,
80
+ pinnedEpochId
81
+ });
82
+ if (read.rotated) {
83
+ await onUserKeyAdopted?.({
84
+ userKey: read.userKey,
85
+ latestEpochId: read.latestEpochId,
86
+ descriptor: read.descriptor
87
+ });
88
+ }
89
+ // The seal backstop: an ordinary rotation is the sealing append by
90
+ // construction, but a rotation that no-op'd (the removed party held no
91
+ // current-epoch wrap -- an orphan entry, or any re-run) appended nothing,
92
+ // leaving the roster log's head anchored before the document edit. Sealing
93
+ // is best-effort and reported, never thrown: the document edit landed, and
94
+ // an unsealed log is durable state the login sweep re-detects and finishes.
95
+ let rosterSeal;
96
+ if (isSealableDescriptorStore(rosterStore)) {
97
+ try {
98
+ rosterSeal = { outcome: await rosterStore.seal() };
99
+ }
100
+ catch (err) {
101
+ rosterSeal = { outcome: 'failed', error: err };
102
+ }
103
+ }
104
+ // The collection fan-out, in parallel -- run even when this call found the
105
+ // roster already rotated (a re-run after a crash), because the staleness
106
+ // rule finds exactly the stranded collections.
107
+ const cascade = await cascadeCollectionsToUserKey({
108
+ collectionIds: await collectionIdsOf({ collections }),
109
+ storeFor: collections.storeFor,
110
+ ...(collections.isEncrypted
111
+ ? { isEncrypted: collections.isEncrypted }
112
+ : {}),
113
+ rosterDescriptor: read.descriptor,
114
+ clientKeyAgreementKey,
115
+ userKey: read.userKey
116
+ });
117
+ return {
118
+ rotated: read.rotated,
119
+ ...(rosterSeal ? { rosterSeal } : {}),
120
+ collections: cascade,
121
+ userKey: read.userKey,
122
+ rosterDescriptor: read.descriptor
123
+ };
124
+ }
125
+ //# sourceMappingURL=userKeyRosterCascade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userKeyRosterCascade.js","sourceRoot":"","sources":["../../src/keys/userKeyRosterCascade.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EACL,2BAA2B,EAE5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AA4C3B;;;;;;;GAOG;AACH,KAAK,UAAU,eAAe,CAAC,EAC7B,WAAW,EAGZ;IACC,MAAM,EAAE,aAAa,EAAE,GAAG,WAAW,CAAA;IACrC,OAAO,OAAO,aAAa,KAAK,UAAU;QACxC,CAAC,CAAC,MAAM,aAAa,EAAE;QACvB,CAAC,CAAC,aAAa,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,EACrD,WAAW,EACX,GAAG,EACH,GAAG,EACH,GAAG,EACH,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,WAAW,EAeZ;IACC,wEAAwE;IACxE,wEAAwE;IACxE,yEAAyE;IACzE,0EAA0E;IAC1E,0EAA0E;IAC1E,4EAA4E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AC5E,IAAI,UAAwC,CAAA;IAC5C,IAAI,yBAAyB,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC;YACH,UAAU,GAAG,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC,IAAI,EAAE,EAAE,CAAA;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,UAAU,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;QAChD,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,yEAAyE;IACzE,+CAA+C;IAC/C,MAAM,OAAO,GAAG,MAAM,2BAA2B,CAAC;QAChD,aAAa,EAAE,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,CAAC;QACrD,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,GAAG,CAAC,WAAW,CAAC,WAAW;YACzB,CAAC,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE;YAC1C,CAAC,CAAC,EAAE,CAAC;QACP,gBAAgB,EAAE,IAAI,CAAC,UAAU;QACjC,qBAAqB;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAA;IAEF,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrC,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,gBAAgB,EAAE,IAAI,CAAC,UAAU;KAClC,CAAA;AACH,CAAC"}
@@ -37,7 +37,7 @@
37
37
  */
38
38
  export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
39
39
  export type { RecoveryClient } from './recoveryCode.js';
40
- export { computeUnlockBinding, remintUnlockRecordBridge, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
40
+ export { computeUnlockBinding, remintUnlockRecordDelegations, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
41
41
  export type { SignedUnlockRecord, UnlockRecordContents, UnlockRecordProofState } from '../unlock/unlockRecord.js';
42
42
  export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
43
43
  export type { RecoveryDelegationEntry } from './recoveryDelegation.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAEtE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAEtE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -36,7 +36,7 @@
36
36
  * was-client dependency graph (the same isolation pattern as `./keyring`).
37
37
  */
38
38
  export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
39
- export { computeUnlockBinding, remintUnlockRecordBridge, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
39
+ export { computeUnlockBinding, remintUnlockRecordDelegations, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
40
40
  export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
41
41
  export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
42
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAOlC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAOlC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA"}
@@ -3,45 +3,21 @@ import type { ZcapClient } from '@interop/ezcap';
3
3
  import type { PublishedKeyDocument } from '../webvh/listClients.js';
4
4
  import type { AccountPointer, RecordSigner } from '../keyring/record.js';
5
5
  /**
6
- * The recovery delegation's lifetime: one year, following NIST SP 800-57's
7
- * one-to-two-year cryptoperiod guidance for private signature keys. The
8
- * delegation's scope stays narrow (PUT on the one world-readable DID log
9
- * resource, whose worst-case abuse is a log write that still has to verify
10
- * against the published hash chain and prerotation commitments to resolve),
11
- * but a standing bearer artifact should not outlive its signing key's
12
- * recommended cryptoperiod. A code must keep working past the year, so
13
- * expiry is watched rather than terminal: the registry entry records the
14
- * delegation's `expires`, {@link zcapExpiring} treats the
15
- * renewal window before it as stale, the re-mint refreshes a stale
16
- * delegation, and the login-time recovery health check flags one the same
17
- * way it flags rot (the signing client's verification method leaving the
18
- * document).
6
+ * The recovery delegation's lifetime: the house standing-zcap value
7
+ * ({@link STANDING_ZCAP_TTL_MS} -- one year, per NIST SP 800-57's
8
+ * cryptoperiod guidance; see `webvh/standingZcap.ts`, the policy's one
9
+ * home). The delegation's scope stays narrow (PUT on the one world-readable
10
+ * DID log resource, whose worst-case abuse is a log write that still has to
11
+ * verify against the published hash chain and prerotation commitments to
12
+ * resolve). A code must keep working past the year, so expiry is watched
13
+ * rather than terminal: the registry entry records the delegation's
14
+ * `expires`, {@link zcapExpiring} treats the renewal window before it as
15
+ * stale, the re-mint refreshes a stale delegation, and the login-time
16
+ * recovery health check flags one the same way it flags rot (the signing
17
+ * client's verification method leaving the document).
19
18
  */
20
19
  export declare const RECOVERY_DELEGATION_TTL_MS: number;
21
- /**
22
- * How long before its `expires` a standing recorded zcap counts as stale:
23
- * thirty days, so a refresh (a re-mint, a login-time re-delegation) or a
24
- * regenerate nudge lands well before the zcap actually lapses.
25
- */
26
- export declare const ZCAP_RENEWAL_WINDOW_MS: number;
27
- /**
28
- * Whether a recorded zcap expiry is past or inside the renewal window -- the
29
- * expiry half of the staleness predicate for every long-lived zcap a wallet
30
- * records beside its registry entries (the recovery `did.jsonl` delegation,
31
- * an unlock Space's management zcap). The re-mint and the wallets'
32
- * login-time checks all ask this one predicate. A record carrying no expiry
33
- * (or an unparseable one) is uncheckable and therefore not assumed healthy,
34
- * matching the rot check's treatment of a missing `delegationKeyId`.
35
- *
36
- * @param options {object}
37
- * @param [options.expires] {string} the recorded ISO 8601 expiry
38
- * @param [options.now] {number} epoch milliseconds, for tests
39
- * @returns {boolean}
40
- */
41
- export declare function zcapExpiring({ expires, now }: {
42
- expires?: string;
43
- now?: number;
44
- }): boolean;
20
+ export { ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from '../webvh/standingZcap.js';
45
21
  /**
46
22
  * Delegates the narrow log-write bridge to a code-derived client: PUT on the
47
23
  * one `did.jsonl` resource, {@link RECOVERY_DELEGATION_TTL_MS} lifetime. The
@@ -76,9 +52,14 @@ export declare function delegationProofKeyId(delegation: IZcap): string | undefi
76
52
  * (`delegationKeyId` / `delegationExpires` -- either absent on an entry
77
53
  * predating its field, which the staleness checks conservatively flag), and
78
54
  * the re-mint fields: the code-derived signing DID the fresh delegation names
79
- * and the unlock KAK public half the record is re-wrapped to. Structural on
55
+ * and the unlock KAK public half the record is re-wrapped to. A standing
56
+ * credential's entry additionally tracks its companion-Space sibling
57
+ * delegation as a second scalar pair (`delegatedClientsKeyId` /
58
+ * `delegatedClientsExpires` -- absent for recovery codes, mirroring the
59
+ * record member's optionality); the sibling rots on exactly the bridge's
60
+ * axis, so one pass reseals both. Structural on
80
61
  * purpose -- an app's richer registry entry satisfies it, and the re-mint
81
- * hands the SAME entry back (with the fresh `delegationKeyId`) through the
62
+ * hands the SAME entry back (with the fresh key ids and expiries) through the
82
63
  * record seam, extra members untouched.
83
64
  */
84
65
  export interface RecoveryDelegationEntry {
@@ -87,6 +68,8 @@ export interface RecoveryDelegationEntry {
87
68
  manageCapability?: IZcap;
88
69
  delegationKeyId?: string;
89
70
  delegationExpires?: string;
71
+ delegatedClientsKeyId?: string;
72
+ delegatedClientsExpires?: string;
90
73
  recoveryClientDid?: string;
91
74
  unlockKeyAgreementKeyId?: string;
92
75
  unlockKeyAgreementKeyMultibase?: string;
@@ -98,7 +81,11 @@ export interface RecoveryDelegationEntry {
98
81
  *
99
82
  * The record's credential-authenticated core is preserved verbatim: the
100
83
  * re-mint reads the standing record through the entry's management zcap and
101
- * replaces only its bridge member ({@link remintUnlockRecordBridge}) -- the
84
+ * replaces only its delegation members
85
+ * ({@link remintUnlockRecordDelegations}) -- the bridge always, and the
86
+ * companion-Space sibling where the entry records one (the two rot on one
87
+ * axis, so both reseal in the same atomic pass and one registry-entry
88
+ * rewrite records both fresh pairs). The
102
89
  * shell, the ladder member (where one rides), and the binding tag all travel
103
90
  * untouched, since the re-mint can decrypt none of them and does not need to.
104
91
  * A re-mint therefore can never change the pointer or controller the
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAoB,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,OAAO,K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AAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAmJjD"}
@@ -22,7 +22,11 @@
22
22
  * record to the code's unlock KAK (the public half the registry records --
23
23
  * the record carries no secrets, so re-encryption needs none), re-PUTs it
24
24
  * through the entry's management zcap, and updates the registry's
25
- * `delegationKeyId` and `delegationExpires`. The skip policy is
25
+ * `delegationKeyId` and `delegationExpires`. A standing credential's
26
+ * companion-Space sibling delegation rides the same pass (its scalar pair is
27
+ * `delegatedClientsKeyId` / `delegatedClientsExpires`): either member going
28
+ * stale reseals both, and the one registry rewrite records both fresh pairs
29
+ * -- a re-mint handling only the bridge is incomplete. The skip policy is
26
30
  * cross-replica correctness and is
27
31
  * decided here once: an entry that predates the re-mint fields, or whose
28
32
  * standing record cannot be read or carries no binding, is skipped and stays
@@ -31,66 +35,48 @@
31
35
  * registry read/record halves.
32
36
  */
33
37
  import { X25519KeyAgreementKey2020 } from '@interop/x25519-key-agreement-key';
38
+ import { resourcePath, toUrl } from '@interop/was-client/paths';
34
39
  import { DID_LOG_RESOURCE, ID_COLLECTION } from '../space/collections.js';
35
40
  import { delegationKeyInDocument } from '../webvh/listClients.js';
36
41
  import { getUnlockKeyringWithCapability, putUnlockKeyringWithCapability } from '../keyring/unlockSpace.js';
37
- import { remintUnlockRecordBridge } from '../unlock/unlockRecord.js';
42
+ import { remintUnlockRecordDelegations } from '../unlock/unlockRecord.js';
43
+ import { STANDING_ZCAP_TTL_MS, zcapExpiring } from '../webvh/standingZcap.js';
44
+ import { companionDidParts, delegatedClientsPointer, mintDelegatedClientsDelegation } from '../webvh/companion.js';
38
45
  /**
39
- * The recovery delegation's lifetime: one year, following NIST SP 800-57's
40
- * one-to-two-year cryptoperiod guidance for private signature keys. The
41
- * delegation's scope stays narrow (PUT on the one world-readable DID log
42
- * resource, whose worst-case abuse is a log write that still has to verify
43
- * against the published hash chain and prerotation commitments to resolve),
44
- * but a standing bearer artifact should not outlive its signing key's
45
- * recommended cryptoperiod. A code must keep working past the year, so
46
- * expiry is watched rather than terminal: the registry entry records the
47
- * delegation's `expires`, {@link zcapExpiring} treats the
48
- * renewal window before it as stale, the re-mint refreshes a stale
49
- * delegation, and the login-time recovery health check flags one the same
50
- * way it flags rot (the signing client's verification method leaving the
51
- * document).
46
+ * The recovery delegation's lifetime: the house standing-zcap value
47
+ * ({@link STANDING_ZCAP_TTL_MS} -- one year, per NIST SP 800-57's
48
+ * cryptoperiod guidance; see `webvh/standingZcap.ts`, the policy's one
49
+ * home). The delegation's scope stays narrow (PUT on the one world-readable
50
+ * DID log resource, whose worst-case abuse is a log write that still has to
51
+ * verify against the published hash chain and prerotation commitments to
52
+ * resolve). A code must keep working past the year, so expiry is watched
53
+ * rather than terminal: the registry entry records the delegation's
54
+ * `expires`, {@link zcapExpiring} treats the renewal window before it as
55
+ * stale, the re-mint refreshes a stale delegation, and the login-time
56
+ * recovery health check flags one the same way it flags rot (the signing
57
+ * client's verification method leaving the document).
52
58
  */
53
- export const RECOVERY_DELEGATION_TTL_MS = 365 * 24 * 60 * 60 * 1000;
54
- /**
55
- * How long before its `expires` a standing recorded zcap counts as stale:
56
- * thirty days, so a refresh (a re-mint, a login-time re-delegation) or a
57
- * regenerate nudge lands well before the zcap actually lapses.
58
- */
59
- export const ZCAP_RENEWAL_WINDOW_MS = 30 * 24 * 60 * 60 * 1000;
60
- /**
61
- * Whether a recorded zcap expiry is past or inside the renewal window -- the
62
- * expiry half of the staleness predicate for every long-lived zcap a wallet
63
- * records beside its registry entries (the recovery `did.jsonl` delegation,
64
- * an unlock Space's management zcap). The re-mint and the wallets'
65
- * login-time checks all ask this one predicate. A record carrying no expiry
66
- * (or an unparseable one) is uncheckable and therefore not assumed healthy,
67
- * matching the rot check's treatment of a missing `delegationKeyId`.
68
- *
69
- * @param options {object}
70
- * @param [options.expires] {string} the recorded ISO 8601 expiry
71
- * @param [options.now] {number} epoch milliseconds, for tests
72
- * @returns {boolean}
73
- */
74
- export function zcapExpiring({ expires, now = Date.now() }) {
75
- if (!expires) {
76
- return true;
77
- }
78
- const expiresAt = Date.parse(expires);
79
- if (Number.isNaN(expiresAt)) {
80
- return true;
81
- }
82
- return expiresAt - now <= ZCAP_RENEWAL_WINDOW_MS;
83
- }
59
+ export const RECOVERY_DELEGATION_TTL_MS = STANDING_ZCAP_TTL_MS;
60
+ // Re-exported from their shared leaf home (`webvh/standingZcap.ts`), so this
61
+ // module's public surface predating the move is unchanged.
62
+ export { ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from '../webvh/standingZcap.js';
84
63
  /**
85
64
  * The absolute URL of the account's `did.jsonl` log resource -- the
86
- * invocation target of the pre-minted recovery delegation.
65
+ * invocation target of the pre-minted recovery delegation. Built with
66
+ * was-client's path builders, the one owner of the WAS path grammar, so the
67
+ * path is joined onto the pointer host's base path (a sub-path deployment
68
+ * keeps its prefix) and the minted target matches the URL the server checks
69
+ * it against byte for byte.
87
70
  *
88
71
  * @param options {object}
89
72
  * @param options.pointer {AccountPointer}
90
73
  * @returns {string}
91
74
  */
92
75
  function didLogUrl({ pointer }) {
93
- return new URL(`/space/${pointer.spaceId}/${ID_COLLECTION.id}/${DID_LOG_RESOURCE}`, pointer.host).toString();
76
+ return toUrl({
77
+ serverUrl: pointer.host,
78
+ path: resourcePath(pointer.spaceId, ID_COLLECTION.id, DID_LOG_RESOURCE)
79
+ });
94
80
  }
95
81
  /**
96
82
  * Delegates the narrow log-write bridge to a code-derived client: PUT on the
@@ -126,6 +112,33 @@ export function delegationProofKeyId(delegation) {
126
112
  const single = Array.isArray(proof) ? proof[0] : proof;
127
113
  return single?.verificationMethod;
128
114
  }
115
+ /**
116
+ * The auxiliary companion Space id the account document currently points at,
117
+ * read off its delegated-clients service entry (the companion DID string
118
+ * embeds the Space id) -- what the re-mint rebuilds a sibling delegation's
119
+ * target from. `undefined` while the account points at no generation.
120
+ *
121
+ * @param options {object}
122
+ * @param options.doc {PublishedKeyDocument} the locally verified document
123
+ * @returns {string | undefined}
124
+ */
125
+ function companionSpaceIdFromDocument({ doc }) {
126
+ // The verified document callers pass is the full resolved DID document;
127
+ // `PublishedKeyDocument` is its structural narrowing, and the companion
128
+ // helper runtime-checks the service list it reads.
129
+ const companionDid = delegatedClientsPointer({
130
+ doc: doc
131
+ });
132
+ if (!companionDid) {
133
+ return undefined;
134
+ }
135
+ try {
136
+ return companionDidParts({ did: companionDid }).spaceId;
137
+ }
138
+ catch {
139
+ return undefined;
140
+ }
141
+ }
129
142
  /**
130
143
  * Re-mints the recovery delegations the current document no longer backs --
131
144
  * the recovery-code delta riding the revocation cascade (see the module doc
@@ -133,7 +146,11 @@ export function delegationProofKeyId(delegation) {
133
146
  *
134
147
  * The record's credential-authenticated core is preserved verbatim: the
135
148
  * re-mint reads the standing record through the entry's management zcap and
136
- * replaces only its bridge member ({@link remintUnlockRecordBridge}) -- the
149
+ * replaces only its delegation members
150
+ * ({@link remintUnlockRecordDelegations}) -- the bridge always, and the
151
+ * companion-Space sibling where the entry records one (the two rot on one
152
+ * axis, so both reseal in the same atomic pass and one registry-entry
153
+ * rewrite records both fresh pairs). The
137
154
  * shell, the ladder member (where one rides), and the binding tag all travel
138
155
  * untouched, since the re-mint can decrypt none of them and does not need to.
139
156
  * A re-mint therefore can never change the pointer or controller the
@@ -185,7 +202,24 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
185
202
  const expiring = zcapExpiring({
186
203
  ...(entry.delegationExpires ? { expires: entry.delegationExpires } : {})
187
204
  });
188
- if (stands && !expiring) {
205
+ // The companion-Space sibling, where the entry records one, is checked
206
+ // on the same two axes; either member going stale re-mints BOTH in one
207
+ // atomic pass (both resealed, one registry-entry rewrite).
208
+ const siblingRecorded = entry.delegatedClientsKeyId !== undefined ||
209
+ entry.delegatedClientsExpires !== undefined;
210
+ const siblingStale = siblingRecorded &&
211
+ (!delegationKeyInDocument({
212
+ doc,
213
+ ...(entry.delegatedClientsKeyId
214
+ ? { delegationKeyId: entry.delegatedClientsKeyId }
215
+ : {})
216
+ }) ||
217
+ zcapExpiring({
218
+ ...(entry.delegatedClientsExpires
219
+ ? { expires: entry.delegatedClientsExpires }
220
+ : {})
221
+ }));
222
+ if (stands && !expiring && !siblingStale) {
189
223
  continue;
190
224
  }
191
225
  if (!entry.recoveryClientDid ||
@@ -200,7 +234,7 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
200
234
  try {
201
235
  // The standing record, whose credential-authenticated core travels
202
236
  // verbatim (a record with no binding predates the standing layout and
203
- // cannot be re-minted -- `remintUnlockRecordBridge` refuses, and the
237
+ // cannot be re-minted -- `remintUnlockRecordDelegations` refuses, and the
204
238
  // entry is skipped into the health check's regenerate nudge).
205
239
  const standing = await getUnlockKeyringWithCapability({
206
240
  storageServerUrl,
@@ -215,6 +249,29 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
215
249
  pointer,
216
250
  recoveryClientDid: entry.recoveryClientDid
217
251
  });
252
+ // The fresh companion-Space sibling, for an entry that records one.
253
+ // Its target Space id is read off the account document's
254
+ // delegated-clients service entry; a document not (yet) pointing at a
255
+ // generation leaves nothing to rebuild the target from, so the old
256
+ // sealed member travels verbatim and the pair stays stale-flagged for
257
+ // the login-time health check.
258
+ let delegatedClients;
259
+ if (siblingRecorded) {
260
+ const companionSpaceId = companionSpaceIdFromDocument({ doc });
261
+ if (companionSpaceId) {
262
+ delegatedClients = await mintDelegatedClientsDelegation({
263
+ zcapClient,
264
+ wasServerUrl: pointer.host,
265
+ companionSpaceId,
266
+ controller: entry.recoveryClientDid
267
+ });
268
+ }
269
+ else {
270
+ console.warn(`The account document names no companion generation; the ` +
271
+ `delegatedClients delegation for "${entry.label}" is carried ` +
272
+ 'verbatim.');
273
+ }
274
+ }
218
275
  // The credential's unlock KAK, public half only -- exactly enough to
219
276
  // seal the fresh bridge to the same recipient the credential derives
220
277
  // (sealing goes through the encrypt-only cipher, so no secret is
@@ -225,9 +282,10 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
225
282
  type: 'X25519KeyAgreementKey2020',
226
283
  publicKeyMultibase: entry.unlockKeyAgreementKeyMultibase
227
284
  }));
228
- const wrapped = await remintUnlockRecordBridge({
285
+ const wrapped = await remintUnlockRecordDelegations({
229
286
  record: standing,
230
287
  delegation,
288
+ ...(delegatedClients ? { delegatedClients } : {}),
231
289
  keyAgreementKey: unlockKak,
232
290
  signer: recordSigner
233
291
  });
@@ -242,11 +300,19 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
242
300
  });
243
301
  const delegationKeyId = delegationProofKeyId(delegation);
244
302
  const delegationExpires = delegation.expires;
303
+ const delegatedClientsKeyId = delegatedClients
304
+ ? delegationProofKeyId(delegatedClients)
305
+ : undefined;
306
+ const delegatedClientsExpires = delegatedClients
307
+ ? delegatedClients.expires
308
+ : undefined;
245
309
  await recordEntry({
246
310
  entry: {
247
311
  ...entry,
248
312
  ...(delegationKeyId ? { delegationKeyId } : {}),
249
- ...(delegationExpires ? { delegationExpires } : {})
313
+ ...(delegationExpires ? { delegationExpires } : {}),
314
+ ...(delegatedClientsKeyId ? { delegatedClientsKeyId } : {}),
315
+ ...(delegatedClientsExpires ? { delegatedClientsExpires } : {})
250
316
  }
251
317
  });
252
318
  reminted += 1;
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryDelegation.js","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAG7E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEpE;;;;;;;;;;;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J,CAAA;YACD,OAAO,IAAI,CAAC,CAAA;QACd,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AAC9B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { DIDDoc, DIDLog } from '@interop/did-method-webvh';
1
2
  import type { ClientWebvhUpdateKeys, WebvhEnrollmentKeys, WebvhIdStore } from '../webvh/didWebvh.js';
2
3
  /**
3
4
  * The verification-method id a code's key-agreement key publishes under --
@@ -55,7 +56,8 @@ export type RecoveryLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdRes
55
56
  * @param options.recovery {RecoveryPublicKeys} the code's public halves
56
57
  * @param [options.expectedDid] {string} the account DID the log must
57
58
  * resolve to, from the caller's stored account pointer
58
- * @returns {Promise<{ did: string }>}
59
+ * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog }>} the account
60
+ * DID and the document and log as this call leaves them
59
61
  */
60
62
  export declare function publishRecoveryKey({ idStore, updateKeys, recovery, expectedDid }: {
61
63
  idStore: WebvhIdStore;
@@ -64,6 +66,8 @@ export declare function publishRecoveryKey({ idStore, updateKeys, recovery, expe
64
66
  expectedDid?: string;
65
67
  }): Promise<{
66
68
  did: string;
69
+ doc: DIDDoc;
70
+ log: DIDLog;
67
71
  }>;
68
72
  /**
69
73
  * REVOCATION (run by an enrolled client, root authority): removes a recovery
@@ -74,7 +78,8 @@ export declare function publishRecoveryKey({ idStore, updateKeys, recovery, expe
74
78
  * the resolver's document no longer backs the removed entry.
75
79
  *
76
80
  * @param options {object} see {@link publishRecoveryKey}
77
- * @returns {Promise<{ did: string }>}
81
+ * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog }>} see
82
+ * {@link publishRecoveryKey}
78
83
  */
79
84
  export declare function removeRecoveryKey({ idStore, updateKeys, recovery, expectedDid }: {
80
85
  idStore: WebvhIdStore;
@@ -83,6 +88,8 @@ export declare function removeRecoveryKey({ idStore, updateKeys, recovery, expec
83
88
  expectedDid?: string;
84
89
  }): Promise<{
85
90
  did: string;
91
+ doc: DIDDoc;
92
+ log: DIDLog;
86
93
  }>;
87
94
  /**
88
95
  * RECOVERY (run by the code-derived client through the delegated `did.jsonl`
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryWebvh.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EACV,qBAAqB,EAErB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAG7B;;;;;;;;;;;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,CAAA;CAC3B;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;gBAEnD,OAAO,SACuC;CAKjD;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,YAAY,EACZ,kBAAkB,GAAG,eAAe,CACrC,CAAA;AAsDD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,OAAO,EACP,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,EAAE;IACD,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,EAAE,qBAAqB,CAAA;IACjC,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAa3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,EAAE;IACD,OAAO,EAAE,Y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GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAE5C"}
@@ -116,7 +116,8 @@ async function publishLogOnly({ store, log, ifMatch }) {
116
116
  * @param options.recovery {RecoveryPublicKeys} the code's public halves
117
117
  * @param [options.expectedDid] {string} the account DID the log must
118
118
  * resolve to, from the caller's stored account pointer
119
- * @returns {Promise<{ did: string }>}
119
+ * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog }>} the account
120
+ * DID and the document and log as this call leaves them
120
121
  */
121
122
  export async function publishRecoveryKey({ idStore, updateKeys, recovery, expectedDid }) {
122
123
  return publishUnlockKey({
@@ -141,7 +142,8 @@ export async function publishRecoveryKey({ idStore, updateKeys, recovery, expect
141
142
  * the resolver's document no longer backs the removed entry.
142
143
  *
143
144
  * @param options {object} see {@link publishRecoveryKey}
144
- * @returns {Promise<{ did: string }>}
145
+ * @returns {Promise<{ did: string, doc: DIDDoc, log: DIDLog }>} see
146
+ * {@link publishRecoveryKey}
145
147
  */
146
148
  export async function removeRecoveryKey({ idStore, updateKeys, recovery, expectedDid }) {
147
149
  return removeUnlockKey({