@interop/wallet-core 0.40.0 → 0.42.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 (153) hide show
  1. package/README.md +17 -3
  2. package/dist/clients/listing.d.ts +4 -3
  3. package/dist/clients/listing.d.ts.map +1 -1
  4. package/dist/clients/listing.js.map +1 -1
  5. package/dist/clients/policy.d.ts +3 -2
  6. package/dist/clients/policy.d.ts.map +1 -1
  7. package/dist/clients/policy.js +3 -3
  8. package/dist/clients/policy.js.map +1 -1
  9. package/dist/clients/revocation.d.ts +14 -4
  10. package/dist/clients/revocation.d.ts.map +1 -1
  11. package/dist/clients/revocation.js +29 -14
  12. package/dist/clients/revocation.js.map +1 -1
  13. package/dist/clients/rosterPolicy.d.ts +22 -15
  14. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  15. package/dist/clients/rosterPolicy.js +32 -15
  16. package/dist/clients/rosterPolicy.js.map +1 -1
  17. package/dist/descriptors/index.d.ts +1 -1
  18. package/dist/descriptors/index.d.ts.map +1 -1
  19. package/dist/descriptors/index.js +1 -1
  20. package/dist/descriptors/index.js.map +1 -1
  21. package/dist/descriptors/logSource.d.ts +58 -6
  22. package/dist/descriptors/logSource.d.ts.map +1 -1
  23. package/dist/descriptors/logSource.js +57 -15
  24. package/dist/descriptors/logSource.js.map +1 -1
  25. package/dist/enrollment/enrollment.d.ts +30 -2
  26. package/dist/enrollment/enrollment.d.ts.map +1 -1
  27. package/dist/enrollment/enrollment.js +58 -30
  28. package/dist/enrollment/enrollment.js.map +1 -1
  29. package/dist/enrollment/index.d.ts +4 -1
  30. package/dist/enrollment/index.d.ts.map +1 -1
  31. package/dist/enrollment/index.js +4 -1
  32. package/dist/enrollment/index.js.map +1 -1
  33. package/dist/keyring/fetch.d.ts +12 -0
  34. package/dist/keyring/fetch.d.ts.map +1 -1
  35. package/dist/keyring/fetch.js +0 -2
  36. package/dist/keyring/fetch.js.map +1 -1
  37. package/dist/keyring/index.d.ts +7 -6
  38. package/dist/keyring/index.d.ts.map +1 -1
  39. package/dist/keyring/index.js +7 -6
  40. package/dist/keyring/index.js.map +1 -1
  41. package/dist/keyring/kdf.d.ts +22 -6
  42. package/dist/keyring/kdf.d.ts.map +1 -1
  43. package/dist/keyring/kdf.js +9 -14
  44. package/dist/keyring/kdf.js.map +1 -1
  45. package/dist/keyring/record.d.ts +30 -10
  46. package/dist/keyring/record.d.ts.map +1 -1
  47. package/dist/keyring/record.js +31 -15
  48. package/dist/keyring/record.js.map +1 -1
  49. package/dist/keys/index.d.ts +5 -3
  50. package/dist/keys/index.d.ts.map +1 -1
  51. package/dist/keys/index.js +3 -2
  52. package/dist/keys/index.js.map +1 -1
  53. package/dist/keys/rosterLogStore.d.ts +22 -2
  54. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  55. package/dist/keys/rosterLogStore.js +40 -20
  56. package/dist/keys/rosterLogStore.js.map +1 -1
  57. package/dist/keys/rosterStore.d.ts +13 -1
  58. package/dist/keys/rosterStore.d.ts.map +1 -1
  59. package/dist/keys/rosterStore.js +18 -0
  60. package/dist/keys/rosterStore.js.map +1 -1
  61. package/dist/keys/userKeyCascade.d.ts +10 -3
  62. package/dist/keys/userKeyCascade.d.ts.map +1 -1
  63. package/dist/keys/userKeyCascade.js +10 -4
  64. package/dist/keys/userKeyCascade.js.map +1 -1
  65. package/dist/keys/userKeyRoster.d.ts +29 -21
  66. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  67. package/dist/keys/userKeyRoster.js +47 -23
  68. package/dist/keys/userKeyRoster.js.map +1 -1
  69. package/dist/recovery/index.d.ts +21 -11
  70. package/dist/recovery/index.d.ts.map +1 -1
  71. package/dist/recovery/index.js +19 -10
  72. package/dist/recovery/index.js.map +1 -1
  73. package/dist/recovery/recoveryCode.d.ts +5 -17
  74. package/dist/recovery/recoveryCode.d.ts.map +1 -1
  75. package/dist/recovery/recoveryCode.js +4 -14
  76. package/dist/recovery/recoveryCode.js.map +1 -1
  77. package/dist/recovery/recoveryDelegation.d.ts +151 -0
  78. package/dist/recovery/recoveryDelegation.d.ts.map +1 -0
  79. package/dist/recovery/recoveryDelegation.js +261 -0
  80. package/dist/recovery/recoveryDelegation.js.map +1 -0
  81. package/dist/recovery/recoveryWebvh.d.ts +13 -22
  82. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  83. package/dist/recovery/recoveryWebvh.js +53 -139
  84. package/dist/recovery/recoveryWebvh.js.map +1 -1
  85. package/dist/resourceLog/append.d.ts +12 -3
  86. package/dist/resourceLog/append.d.ts.map +1 -1
  87. package/dist/resourceLog/append.js +17 -10
  88. package/dist/resourceLog/append.js.map +1 -1
  89. package/dist/resourceLog/index.d.ts +1 -1
  90. package/dist/resourceLog/index.d.ts.map +1 -1
  91. package/dist/resourceLog/index.js +1 -1
  92. package/dist/resourceLog/index.js.map +1 -1
  93. package/dist/resourceLog/pin.d.ts +46 -8
  94. package/dist/resourceLog/pin.d.ts.map +1 -1
  95. package/dist/resourceLog/pin.js +32 -7
  96. package/dist/resourceLog/pin.js.map +1 -1
  97. package/dist/resourceLog/seal.d.ts +4 -1
  98. package/dist/resourceLog/seal.d.ts.map +1 -1
  99. package/dist/resourceLog/seal.js +6 -2
  100. package/dist/resourceLog/seal.js.map +1 -1
  101. package/dist/unlock/index.d.ts +40 -0
  102. package/dist/unlock/index.d.ts.map +1 -0
  103. package/dist/unlock/index.js +36 -0
  104. package/dist/unlock/index.js.map +1 -0
  105. package/dist/unlock/ladder.d.ts +100 -0
  106. package/dist/unlock/ladder.d.ts.map +1 -0
  107. package/dist/unlock/ladder.js +144 -0
  108. package/dist/unlock/ladder.js.map +1 -0
  109. package/dist/unlock/selfEnroll.d.ts +83 -0
  110. package/dist/unlock/selfEnroll.d.ts.map +1 -0
  111. package/dist/unlock/selfEnroll.js +126 -0
  112. package/dist/unlock/selfEnroll.js.map +1 -0
  113. package/dist/unlock/standingClient.d.ts +68 -0
  114. package/dist/unlock/standingClient.d.ts.map +1 -0
  115. package/dist/unlock/standingClient.js +81 -0
  116. package/dist/unlock/standingClient.js.map +1 -0
  117. package/dist/unlock/standingWebvh.d.ts +153 -0
  118. package/dist/unlock/standingWebvh.d.ts.map +1 -0
  119. package/dist/unlock/standingWebvh.js +370 -0
  120. package/dist/unlock/standingWebvh.js.map +1 -0
  121. package/dist/unlock/unlockRecord.d.ts +207 -0
  122. package/dist/unlock/unlockRecord.d.ts.map +1 -0
  123. package/dist/unlock/unlockRecord.js +435 -0
  124. package/dist/unlock/unlockRecord.js.map +1 -0
  125. package/dist/webvh/didWebvh.d.ts +166 -7
  126. package/dist/webvh/didWebvh.d.ts.map +1 -1
  127. package/dist/webvh/didWebvh.js +286 -31
  128. package/dist/webvh/didWebvh.js.map +1 -1
  129. package/dist/webvh/index.d.ts +15 -3
  130. package/dist/webvh/index.d.ts.map +1 -1
  131. package/dist/webvh/index.js +14 -3
  132. package/dist/webvh/index.js.map +1 -1
  133. package/dist/webvh/keyAgreement.d.ts +72 -0
  134. package/dist/webvh/keyAgreement.d.ts.map +1 -0
  135. package/dist/webvh/keyAgreement.js +47 -0
  136. package/dist/webvh/keyAgreement.js.map +1 -0
  137. package/dist/webvh/listClients.d.ts +69 -20
  138. package/dist/webvh/listClients.d.ts.map +1 -1
  139. package/dist/webvh/listClients.js +102 -14
  140. package/dist/webvh/listClients.js.map +1 -1
  141. package/dist/webvh/revokeClient.d.ts +21 -11
  142. package/dist/webvh/revokeClient.d.ts.map +1 -1
  143. package/dist/webvh/revokeClient.js +31 -14
  144. package/dist/webvh/revokeClient.js.map +1 -1
  145. package/dist/webvh/verifyLog.d.ts +15 -2
  146. package/dist/webvh/verifyLog.d.ts.map +1 -1
  147. package/dist/webvh/verifyLog.js +22 -3
  148. package/dist/webvh/verifyLog.js.map +1 -1
  149. package/package.json +11 -5
  150. package/dist/recovery/recoveryRecord.d.ts +0 -171
  151. package/dist/recovery/recoveryRecord.d.ts.map +0 -1
  152. package/dist/recovery/recoveryRecord.js +0 -290
  153. package/dist/recovery/recoveryRecord.js.map +0 -1
@@ -18,8 +18,25 @@
18
18
  */
19
19
  import { WasClient } from '@interop/was-client';
20
20
  import { resourceLogStore } from '@interop/was-client/log';
21
+ import { resourceLogPinId } from '../resourceLog/index.js';
21
22
  import { KEY_MAP_COLLECTION, USER_KEY_ROSTER_LOG_RESOURCE } from '../space/collections.js';
22
23
  import { logGovernedDescriptorStore } from './rosterLogStore.js';
24
+ /**
25
+ * The pin-slot key for a Space's user key roster log
26
+ * (`key-map/user-key.jsonl`) -- what a caller keying its own
27
+ * {@link ResourceLogPinStore} names the roster's pin by.
28
+ *
29
+ * @param options {object}
30
+ * @param options.spaceId {string} the data Space id
31
+ * @returns {string}
32
+ */
33
+ export function userKeyRosterPinId({ spaceId }) {
34
+ return resourceLogPinId({
35
+ spaceId,
36
+ collectionId: KEY_MAP_COLLECTION.id,
37
+ resourceId: USER_KEY_ROSTER_LOG_RESOURCE
38
+ });
39
+ }
23
40
  /**
24
41
  * Builds the log-governed descriptor store over the user key roster in a
25
42
  * data Space: reads resolve to the verified head of
@@ -51,6 +68,7 @@ export function userKeyRosterDescriptorStore({ storageServerUrl, zcapClient, spa
51
68
  }),
52
69
  resolveController,
53
70
  pinStore,
71
+ logId: userKeyRosterPinId({ spaceId }),
54
72
  signer
55
73
  });
56
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rosterStore.js","sourceRoot":"","sources":["../../src/keys/rosterStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAM1D,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,0BAA0B,EAE3B,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,4BAA4B,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EACP,iBAAiB,EACjB,QAAQ,EACR,MAAM,EAQP;IACC,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAA;IACtE,MAAM,UAAU,GAAG,GAAG;SACnB,KAAK,CAAC,OAAO,CAAC;SACd,UAAU,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAA;IACjE,OAAO,0BAA0B,CAAC;QAChC,GAAG,EAAE,gBAAgB,CAAC;YACpB,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,4BAA4B,CAAC;SAC5D,CAAC;QACF,iBAAiB;QACjB,QAAQ;QACR,KAAK,EAAE,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC;QACtC,MAAM;KACP,CAAC,CAAA;AACJ,CAAC"}
@@ -22,7 +22,12 @@
22
22
  * The cascade is rotation-only: every encrypted collection's descriptor
23
23
  * carries an epoch roster from provisioning (`ensureWalletSpaceEpochs`), so a
24
24
  * descriptor met without epochs can only mean a tampering or pre-provisioning
25
- * host and is refused fail-closed. No construction anywhere installs a
25
+ * host and is refused fail-closed. A descriptor whose `currentEpoch` names no
26
+ * epoch in its own list is refused the same way (the shape
27
+ * `readUserKeyRoster` refuses on the roster itself): collection descriptors
28
+ * arrive host-served with no server-side epoch invariants, so a mismatched
29
+ * pair is a configuration no enrolled client authenticated, never something
30
+ * to evaluate against the last epoch. No construction anywhere installs a
26
31
  * user-key secret as a collection epoch secret, which is what keeps a
27
32
  * collection-epoch escrow (an App Connect grant, a share) from ever handing a
28
33
  * grantee the user key itself.
@@ -88,9 +93,11 @@ export type CollectionUserKeyRotationOutcome = 'noop' | 'sealed' | 'escrowed' |
88
93
  * so the store's seal backstop runs here (`sealed` when it appended);
89
94
  * rotated and escrowed writes seal by construction, anchored at the
90
95
  * caller's current controller head.
91
- * - **No epochs**: refused fail-closed (see the module doc) -- provisioning
96
+ * - **No epochs**, or a `currentEpoch` naming no epoch in the descriptor's
97
+ * own list: refused fail-closed (see the module doc) -- provisioning
92
98
  * installs every encrypted collection's epoch[0], so the cascade never
93
- * mints a first epoch.
99
+ * mints a first epoch, and never guesses which epoch an inconsistent
100
+ * descriptor meant.
94
101
  *
95
102
  * The pull axis is deliberately a no-op here: a user key rotation follows a
96
103
  * document edit (client revocation, code retirement) that already killed the
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyCascade.d.ts","sourceRoot":"","sources":["../../src/keys/userKeyCascade.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAML,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAE7D;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,kBAAkB,CAKrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,UAAU,EACV,qBAAqB,EACtB,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,qBAAqB,EAAE,gBAAgB,CAAA;CACxC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAkBrB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gCAAgC,GAC1C,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,+BAA+B,CAAC,EACpD,KAAK,EACL,OAAO,EACP,WAAW,EACZ,EAAE;IACD,KAAK,EAAE,yB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AAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACxD,gBAAgB,EAAE,oBAAoB,CAAA;IACtC,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAwBhC"}
@@ -65,9 +65,11 @@ export async function unwrapUserKeyGenerations({ descriptor, clientKeyAgreementK
65
65
  * so the store's seal backstop runs here (`sealed` when it appended);
66
66
  * rotated and escrowed writes seal by construction, anchored at the
67
67
  * caller's current controller head.
68
- * - **No epochs**: refused fail-closed (see the module doc) -- provisioning
68
+ * - **No epochs**, or a `currentEpoch` naming no epoch in the descriptor's
69
+ * own list: refused fail-closed (see the module doc) -- provisioning
69
70
  * installs every encrypted collection's epoch[0], so the cascade never
70
- * mints a first epoch.
71
+ * mints a first epoch, and never guesses which epoch an inconsistent
72
+ * descriptor meant.
71
73
  *
72
74
  * The pull axis is deliberately a no-op here: a user key rotation follows a
73
75
  * document edit (client revocation, code retirement) that already killed the
@@ -95,8 +97,12 @@ export async function rotateCollectionEpochsToUserKey({ store, userKey, generati
95
97
  'epoch-less descriptor can only come from a tampering or ' +
96
98
  'pre-provisioning host; refusing to rotate it.');
97
99
  }
98
- const currentEpoch = descriptor.epochs.find(epoch => epoch.id === descriptor.currentEpoch) ??
99
- descriptor.epochs[descriptor.epochs.length - 1];
100
+ const currentEpoch = descriptor.epochs.find(epoch => epoch.id === descriptor.currentEpoch);
101
+ if (!currentEpoch) {
102
+ throw new Error("The collection descriptor's currentEpoch names no epoch in its own " +
103
+ 'epochs list. No enrolled client authenticated such a configuration; ' +
104
+ 'refusing to evaluate it against any other epoch.');
105
+ }
100
106
  const currentKids = new Set(currentEpoch.recipients.map(entry => entry.header.kid));
101
107
  const staleKids = staleGenerations
102
108
  .map(generation => epochKeyIdFor(generation.id))
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyCascade.js","sourceRoot":"","sources":["../../src/keys/userKeyCascade.ts"],"names":[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oD,EAAE,CAAA;IAClE,MAAM,OAAO,CAAC,GAAG,CACf,aAAa,CAAC,GAAG,CAAC,KAAK,EAAC,YAAY,EAAC,EAAE;QACrC,IAAI,CAAC;YACH,IAAI,WAAW,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;gBACtD,OAAM;YACR,CAAC;YACD,QAAQ,CAAC,YAAY,CAAC,GAAG,MAAM,+BAA+B,CAAC;gBAC7D,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC;gBAC7B,OAAO;gBACP,WAAW;aACZ,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC,CAAC,CACH,CAAA;IACD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;AAC7B,CAAC"}
@@ -51,6 +51,7 @@ import type { IKeyAgreementKey } from '@interop/data-integrity-core';
51
51
  import type { CollectionEncryption } from '@interop/was-client';
52
52
  import { type EncryptionDescriptorStore, type RecipientPublicKey } from '@interop/was-client/edv';
53
53
  import { type ResourceLogSigner } from '../resourceLog/index.js';
54
+ import type { KeyAgreementDocument } from '../webvh/keyAgreement.js';
54
55
  import { type ICapabilityAgent } from '../webvh/zcap.js';
55
56
  import type { UserKey } from './userKey.js';
56
57
  /**
@@ -83,21 +84,6 @@ export declare class UserKeyRosterContinuityError extends Error {
83
84
  export declare class UserKeyRosterUnwrapError extends Error {
84
85
  constructor(message: string);
85
86
  }
86
- /**
87
- * The subset of a resolved DID document the recipient resolver consumes: the
88
- * `keyAgreement` relation (VM references or embedded VMs) and the
89
- * `verificationMethod` list references resolve against.
90
- */
91
- export interface RosterRecipientDocument {
92
- keyAgreement?: Array<string | {
93
- id?: string;
94
- publicKeyMultibase?: string;
95
- }>;
96
- verificationMethod?: Array<{
97
- id?: string;
98
- publicKeyMultibase?: string;
99
- }>;
100
- }
101
87
  /**
102
88
  * The roster's log signer: signs each roster log append with this client's
103
89
  * own Ed25519 signing key, named by its public multibase -- exactly the
@@ -143,13 +129,35 @@ export declare function rosterRecipientKid({ signingKeyMultibase, keyAgreementKe
143
129
  * resolves `null` -- the was-client skip contract -- so the entry is dropped
144
130
  * from the fresh epoch and never receives a wrap.
145
131
  *
132
+ * The match is over EVERY key-agreement method the document publishes
133
+ * ({@link resolvedKeyAgreementMethods}), deliberately including the unmarked
134
+ * ones. That is where this predicate parts company with
135
+ * `markedKeyAgreementMethods`, which hard-requires a client's controller
136
+ * marker: a recovery code's or standing unlock credential's key-agreement
137
+ * method is published unmarked by design, so that client listings and
138
+ * revocations never match it, and it must keep its user key wrap through every
139
+ * rotation. Filtering by the marker here would drop every such credential from
140
+ * each rotated epoch.
141
+ *
142
+ * Two branches back an entry, and a method's `type` selects exactly one. A
143
+ * method that is not a `MultikeyCommitment` and carries the key verbatim
144
+ * (`publicKeyMultibase`) matches on the multibase (so a did:key-form kid
145
+ * matches its `<did:webvh>#<multibase>` VM). A `MultikeyCommitment` method's
146
+ * hash commitment (`publicKeyCommitment` -- a low-entropy-derived standing
147
+ * credential, whose key material the document withholds) matches when it
148
+ * commits to the roster entry's own key: the roster carries the real key, the
149
+ * document vouches for it, and a server-injected entry can neither meet a
150
+ * standing commitment nor add one. The type split means a hybrid method
151
+ * carrying both properties backs at most one recipient -- the flavor its
152
+ * `type` declares -- never two.
153
+ *
146
154
  * @param options {object}
147
- * @param options.document {RosterRecipientDocument} the locally verified
155
+ * @param options.document {KeyAgreementDocument} the locally verified
148
156
  * did:webvh document (never a server-supplied roster field)
149
157
  * @returns {function} a `resolveRecipientKey` for `removeRecipient`
150
158
  */
151
159
  export declare function userKeyRosterRecipientResolver({ document }: {
152
- document: RosterRecipientDocument;
160
+ document: KeyAgreementDocument;
153
161
  }): (kid: string) => Promise<RecipientPublicKey | null>;
154
162
  /**
155
163
  * Ensures the roster exists, create-if-absent: an absent roster is initialized
@@ -218,7 +226,7 @@ export declare function addUserKeyRosterRecipient({ store, recipient, ownerKeyAg
218
226
  * @param options {object}
219
227
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
220
228
  * store
221
- * @param options.document {RosterRecipientDocument} the locally verified
229
+ * @param options.document {KeyAgreementDocument} the locally verified
222
230
  * did:webvh document, AFTER the removal edit
223
231
  * @param options.retireRecipientId {string} the removed recipient's roster
224
232
  * kid
@@ -226,7 +234,7 @@ export declare function addUserKeyRosterRecipient({ store, recipient, ownerKeyAg
226
234
  */
227
235
  export declare function rotateUserKeyRoster({ store, document, retireRecipientId }: {
228
236
  store: EncryptionDescriptorStore;
229
- document: RosterRecipientDocument;
237
+ document: KeyAgreementDocument;
230
238
  retireRecipientId: string;
231
239
  }): Promise<CollectionEncryption>;
232
240
  /**
@@ -258,7 +266,7 @@ export declare function rotateUserKeyRoster({ store, document, retireRecipientId
258
266
  * @param options {object}
259
267
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
260
268
  * store
261
- * @param options.document {RosterRecipientDocument} the locally verified
269
+ * @param options.document {KeyAgreementDocument} the locally verified
262
270
  * did:webvh document -- the recipient source of record
263
271
  * @param [options.descriptor] {CollectionEncryption} a descriptor the caller
264
272
  * has just read (a login-time roster read), to save a re-read; omitted, the
@@ -269,7 +277,7 @@ export declare function rotateUserKeyRoster({ store, document, retireRecipientId
269
277
  */
270
278
  export declare function convergeUserKeyRosterToDocument({ store, document, descriptor }: {
271
279
  store: EncryptionDescriptorStore;
272
- document: RosterRecipientDocument;
280
+ document: KeyAgreementDocument;
273
281
  descriptor?: CollectionEncryption;
274
282
  }): Promise<{
275
283
  rotated: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyRoster.d.ts","sourceRoot":"","sources":["../../src/keys/userKeyRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,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E,oBAAoB,CAAA;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAC/C,KAAK,EAAE,yBAAyB,CAAA;IAChC,UAAU,EAAE,oBAAoB,CAAA;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACpC,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAC/C,KAAK,EAAE,yBAAyB,CAAA;IAChC,UAAU,CAAC,EAAE,oBAAoB,CAAA;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA"}
@@ -1,5 +1,7 @@
1
1
  import { addRecipient, initRecipients, ownerRecipient, removeRecipient, unwrapEpochSecret } from '@interop/was-client/edv';
2
2
  import { vmFragmentOf } from '../resourceLog/index.js';
3
+ import { commitmentMatcher, MULTIKEY_COMMITMENT_VM_TYPE } from '../webvh/didWebvh.js';
4
+ import { resolvedKeyAgreementMethods } from '../webvh/keyAgreement.js';
3
5
  import { clientSigningKeyMultibase } from '../webvh/zcap.js';
4
6
  /**
5
7
  * Thrown when a served roster fails its client-side consistency checks: a
@@ -94,39 +96,61 @@ export function rosterRecipientKid({ signingKeyMultibase, keyAgreementKeyMultiba
94
96
  * resolves `null` -- the was-client skip contract -- so the entry is dropped
95
97
  * from the fresh epoch and never receives a wrap.
96
98
  *
99
+ * The match is over EVERY key-agreement method the document publishes
100
+ * ({@link resolvedKeyAgreementMethods}), deliberately including the unmarked
101
+ * ones. That is where this predicate parts company with
102
+ * `markedKeyAgreementMethods`, which hard-requires a client's controller
103
+ * marker: a recovery code's or standing unlock credential's key-agreement
104
+ * method is published unmarked by design, so that client listings and
105
+ * revocations never match it, and it must keep its user key wrap through every
106
+ * rotation. Filtering by the marker here would drop every such credential from
107
+ * each rotated epoch.
108
+ *
109
+ * Two branches back an entry, and a method's `type` selects exactly one. A
110
+ * method that is not a `MultikeyCommitment` and carries the key verbatim
111
+ * (`publicKeyMultibase`) matches on the multibase (so a did:key-form kid
112
+ * matches its `<did:webvh>#<multibase>` VM). A `MultikeyCommitment` method's
113
+ * hash commitment (`publicKeyCommitment` -- a low-entropy-derived standing
114
+ * credential, whose key material the document withholds) matches when it
115
+ * commits to the roster entry's own key: the roster carries the real key, the
116
+ * document vouches for it, and a server-injected entry can neither meet a
117
+ * standing commitment nor add one. The type split means a hybrid method
118
+ * carrying both properties backs at most one recipient -- the flavor its
119
+ * `type` declares -- never two.
120
+ *
97
121
  * @param options {object}
98
- * @param options.document {RosterRecipientDocument} the locally verified
122
+ * @param options.document {KeyAgreementDocument} the locally verified
99
123
  * did:webvh document (never a server-supplied roster field)
100
124
  * @returns {function} a `resolveRecipientKey` for `removeRecipient`
101
125
  */
102
126
  export function userKeyRosterRecipientResolver({ document }) {
103
- // Materialize the document's keyAgreement VMs once: embedded VMs verbatim,
104
- // string references resolved against `verificationMethod`.
105
- const byId = new Map();
106
- for (const method of document.verificationMethod ?? []) {
107
- if (typeof method?.id === 'string') {
108
- byId.set(method.id, method);
109
- }
110
- }
111
- const keyAgreementMethods = [];
112
- for (const entry of document.keyAgreement ?? []) {
113
- const method = typeof entry === 'string' ? byId.get(entry) : entry;
114
- if (method && typeof method.publicKeyMultibase === 'string') {
115
- keyAgreementMethods.push(method);
116
- }
117
- }
127
+ const methods = resolvedKeyAgreementMethods({ doc: document });
128
+ const verbatimMethods = methods.filter(method => method.type !== MULTIKEY_COMMITMENT_VM_TYPE &&
129
+ typeof method.publicKeyMultibase === 'string');
130
+ const commitmentBacked = commitmentMatcher({
131
+ commitments: methods
132
+ .filter(method => method.type === MULTIKEY_COMMITMENT_VM_TYPE)
133
+ .map(method => method.publicKeyCommitment)
134
+ .filter((value) => typeof value === 'string')
135
+ });
118
136
  return async function resolveRecipientKey(kid) {
119
137
  const fragment = vmFragmentOf(kid);
120
138
  if (!fragment) {
121
139
  return null;
122
140
  }
123
- const match = keyAgreementMethods.find(method => method.publicKeyMultibase === fragment ||
141
+ const match = verbatimMethods.find(method => method.publicKeyMultibase === fragment ||
124
142
  (typeof method.id === 'string' && vmFragmentOf(method.id) === fragment));
125
- if (!match) {
126
- // No document verification method backs this roster entry: drop it.
127
- return null;
143
+ if (match) {
144
+ return { id: kid, publicKeyMultibase: match.publicKeyMultibase };
145
+ }
146
+ // The commitment branch: the roster entry's key is document-backed iff a
147
+ // published `MultikeyCommitment` method commits to it. The matcher
148
+ // pre-decoded the commitments (a malformed one matches nothing).
149
+ if (commitmentBacked(fragment)) {
150
+ return { id: kid, publicKeyMultibase: fragment };
128
151
  }
129
- return { id: kid, publicKeyMultibase: match.publicKeyMultibase };
152
+ // No document verification method backs this roster entry: drop it.
153
+ return null;
130
154
  };
131
155
  }
132
156
  /**
@@ -218,7 +242,7 @@ export async function addUserKeyRosterRecipient({ store, recipient, ownerKeyAgre
218
242
  * @param options {object}
219
243
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
220
244
  * store
221
- * @param options.document {RosterRecipientDocument} the locally verified
245
+ * @param options.document {KeyAgreementDocument} the locally verified
222
246
  * did:webvh document, AFTER the removal edit
223
247
  * @param options.retireRecipientId {string} the removed recipient's roster
224
248
  * kid
@@ -261,7 +285,7 @@ export async function rotateUserKeyRoster({ store, document, retireRecipientId }
261
285
  * @param options {object}
262
286
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
263
287
  * store
264
- * @param options.document {RosterRecipientDocument} the locally verified
288
+ * @param options.document {KeyAgreementDocument} the locally verified
265
289
  * did:webvh document -- the recipient source of record
266
290
  * @param [options.descriptor] {CollectionEncryption} a descriptor the caller
267
291
  * has just read (a login-time roster read), to save a re-read; omitted, the
@@ -1 +1 @@
1
- {"version":3,"file":"userKeyRoster.js","sourceRoot":"","sources":["../../src/keys/userKeyRoster.ts"],"names":[],"mappings":"AAmDA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,EAGlB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAA0B,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EACL,yBAAyB,EAE1B,MAAM,kBAAkB,CAAA;AAGzB;;;;;GAKG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAA;IAC3C,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACrD,aAAa,CAAQ;IACrB,YAAY,EAAE,aAAa,EAA6B;QACtD,KAAK,CACH,4EAA4E;YAC1E,mCAAmC,CACtC,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAA;QAC1C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACpC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF;AAYD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,QAAQ,EAGT;IACC,MAAM,YAAY,GAAG,yBAAyB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE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,OAAO;QACL,UAAU;QACV,OAAO,EAAE,cAAc;QACvB,OAAO;QACP,aAAa,EAAE,UAAU,CAAC,YAAa;KACxC,CAAA;AACH,CAAC"}
@@ -12,25 +12,35 @@
12
12
  * - `recoveryClientFromCode` -- the deterministic client key set:
13
13
  * unlock identity, client seed (signing + key-agreement pair), and the
14
14
  * single did:webvh update key whose hash stands pre-committed.
15
- * - `wrapRecoveryRecord` / `unwrapRecoveryRecord` -- the keyring-record
16
- * sibling carrying the account pointer plus the pre-minted
17
- * PUT-on-`did.jsonl` delegation (never a seed, never a user key wrap),
18
- * signed into the same frame under the mixed-signer policy (the code's
19
- * unlock key at issuance, an enrolled client's account key on a re-mint),
20
- * with the `{ controller, pointer }` core authenticated by a MAC under a
21
- * code-derived key (`computeRecoveryBinding` / `recoveryRecordBinding`),
22
- * so a storage host can never redirect recovery at another account.
15
+ * - The record codec lives in `@interop/wallet-core/unlock` now
16
+ * (`wrapUnlockRecord` / `unwrapUnlockRecord`, re-exported here): a
17
+ * recovery record is an unlock record with no ladder member -- the account
18
+ * pointer plus the pre-minted PUT-on-`did.jsonl` bridge delegation (never
19
+ * a seed, never a user key wrap), signed under the mixed-signer policy
20
+ * (the code's unlock key at issuance, an enrolled client's account key on
21
+ * a re-mint), with the account core authenticated by a MAC under a
22
+ * code-derived key, so a storage host can never redirect recovery at
23
+ * another account.
23
24
  * - `publishRecoveryKey` / `removeRecoveryKey` / `recoverWebvhClient` -- the
24
- * document half: issuance's split posture, revocation's removal, and the
25
+ * document half: issuance's split posture and revocation's removal (thin
26
+ * wrappers over the unlock subpath's merged posture core), and the
25
27
  * self-enrolling recovery continuation.
28
+ * - `delegateLogWrite` / `delegationProofKeyId` /
29
+ * `remintRecoveryDelegations` -- the authorization bridge: the pre-minted
30
+ * PUT-on-`did.jsonl` delegation builder and the revocation cascade's
31
+ * re-mint of the delegations a document edit rotted, behind injected
32
+ * app seams (management-zcap client factory, storage URL, registry
33
+ * read/record).
26
34
  *
27
35
  * Kept out of the root export: this subpath pulls the webkms-client / ezcap /
28
36
  * was-client dependency graph (the same isolation pattern as `./keyring`).
29
37
  */
30
38
  export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
31
39
  export type { RecoveryClient } from './recoveryCode.js';
32
- export { computeRecoveryBinding, RecoveryBindingError, recoveryRecordBinding, unwrapRecoveryRecord, wrapRecoveryRecord } from './recoveryRecord.js';
33
- export type { RecoveryRecordContents, RecoveryRecordProofState, SignedRecoveryRecord } from './recoveryRecord.js';
40
+ export { computeUnlockBinding, remintUnlockRecordBridge, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
41
+ export type { SignedUnlockRecord, UnlockRecordContents, UnlockRecordProofState } from '../unlock/unlockRecord.js';
42
+ export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
43
+ export type { RecoveryDelegationEntry } from './recoveryDelegation.js';
34
44
  export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
35
45
  export type { RecoveryLogStore, RecoveryPublicKeys } from './recoveryWebvh.js';
36
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAE5B,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,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"}
@@ -12,22 +12,31 @@
12
12
  * - `recoveryClientFromCode` -- the deterministic client key set:
13
13
  * unlock identity, client seed (signing + key-agreement pair), and the
14
14
  * single did:webvh update key whose hash stands pre-committed.
15
- * - `wrapRecoveryRecord` / `unwrapRecoveryRecord` -- the keyring-record
16
- * sibling carrying the account pointer plus the pre-minted
17
- * PUT-on-`did.jsonl` delegation (never a seed, never a user key wrap),
18
- * signed into the same frame under the mixed-signer policy (the code's
19
- * unlock key at issuance, an enrolled client's account key on a re-mint),
20
- * with the `{ controller, pointer }` core authenticated by a MAC under a
21
- * code-derived key (`computeRecoveryBinding` / `recoveryRecordBinding`),
22
- * so a storage host can never redirect recovery at another account.
15
+ * - The record codec lives in `@interop/wallet-core/unlock` now
16
+ * (`wrapUnlockRecord` / `unwrapUnlockRecord`, re-exported here): a
17
+ * recovery record is an unlock record with no ladder member -- the account
18
+ * pointer plus the pre-minted PUT-on-`did.jsonl` bridge delegation (never
19
+ * a seed, never a user key wrap), signed under the mixed-signer policy
20
+ * (the code's unlock key at issuance, an enrolled client's account key on
21
+ * a re-mint), with the account core authenticated by a MAC under a
22
+ * code-derived key, so a storage host can never redirect recovery at
23
+ * another account.
23
24
  * - `publishRecoveryKey` / `removeRecoveryKey` / `recoverWebvhClient` -- the
24
- * document half: issuance's split posture, revocation's removal, and the
25
+ * document half: issuance's split posture and revocation's removal (thin
26
+ * wrappers over the unlock subpath's merged posture core), and the
25
27
  * self-enrolling recovery continuation.
28
+ * - `delegateLogWrite` / `delegationProofKeyId` /
29
+ * `remintRecoveryDelegations` -- the authorization bridge: the pre-minted
30
+ * PUT-on-`did.jsonl` delegation builder and the revocation cascade's
31
+ * re-mint of the delegations a document edit rotted, behind injected
32
+ * app seams (management-zcap client factory, storage URL, registry
33
+ * read/record).
26
34
  *
27
35
  * Kept out of the root export: this subpath pulls the webkms-client / ezcap /
28
36
  * was-client dependency graph (the same isolation pattern as `./keyring`).
29
37
  */
30
38
  export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
31
- export { computeRecoveryBinding, RecoveryBindingError, recoveryRecordBinding, unwrapRecoveryRecord, wrapRecoveryRecord } from './recoveryRecord.js';
39
+ export { computeUnlockBinding, remintUnlockRecordBridge, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
40
+ export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
32
41
  export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
33
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAO5B,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,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,5 +1,5 @@
1
- import type { ProfileAgents } from '../identity/agents.js';
2
1
  import type { UnlockKdf } from '../keyring/kdf.js';
2
+ import type { UnlockClientIdentity } from '../unlock/standingClient.js';
3
3
  /**
4
4
  * The byte length of a recovery code: 16 random bytes is ~128 bits, enough
5
5
  * that the unlock derivation is a single expansion rather than a stretched
@@ -73,28 +73,16 @@ export declare function decodeRecoveryCode({ code }: {
73
73
  * agents, and the public multibases / ids the issuance and recovery flows
74
74
  * publish and look up.
75
75
  */
76
- export interface RecoveryClient {
76
+ export interface RecoveryClient extends UnlockClientIdentity {
77
77
  codeBytes: Uint8Array;
78
- clientSeed: Uint8Array;
79
78
  updateSeed: Uint8Array;
80
79
  /**
81
- * The symmetric key that MACs the recovery record's account binding
82
- * (`{ controller, pointer }`): computed at issuance, verified at recovery
83
- * before the pointer is trusted. Derived from the code bytes, so the
84
- * storage host never holds it.
80
+ * The symmetric key that MACs the recovery record's account binding:
81
+ * computed at issuance, verified at recovery before the pointer is trusted.
82
+ * Derived from the code bytes, so the storage host never holds it.
85
83
  */
86
84
  bindingMacKey: Uint8Array;
87
- agents: ProfileAgents;
88
- clientDid: string;
89
- signingKeyMultibase: string;
90
- keyAgreementKeyMultibase: string;
91
85
  updateKeyMultibase: string;
92
- /**
93
- * The kid of the code's user-key-roster entry -- its key-agreement key's id
94
- * exactly as `agentsFromSeed` derives it (`did:key:<ed>#<x>`), so the wrap
95
- * minted at issuance is the one the recovery flow's roster read looks for.
96
- */
97
- recipientKid: string;
98
86
  }
99
87
  /**
100
88
  * Derives the code's whole client identity from a (possibly formatted) code.
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryCode.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryCode.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGlD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,SAM1B,CAAA;AAoBD;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,SAAuC;CAI3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAErE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE1E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAazE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,UAAU,CAAA;IACrB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,UAAU,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AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,SAAS,EAAE,UAAU,CAAA;IACrB,UAAU,EAAE,UAAU,CAAA;IACtB;;;;OAIG;IACH,aAAa,EAAE,UAAU,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,IAAI,EACL,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,cAAc,CAAC,CAgC1B"}
@@ -20,7 +20,7 @@
20
20
  import { base58 } from '@scure/base';
21
21
  import { hkdf } from '@noble/hashes/hkdf.js';
22
22
  import { sha256 } from '@noble/hashes/sha2.js';
23
- import { agentsFromSeed } from '../identity/agents.js';
23
+ import { unlockClientIdentityFromSeed } from '../unlock/standingClient.js';
24
24
  import { updateKeyMultibase } from '../webvh/didWebvh.js';
25
25
  /**
26
26
  * The byte length of a recovery code: 16 random bytes is ~128 bits, enough
@@ -143,23 +143,13 @@ export async function recoveryClientFromCode({ code }) {
143
143
  const clientSeed = hkdf(sha256, codeBytes, salt, new TextEncoder().encode(RECOVERY_CLIENT_SEED_INFO), 32);
144
144
  const updateSeed = hkdf(sha256, codeBytes, salt, new TextEncoder().encode(RECOVERY_UPDATE_SEED_INFO), 32);
145
145
  const bindingMacKey = hkdf(sha256, codeBytes, new TextEncoder().encode(RECOVERY_KDF.salt), new TextEncoder().encode(RECOVERY_BINDING_MAC_INFO), 32);
146
- const agents = await agentsFromSeed({ seed: clientSeed });
147
- const { publicKeyMultibase: keyAgreementKeyMultibase } = agents.keyAgreementKey;
148
- if (!keyAgreementKeyMultibase) {
149
- throw new Error('The derived key-agreement key has no public multibase.');
150
- }
151
- const [, , signingKeyMultibase] = agents.keyAgent.id.split(':');
146
+ const identity = await unlockClientIdentityFromSeed({ clientSeed });
152
147
  return {
148
+ ...identity,
153
149
  codeBytes,
154
- clientSeed,
155
150
  updateSeed,
156
151
  bindingMacKey,
157
- agents,
158
- clientDid: agents.keyAgent.id,
159
- signingKeyMultibase: signingKeyMultibase,
160
- keyAgreementKeyMultibase,
161
- updateKeyMultibase: await updateKeyMultibase({ seed: updateSeed }),
162
- recipientKid: `${agents.keyAgent.id}#${keyAgreementKeyMultibase}`
152
+ updateKeyMultibase: await updateKeyMultibase({ seed: updateSeed })
163
153
  };
164
154
  }
165
155
  //# sourceMappingURL=recoveryCode.js.map