@interop/wallet-core 0.66.0 → 0.67.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 (241) hide show
  1. package/README.md +12 -8
  2. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +5 -4
  3. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
  4. package/dist/clientAnnex/credentialAnchoredGenesis.js +32 -50
  5. package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
  6. package/dist/clientAnnex/establish.d.ts +46 -18
  7. package/dist/clientAnnex/establish.d.ts.map +1 -1
  8. package/dist/clientAnnex/establish.js +112 -65
  9. package/dist/clientAnnex/establish.js.map +1 -1
  10. package/dist/clientAnnex/forget.d.ts.map +1 -1
  11. package/dist/clientAnnex/forget.js +5 -6
  12. package/dist/clientAnnex/forget.js.map +1 -1
  13. package/dist/clientAnnex/forgetLast.d.ts +26 -113
  14. package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
  15. package/dist/clientAnnex/forgetLast.js +26 -150
  16. package/dist/clientAnnex/forgetLast.js.map +1 -1
  17. package/dist/clientAnnex/heal.d.ts +79 -13
  18. package/dist/clientAnnex/heal.d.ts.map +1 -1
  19. package/dist/clientAnnex/heal.js +67 -122
  20. package/dist/clientAnnex/heal.js.map +1 -1
  21. package/dist/clientAnnex/index.d.ts +6 -6
  22. package/dist/clientAnnex/index.d.ts.map +1 -1
  23. package/dist/clientAnnex/index.js +4 -4
  24. package/dist/clientAnnex/index.js.map +1 -1
  25. package/dist/clientAnnex/ladder.d.ts +51 -4
  26. package/dist/clientAnnex/ladder.d.ts.map +1 -1
  27. package/dist/clientAnnex/ladder.js +283 -47
  28. package/dist/clientAnnex/ladder.js.map +1 -1
  29. package/dist/clientAnnex/ladderAnchored.d.ts +37 -3
  30. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  31. package/dist/clientAnnex/ladderAnchored.js +69 -34
  32. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  33. package/dist/clientAnnex/log.d.ts +68 -57
  34. package/dist/clientAnnex/log.d.ts.map +1 -1
  35. package/dist/clientAnnex/log.js +96 -126
  36. package/dist/clientAnnex/log.js.map +1 -1
  37. package/dist/clientAnnex/mend.js +44 -20
  38. package/dist/clientAnnex/mend.js.map +1 -1
  39. package/dist/clientAnnex/recoveryLadderAnchored.d.ts +20 -1
  40. package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
  41. package/dist/clientAnnex/recoveryLadderAnchored.js +77 -294
  42. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  43. package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +13 -5
  44. package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -1
  45. package/dist/clientAnnex/rosterDeliveredEpochs.js +18 -9
  46. package/dist/clientAnnex/rosterDeliveredEpochs.js.map +1 -1
  47. package/dist/clientAnnex/selfEnroll.js +1 -1
  48. package/dist/clientAnnex/selfEnroll.js.map +1 -1
  49. package/dist/clientAnnex/zcap.d.ts +19 -0
  50. package/dist/clientAnnex/zcap.d.ts.map +1 -1
  51. package/dist/clientAnnex/zcap.js +80 -12
  52. package/dist/clientAnnex/zcap.js.map +1 -1
  53. package/dist/clients/index.d.ts +3 -2
  54. package/dist/clients/index.d.ts.map +1 -1
  55. package/dist/clients/index.js +3 -2
  56. package/dist/clients/index.js.map +1 -1
  57. package/dist/clients/listing.d.ts.map +1 -1
  58. package/dist/clients/listing.js +33 -15
  59. package/dist/clients/listing.js.map +1 -1
  60. package/dist/clients/policy.d.ts +18 -0
  61. package/dist/clients/policy.d.ts.map +1 -1
  62. package/dist/clients/policy.js +22 -8
  63. package/dist/clients/policy.js.map +1 -1
  64. package/dist/clients/revocation.d.ts +18 -30
  65. package/dist/clients/revocation.d.ts.map +1 -1
  66. package/dist/clients/revocation.js +12 -27
  67. package/dist/clients/revocation.js.map +1 -1
  68. package/dist/clients/rosterPolicy.d.ts +6 -1
  69. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  70. package/dist/clients/rosterPolicy.js +27 -30
  71. package/dist/clients/rosterPolicy.js.map +1 -1
  72. package/dist/descriptors/errors.d.ts +6 -5
  73. package/dist/descriptors/errors.d.ts.map +1 -1
  74. package/dist/descriptors/errors.js +6 -5
  75. package/dist/descriptors/errors.js.map +1 -1
  76. package/dist/descriptors/index.d.ts +7 -3
  77. package/dist/descriptors/index.d.ts.map +1 -1
  78. package/dist/descriptors/index.js +7 -3
  79. package/dist/descriptors/index.js.map +1 -1
  80. package/dist/descriptors/logSource.d.ts +28 -6
  81. package/dist/descriptors/logSource.d.ts.map +1 -1
  82. package/dist/descriptors/logSource.js +33 -7
  83. package/dist/descriptors/logSource.js.map +1 -1
  84. package/dist/enrollment/enrollment.d.ts.map +1 -1
  85. package/dist/enrollment/enrollment.js +3 -7
  86. package/dist/enrollment/enrollment.js.map +1 -1
  87. package/dist/genesis/accountGenesis.d.ts +8 -10
  88. package/dist/genesis/accountGenesis.d.ts.map +1 -1
  89. package/dist/genesis/accountGenesis.js +39 -41
  90. package/dist/genesis/accountGenesis.js.map +1 -1
  91. package/dist/genesis/kmsAuthentication.d.ts +50 -0
  92. package/dist/genesis/kmsAuthentication.d.ts.map +1 -0
  93. package/dist/genesis/kmsAuthentication.js +49 -0
  94. package/dist/genesis/kmsAuthentication.js.map +1 -0
  95. package/dist/keyring/kdf.d.ts +16 -20
  96. package/dist/keyring/kdf.d.ts.map +1 -1
  97. package/dist/keyring/kdf.js +2 -2
  98. package/dist/keyring/kdf.js.map +1 -1
  99. package/dist/keyring/unlockSpace.d.ts +8 -30
  100. package/dist/keyring/unlockSpace.d.ts.map +1 -1
  101. package/dist/keyring/unlockSpace.js +8 -31
  102. package/dist/keyring/unlockSpace.js.map +1 -1
  103. package/dist/keys/clientKeyRecord.d.ts +2 -1
  104. package/dist/keys/clientKeyRecord.d.ts.map +1 -1
  105. package/dist/keys/clientKeyRecord.js +28 -11
  106. package/dist/keys/clientKeyRecord.js.map +1 -1
  107. package/dist/keys/index.d.ts +6 -2
  108. package/dist/keys/index.d.ts.map +1 -1
  109. package/dist/keys/index.js +5 -1
  110. package/dist/keys/index.js.map +1 -1
  111. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  112. package/dist/keys/rosterLogStore.js +14 -5
  113. package/dist/keys/rosterLogStore.js.map +1 -1
  114. package/dist/keys/spaceEpochs.d.ts +92 -3
  115. package/dist/keys/spaceEpochs.d.ts.map +1 -1
  116. package/dist/keys/spaceEpochs.js +110 -4
  117. package/dist/keys/spaceEpochs.js.map +1 -1
  118. package/dist/keys/userKeyRoster.d.ts +30 -3
  119. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  120. package/dist/keys/userKeyRoster.js +90 -15
  121. package/dist/keys/userKeyRoster.js.map +1 -1
  122. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
  123. package/dist/keys/userKeyRosterCascade.js +5 -1
  124. package/dist/keys/userKeyRosterCascade.js.map +1 -1
  125. package/dist/recovery/continuation.d.ts +255 -0
  126. package/dist/recovery/continuation.d.ts.map +1 -0
  127. package/dist/recovery/continuation.js +471 -0
  128. package/dist/recovery/continuation.js.map +1 -0
  129. package/dist/recovery/index.d.ts +12 -8
  130. package/dist/recovery/index.d.ts.map +1 -1
  131. package/dist/recovery/index.js +11 -7
  132. package/dist/recovery/index.js.map +1 -1
  133. package/dist/recovery/recoveryDelegation.d.ts +23 -126
  134. package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
  135. package/dist/recovery/recoveryDelegation.js +1 -266
  136. package/dist/recovery/recoveryDelegation.js.map +1 -1
  137. package/dist/recovery/recoveryWebvh.d.ts +42 -83
  138. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  139. package/dist/recovery/recoveryWebvh.js +44 -380
  140. package/dist/recovery/recoveryWebvh.js.map +1 -1
  141. package/dist/request/classify.d.ts +3 -14
  142. package/dist/request/classify.d.ts.map +1 -1
  143. package/dist/request/classify.js +19 -40
  144. package/dist/request/classify.js.map +1 -1
  145. package/dist/request/index.d.ts +1 -0
  146. package/dist/request/index.d.ts.map +1 -1
  147. package/dist/request/index.js +1 -0
  148. package/dist/request/index.js.map +1 -1
  149. package/dist/request/onboarding.d.ts.map +1 -1
  150. package/dist/request/onboarding.js +19 -27
  151. package/dist/request/onboarding.js.map +1 -1
  152. package/dist/request/parse.d.ts +5 -3
  153. package/dist/request/parse.d.ts.map +1 -1
  154. package/dist/request/parse.js +7 -6
  155. package/dist/request/parse.js.map +1 -1
  156. package/dist/request/processRequest.d.ts.map +1 -1
  157. package/dist/request/processRequest.js +2 -1
  158. package/dist/request/processRequest.js.map +1 -1
  159. package/dist/request/queryPredicates.d.ts +98 -0
  160. package/dist/request/queryPredicates.d.ts.map +1 -0
  161. package/dist/request/queryPredicates.js +107 -0
  162. package/dist/request/queryPredicates.js.map +1 -0
  163. package/dist/resourceLog/document.d.ts +39 -0
  164. package/dist/resourceLog/document.d.ts.map +1 -1
  165. package/dist/resourceLog/document.js +41 -0
  166. package/dist/resourceLog/document.js.map +1 -1
  167. package/dist/resourceLog/ladderRungs.d.ts.map +1 -1
  168. package/dist/resourceLog/ladderRungs.js +3 -2
  169. package/dist/resourceLog/ladderRungs.js.map +1 -1
  170. package/dist/sync/contactsConflict.d.ts.map +1 -1
  171. package/dist/sync/contactsConflict.js +8 -2
  172. package/dist/sync/contactsConflict.js.map +1 -1
  173. package/dist/sync/engine.d.ts +38 -23
  174. package/dist/sync/engine.d.ts.map +1 -1
  175. package/dist/sync/engine.js +36 -5
  176. package/dist/sync/engine.js.map +1 -1
  177. package/dist/sync/index.d.ts +9 -12
  178. package/dist/sync/index.d.ts.map +1 -1
  179. package/dist/sync/index.js +8 -11
  180. package/dist/sync/index.js.map +1 -1
  181. package/dist/sync/push.d.ts.map +1 -1
  182. package/dist/sync/push.js +1 -2
  183. package/dist/sync/push.js.map +1 -1
  184. package/dist/sync/remint.d.ts +0 -31
  185. package/dist/sync/remint.d.ts.map +1 -1
  186. package/dist/sync/remint.js +32 -1
  187. package/dist/sync/remint.js.map +1 -1
  188. package/dist/sync/types.d.ts +4 -41
  189. package/dist/sync/types.d.ts.map +1 -1
  190. package/dist/sync/types.js +4 -47
  191. package/dist/sync/types.js.map +1 -1
  192. package/dist/unlock/index.d.ts +1 -1
  193. package/dist/unlock/index.d.ts.map +1 -1
  194. package/dist/unlock/index.js +1 -1
  195. package/dist/unlock/index.js.map +1 -1
  196. package/dist/unlock/retire.d.ts +16 -56
  197. package/dist/unlock/retire.d.ts.map +1 -1
  198. package/dist/unlock/retire.js +7 -76
  199. package/dist/unlock/retire.js.map +1 -1
  200. package/dist/unlock/standingWebvh.d.ts +20 -40
  201. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  202. package/dist/unlock/standingWebvh.js +35 -76
  203. package/dist/unlock/standingWebvh.js.map +1 -1
  204. package/dist/unlock/unlockRecord.d.ts.map +1 -1
  205. package/dist/unlock/unlockRecord.js +69 -44
  206. package/dist/unlock/unlockRecord.js.map +1 -1
  207. package/dist/webvh/accountEntry.d.ts +63 -7
  208. package/dist/webvh/accountEntry.d.ts.map +1 -1
  209. package/dist/webvh/accountEntry.js +110 -19
  210. package/dist/webvh/accountEntry.js.map +1 -1
  211. package/dist/webvh/delegatedLogStore.d.ts +18 -12
  212. package/dist/webvh/delegatedLogStore.d.ts.map +1 -1
  213. package/dist/webvh/delegatedLogStore.js +32 -11
  214. package/dist/webvh/delegatedLogStore.js.map +1 -1
  215. package/dist/webvh/didWebvh.d.ts +39 -23
  216. package/dist/webvh/didWebvh.d.ts.map +1 -1
  217. package/dist/webvh/didWebvh.js +63 -45
  218. package/dist/webvh/didWebvh.js.map +1 -1
  219. package/dist/webvh/enrollClient.d.ts.map +1 -1
  220. package/dist/webvh/enrollClient.js +19 -23
  221. package/dist/webvh/enrollClient.js.map +1 -1
  222. package/dist/webvh/index.d.ts +11 -7
  223. package/dist/webvh/index.d.ts.map +1 -1
  224. package/dist/webvh/index.js +9 -6
  225. package/dist/webvh/index.js.map +1 -1
  226. package/dist/webvh/listClients.d.ts.map +1 -1
  227. package/dist/webvh/listClients.js +102 -65
  228. package/dist/webvh/listClients.js.map +1 -1
  229. package/dist/webvh/mergeMethods.d.ts +84 -0
  230. package/dist/webvh/mergeMethods.d.ts.map +1 -0
  231. package/dist/webvh/mergeMethods.js +46 -0
  232. package/dist/webvh/mergeMethods.js.map +1 -0
  233. package/dist/webvh/revokeClient.d.ts +12 -2
  234. package/dist/webvh/revokeClient.d.ts.map +1 -1
  235. package/dist/webvh/revokeClient.js +126 -48
  236. package/dist/webvh/revokeClient.js.map +1 -1
  237. package/dist/webvh/verifyLog.d.ts +21 -0
  238. package/dist/webvh/verifyLog.d.ts.map +1 -1
  239. package/dist/webvh/verifyLog.js +36 -14
  240. package/dist/webvh/verifyLog.js.map +1 -1
  241. package/package.json +11 -11
@@ -1,117 +1,9 @@
1
- /*!
2
- * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
- */
4
- /**
5
- * The did:webvh half of recovery-code lifecycle: the split configuration a
6
- * code holds as a standing unlock credential that retires on spend. At
7
- * issuance the document gains the code's `keyAgreement` verification method
8
- * (an ordinary Multikey entry -- deliberately unmarked; a recovery key is
9
- * distinguishable structurally, since it appears under `keyAgreement` and
10
- * `assertionMethod`/`capabilityDelegation` while every enrolled client also
11
- * publishes an invocation relationship, so client listings key on
12
- * `capabilityInvocation` and never see it), the code's ladder VM, and its
13
- * rung-0 hash in `nextKeyHashes` -- decryption and delegation standing,
14
- * update authority latent: rung 0 joins `updateKeys` nowhere, and every key
15
- * of the set exists nowhere until the code is typed.
16
- *
17
- * At recovery time the pre-committed rung 0 reveals itself to sign the
18
- * self-enrolling continuation, two entries:
19
- *
20
- * 1. **Reveal + commit**: rung 0 joins `updateKeys` (its hash stands
21
- * committed since issuance, which is what makes the entry verify -- the
22
- * ordinary ladder reveal) and `nextKeyHashes` extends with the NEW
23
- * ordinary client's update- and staged-key hashes plus the replacement
24
- * code's rung-0 hash.
25
- * 2. **Add + retire**: signed by the new client's update key (revealed from
26
- * the commit), this entry publishes the new client's verification methods
27
- * and update key, removes the spent code's `keyAgreement` VM and its
28
- * ladder VM (with every other standing credential's, by the relation
29
- * asymmetry), publishes the replacement code's inventory, and drops the
30
- * spent code's revealed rung and its hash -- so no recovery authority
31
- * stands afterwards.
32
- *
33
- * Both entries are written through the caller's store seam; the recovery
34
- * continuation publishes ONLY `did.jsonl` (the delegation the record carries
35
- * covers nothing else -- narrow scope preserves loudness), and hands back the
36
- * final `webDoc` so the recovered session can republish `did.json` once it is
37
- * the authorized controller. Every step is idempotent/resumable: re-running
38
- * with the same key material converges without forking the log.
39
- */
40
- import { deriveNextKeyHash, updateDID } from '@interop/did-method-webvh';
41
- import { assertCanonicalClientKeys, assertCarryOverCommitments, effectiveParameters, ladderVerificationMethod, markedVerificationMethodPair, MULTIKEY_VM_TYPE, publishEntryPinned, readPublishedLogOrThrow, servedHead, updateKeySigner, withLogConflictRetry } from '../webvh/didWebvh.js';
1
+ import { assertCanonicalClientKeys, markedVerificationMethodPair, withLogConflictRetry } from '../webvh/didWebvh.js';
42
2
  import { publishUnlockKey, removeUnlockKey } from '../unlock/standingWebvh.js';
43
- import { credentialKeyAgreementMethods, ladderVmIds, relationIds } from '../resourceLog/document.js';
44
- // The base-side dependency the lint config pins: the ladder ATTRIBUTION
45
- // helpers only, never the annex log machinery. The add-and-retire entry
46
- // resolves each retired credential's standing rungs from the log with them.
47
- import { assertNextKeyHashesRemain, attributeRetiredCredentialRungs, retiredCredentialRungsBeforeKey } from '../clientAnnex/ladder.js';
48
- /**
49
- * What the add-and-retire entry retired, read back OFF THE LOG -- the resumed
50
- * spend's answer to the same question the live run answers from the document
51
- * it is editing. A run torn after that entry but before the caller's registry
52
- * and unlock-Space teardown resumes into the already-complete branch, and
53
- * without this it would be told nothing was retired and leave every other
54
- * credential's registry entry standing.
55
- *
56
- * The entry is located by its own signature on the log: it is the first entry
57
- * whose effective `updateKeys` authorize the successor key (the fresh
58
- * ladder's rung 0 on the transient continuation, the new client's update key
59
- * on the remembered one), which only that entry writes. What it retired is
60
- * then the credential-class `keyAgreement` ids its predecessor published and
61
- * it does not, less the spent code's own id -- the same exclusion the live
62
- * branch makes, since the caller retires that one by name.
63
- *
64
- * @param options {object}
65
- * @param options.log {DIDLog} the verified account log
66
- * @param options.did {string} the account DID the log resolves to
67
- * @param options.successorKeyMultibase {string} the update key only the
68
- * add-and-retire entry authorizes
69
- * @param options.spentVmId {string} the spent code's key-agreement
70
- * verification-method id, excluded from the result
71
- * @returns {string[]} the retired credentials' key-agreement ids, empty
72
- * when no entry authorizes the successor key or it is the genesis entry
73
- */
74
- export function retiredCredentialVmIdsFromLog({ log, did, successorKeyMultibase, spentVmId }) {
75
- const params = effectiveParameters(log);
76
- const index = params.findIndex(entry => (entry.updateKeys ?? []).includes(successorKeyMultibase));
77
- const previous = index > 0 ? log[index - 1]?.state : undefined;
78
- const entryDoc = index > 0 ? log[index]?.state : undefined;
79
- if (previous === undefined || entryDoc === undefined) {
80
- return [];
81
- }
82
- const standing = new Set(credentialKeyAgreementMethods({ doc: entryDoc, did }).map(method => method.id));
83
- return credentialKeyAgreementMethods({ doc: previous, did })
84
- .map(method => method.id)
85
- .filter((id) => typeof id === 'string')
86
- .filter(id => !standing.has(id) && id !== spentVmId);
87
- }
88
- /**
89
- * The verification-method id a code's key-agreement key publishes under --
90
- * the ordinary `<did>#<multibase>` form, indistinguishable by id from any
91
- * other keyAgreement entry. Consumers that must exclude recovery entries do
92
- * it structurally (an enrolled client is a `capabilityInvocation` entry; a
93
- * recovery key never has one) or by the registry's recorded multibase.
94
- *
95
- * @param options {object}
96
- * @param options.did {string} the account's did:webvh
97
- * @param options.keyAgreementKeyMultibase {string}
98
- * @returns {string}
99
- */
100
- export function recoveryVmId({ did, keyAgreementKeyMultibase }) {
101
- return `${did}#${keyAgreementKeyMultibase}`;
102
- }
103
- /**
104
- * Thrown by the recovery continuation when the log carries neither the code's
105
- * update key nor its committed hash -- the code was revoked (or never
106
- * issued), so no continuation can verify.
107
- */
108
- export class RecoveryKeyNotCommittedError extends Error {
109
- constructor(message = 'The account log no longer commits this recovery code; the ' +
110
- 'code has been revoked or was never issued.') {
111
- super(message);
112
- this.name = 'RecoveryKeyNotCommittedError';
113
- }
114
- }
3
+ import { recoveryContinuationOnce } from './continuation.js';
4
+ // The continuation's shared core and the names both variants read live in
5
+ // `continuation.ts`; this module stays their public home.
6
+ export { RecoveryCredentialStandingError, RecoveryKeyNotCommittedError, recoveryVmId, retiredCredentialVmIdsFromLog } from './continuation.js';
115
7
  /**
116
8
  * ISSUANCE: publishes a recovery code's split configuration into the
117
9
  * document -- the code's `keyAgreement` verification method (an ordinary,
@@ -213,7 +105,6 @@ export async function removeRecoveryKey({ idStore, signer, recovery, ladderSeed,
213
105
  },
214
106
  ...(ladderSeed ? { ladderSeed } : {}),
215
107
  ...(projectionStore ? { projectionStore } : {}),
216
- requireLadderVmClaim: true,
217
108
  ...(expectedDid !== undefined ? { expectedDid } : {}),
218
109
  ...(pinStore ? { pinStore } : {}),
219
110
  ...(logId !== undefined ? { logId } : {}),
@@ -318,273 +209,46 @@ export async function recoverWebvhClient(options) {
318
209
  signingKeyMultibase: options.newClientKeys.signingKeyMultibase,
319
210
  keyAgreementKeyMultibase: options.newClientKeys.keyAgreementKeyMultibase
320
211
  });
321
- return withLogConflictRetry(() => recoverWebvhClientOnce(options));
322
- }
323
- /**
324
- * One attempt of {@link recoverWebvhClient}, re-invoked by the conflict retry.
325
- *
326
- * @param options {object} see {@link recoverWebvhClient}
327
- * @returns {Promise<object>} see {@link recoverWebvhClient}
328
- */
329
- async function recoverWebvhClientOnce({ store, recovery, newClientKeys, newClientUpdateSeeds, replacement, onCommitted, expectedDid, pinStore, logId }) {
330
- // Each attempt's own read is what the CAS publish is built on, so the
331
- // continuity check runs here -- and again on a conflict-retry re-run -- not
332
- // only on the verify that follows both entries.
333
- const pinned = {
212
+ const { newClientKeys, newClientUpdateSeeds, onCommitted, expectedDid, pinStore, logId, ...shared } = options;
213
+ const outcome = await withLogConflictRetry(() => recoveryContinuationOnce({
214
+ ...shared,
215
+ successor: {
216
+ updateKeyMultibase: newClientKeys.updateKeyMultibase,
217
+ updateSeed: newClientUpdateSeeds.updateSeed,
218
+ stagedKeyMultibase: newClientKeys.stagedUpdateKeyMultibase
219
+ },
220
+ onCommitted,
221
+ // The new client's verification methods and update key in. A three-way
222
+ // controller split: the new client's signing method and the replacement
223
+ // code's key-agreement method are controlled by the account; the new
224
+ // client's key-agreement method alone carries the controller marker
225
+ // (see clientKeyAgreementController) -- which is exactly what tells the
226
+ // two simultaneously published keyAgreement methods apart. The marked
227
+ // pair goes through the shared builder, which refuses a new client
228
+ // whose key-agreement key is not its signing key's canonical twin; the
229
+ // core appends the replacement code's unmarked method after it.
230
+ added: ({ did }) => {
231
+ const signingVmId = `${did}#${newClientKeys.signingKeyMultibase}`;
232
+ return {
233
+ methods: markedVerificationMethodPair({
234
+ controller: did,
235
+ signingKeyMultibase: newClientKeys.signingKeyMultibase,
236
+ keyAgreementKeyMultibase: newClientKeys.keyAgreementKeyMultibase
237
+ }),
238
+ authentication: [signingVmId],
239
+ assertionMethod: [signingVmId],
240
+ keyAgreement: [`${did}#${newClientKeys.keyAgreementKeyMultibase}`],
241
+ capabilityInvocation: [signingVmId],
242
+ capabilityDelegation: [signingVmId]
243
+ };
244
+ },
245
+ ...(expectedDid !== undefined ? { expectedDid } : {}),
334
246
  ...(pinStore ? { pinStore } : {}),
335
247
  ...(logId !== undefined ? { logId } : {})
336
- };
337
- let published = await readPublishedLogOrThrow({
338
- idStore: store,
339
- ...(expectedDid !== undefined ? { expectedDid } : {}),
340
- ...pinned,
341
- missingMessage: 'did:webvh: did.jsonl is missing; nothing to recover.'
342
- });
343
- // Derived before the completion check, because a resume recomputes the
344
- // strike with the same protected sets the first run used.
345
- const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
346
- const newUpdateHash = await deriveNextKeyHash(newClientKeys.updateKeyMultibase);
347
- const newStagedHash = await deriveNextKeyHash(newClientKeys.stagedUpdateKeyMultibase);
348
- const replacementHash = await deriveNextKeyHash(replacement.updateKeyMultibase);
349
- // Already complete (a torn earlier run finished the add entry): the new
350
- // client's update key is authorized, which only the add entry writes. The
351
- // seam is deliberately NOT entered here -- nothing is about to be
352
- // published, so there is no pivot to persist ahead of.
353
- if (published.updateKeys.includes(newClientKeys.updateKeyMultibase)) {
354
- // The add entry already struck the pre-recovery credentials, so the
355
- // document names none of them any more. The report is derived from the
356
- // log instead ({@link retiredCredentialVmIdsFromLog}), so a resume tells
357
- // the caller exactly what the first run told it.
358
- const retired = retiredCredentialVmIdsFromLog({
359
- log: published.log,
360
- did: published.did,
361
- successorKeyMultibase: newClientKeys.updateKeyMultibase,
362
- spentVmId: recoveryVmId({
363
- did: published.did,
364
- keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
365
- })
366
- });
367
- // The strike is recomputed by re-running it over the log as it stood just
368
- // before the add entry, with the same protected sets, so a resume reports
369
- // exactly what the first run reported rather than a second definition of
370
- // the same question.
371
- const strike = await retiredCredentialRungsBeforeKey({
372
- log: published.log,
373
- authorizedKeyMultibase: newClientKeys.updateKeyMultibase,
374
- credentialVmIds: retired,
375
- protectedHashes: [newUpdateHash, newStagedHash, replacementHash],
376
- protectedKeys: [newClientKeys.updateKeyMultibase]
377
- });
378
- return {
379
- did: published.did,
380
- committed: false,
381
- retiredCredentialVmIds: retired,
382
- struckRungHashes: strike.struckHashes,
383
- unclaimedCredentialVmIds: strike.unclaimedCredentialVmIds
384
- };
385
- }
386
- // The reveal-and-commit entry, skipped when a torn earlier run already
387
- // published it (the revealed key authorized AND every needed hash
388
- // committed).
389
- const revealed = published.updateKeys.includes(recovery.updateKeyMultibase);
390
- const committed = [newUpdateHash, newStagedHash, replacementHash].every(hash => published.nextKeyHashes.includes(hash));
391
- if (!revealed || !committed) {
392
- if (!revealed && !published.nextKeyHashes.includes(recoveryHash)) {
393
- throw new RecoveryKeyNotCommittedError();
394
- }
395
- await assertCarryOverCommitments({ published });
396
- const signer = await updateKeySigner({ seed: recovery.updateSeed });
397
- const updated = await updateDID({
398
- log: published.log,
399
- signer,
400
- alsoKnownAsWeb: true,
401
- updateKeys: [
402
- ...new Set([...published.updateKeys, recovery.updateKeyMultibase])
403
- ],
404
- // The spent code's own hash is kept through this entry (so a resumed
405
- // commit can re-state the revealed key); the add entry drops it.
406
- nextKeyHashes: [
407
- ...new Set([
408
- ...published.nextKeyHashes,
409
- recoveryHash,
410
- newUpdateHash,
411
- newStagedHash,
412
- replacementHash
413
- ])
414
- ]
415
- });
416
- // The pin advances with the publish, so the re-read below (and any read
417
- // after a tear here) refuses a host that rolls the log back behind the
418
- // reveal entry.
419
- await publishEntryPinned({
420
- store,
421
- log: updated.log,
422
- ifMatch: published.etag,
423
- ...pinned
424
- });
425
- // The same account the reveal entry just extended, under the same pin.
426
- published = await readPublishedLogOrThrow({
427
- idStore: store,
428
- expectedDid: published.did,
429
- ...pinned,
430
- missingMessage: 'did:webvh: did.jsonl is missing; nothing to recover.'
431
- });
432
- }
433
- // The persist-before-publish seam: the successor material is persisted
434
- // HERE, on the head the add-and-retire entry is about to be built on,
435
- // before that entry -- the ceremony's pivot -- retires the spent code.
436
- // Reached on both paths into the add entry: the reveal entry just published
437
- // above, or a torn earlier run's reveal entry standing already.
438
- await onCommitted({ builtOnHead: servedHead(published.log) });
439
- // The add-and-retire entry: the new client's verification methods and
440
- // update key in; the replacement code's VM in; every pre-recovery standing
441
- // credential fully retired -- the spent code by name, and every other one
442
- // by the same structural rule the transient continuation uses (its ladder
443
- // VM by the relation asymmetry, its keyAgreement member by the account-DID
444
- // controller). Signed by the new client's update key, whose hash the commit
445
- // entry just committed.
446
- const { did, doc } = published;
447
- const vmId = (publicKeyMultibase) => `${did}#${publicKeyMultibase}`;
448
- const spentVmId = recoveryVmId({
449
- did,
450
- keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
451
- });
452
- const replacementVmId = recoveryVmId({
453
- did,
454
- keyAgreementKeyMultibase: replacement.keyAgreementKeyMultibase
455
- });
456
- // A three-way controller split. The new client's signing method and the
457
- // replacement code's key-agreement method are controlled by the account;
458
- // the new client's key-agreement method alone carries the controller marker
459
- // (see clientKeyAgreementController) -- which is exactly what tells the two
460
- // simultaneously published keyAgreement methods apart. The marked pair goes
461
- // through the shared builder, which refuses a new client whose key-agreement
462
- // key is not its signing key's canonical twin; the replacement code's
463
- // unmarked method is appended after it.
464
- // The replacement code's ladder VM, published in the same entry as its
465
- // key-agreement member: a code is a standing credential with a ladder, and
466
- // its own bridge delegation is signed by this VM, so a replacement without
467
- // it could never spend (`decisions/0019`, `decisions/0020`). Its rung-0
468
- // hash needs nothing here -- the reveal-and-commit entry committed it, and
469
- // this entry carries it through.
470
- const replacementLadderVmId = vmId(replacement.ladderVmKeyMultibase);
471
- const addedMethods = [
472
- ...markedVerificationMethodPair({
473
- controller: did,
474
- signingKeyMultibase: newClientKeys.signingKeyMultibase,
475
- keyAgreementKeyMultibase: newClientKeys.keyAgreementKeyMultibase
476
- }),
477
- {
478
- id: replacementVmId,
479
- type: MULTIKEY_VM_TYPE,
480
- controller: did,
481
- publicKeyMultibase: replacement.keyAgreementKeyMultibase
482
- },
483
- ladderVerificationMethod({
484
- controller: did,
485
- publicKeyMultibase: replacement.ladderVmKeyMultibase
486
- })
487
- ];
488
- // The full retirement, recognized structurally rather than from a list the
489
- // caller supplies: every standing ladder VM, and every keyAgreement member
490
- // the account DID controls, less the ids this entry itself adds. Other
491
- // unspent recovery codes retire with the rest -- a code's member is
492
- // unmarked and verbatim, indistinguishable from a passkey's. Each retired
493
- // credential's committed rungs and revealed rungs go in the same entry (see
494
- // the strike below and `decisions/0014`), because striking the VM rots only
495
- // a ladder-signed bridge and a bridge an enrolled client minted outlives
496
- // this entry. The bridge itself stays live but inert; nothing revokes it.
497
- // The new client's marked pair and the KMS
498
- // convenience key are untouched -- neither is account-DID-controlled
499
- // keyAgreement.
500
- const ladderVms = ladderVmIds({ doc });
501
- const addedVmIds = addedMethods
502
- .map(method => method.id)
503
- .filter((id) => typeof id === 'string');
504
- const struckCredentialVmIds = credentialKeyAgreementMethods({ doc, did })
505
- .map(method => method.id)
506
- .filter((id) => typeof id === 'string')
507
- .filter(id => !addedVmIds.includes(id));
508
- const retiredCredentialVmIds = struckCredentialVmIds.filter(id => id !== spentVmId);
509
- // Each retired credential's committed rungs and any revealed rung of its own
510
- // go in the SAME entry. Striking the ladder VM rots only a ladder-signed
511
- // bridge; a bridge an enrolled client minted outlives the strike, and that
512
- // client survives this entry, so a committed rung left standing is a reveal
513
- // the retired credential could still perform. Anchored from the log alone,
514
- // and an unanchorable credential is reported rather than struck.
515
- const strike = await attributeRetiredCredentialRungs({
516
- log: published.log,
517
- credentialVmIds: retiredCredentialVmIds,
518
- protectedHashes: [newUpdateHash, newStagedHash, replacementHash],
519
- protectedKeys: [newClientKeys.updateKeyMultibase]
520
- });
521
- const struck = (id) => id !== undefined &&
522
- (id === spentVmId ||
523
- ladderVms.includes(id) ||
524
- struckCredentialVmIds.includes(id));
525
- const existingMethods = (doc.verificationMethod ?? []);
526
- const verificationMethods = [
527
- ...existingMethods.filter(method => !struck(method.id) &&
528
- !addedMethods.some(added => added.id === method.id)),
529
- ...addedMethods
530
- ];
531
- const withReference = (relation, ...ids) => [
532
- ...new Set([
533
- ...relationIds(relation).filter(referencedId => !struck(referencedId)),
534
- ...ids
535
- ])
536
- ];
537
- const signingVmId = vmId(newClientKeys.signingKeyMultibase);
538
- const signer = await updateKeySigner({
539
- seed: newClientUpdateSeeds.updateSeed
540
- });
541
- const updated = await updateDID({
542
- log: published.log,
543
- signer,
544
- alsoKnownAsWeb: true,
545
- updateKeys: [
546
- ...new Set([
547
- ...published.updateKeys.filter(key => key !== recovery.updateKeyMultibase &&
548
- !strike.struckKeys.includes(key)),
549
- newClientKeys.updateKeyMultibase
550
- ])
551
- ],
552
- nextKeyHashes: assertNextKeyHashesRemain({
553
- nextKeyHashes: published.nextKeyHashes.filter(hash => hash !== recoveryHash && !strike.struckHashes.includes(hash)),
554
- ceremony: 'the recovery add-and-retire entry'
555
- }),
556
- verificationMethods,
557
- authentication: withReference(doc.authentication, signingVmId),
558
- // The ladder VM's relation asymmetry: `assertionMethod` and
559
- // `capabilityDelegation` only, so it never reads as an enrolled client.
560
- assertionMethod: withReference(doc.assertionMethod, signingVmId, replacementLadderVmId),
561
- keyAgreement: [
562
- ...new Set([
563
- ...relationIds(doc.keyAgreement).filter(id => !struck(id)),
564
- vmId(newClientKeys.keyAgreementKeyMultibase),
565
- replacementVmId
566
- ])
567
- ],
568
- capabilityInvocation: withReference(doc.capabilityInvocation, signingVmId),
569
- capabilityDelegation: withReference(doc.capabilityDelegation, signingVmId, replacementLadderVmId)
570
- });
571
- // Conditional on the read this entry was built on: the re-read above when
572
- // the commit entry ran here, the first read when it was skipped. The pin
573
- // advances with the publish, so a host rolling the log back straight
574
- // afterwards is refused on the next read.
575
- await publishEntryPinned({
576
- store,
577
- log: updated.log,
578
- ifMatch: published.etag,
579
- ...pinned
580
- });
581
- return {
582
- did: updated.did,
583
- webDoc: updated.webDoc,
584
- committed: true,
585
- retiredCredentialVmIds,
586
- struckRungHashes: strike.struckHashes,
587
- unclaimedCredentialVmIds: strike.unclaimedCredentialVmIds
588
- };
248
+ }));
249
+ // The document and log stay inside: the remembered session re-verifies
250
+ // the log for itself once it is the controller.
251
+ const { doc: _doc, log: _log, ...rest } = outcome;
252
+ return rest;
589
253
  }
590
254
  //# sourceMappingURL=recoveryWebvh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryWebvh.js","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAMxE,OAAO,EACL,yBAAyB,EACz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D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACjD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -13,8 +13,10 @@
13
13
  * `AppConnectQuery` extension (`appConnectRequestOf`), whose `app` block is
14
14
  * validated here against the attested requesting origin.
15
15
  */
16
- import type { CHAPIStoreEvent, IAppConnectRequest, ICapabilityQueryDetail, ICredentialQuery, IQueryByExample, IVPOffer, IVPRequest, IVPRDetails, IVPRQuery, IVerifiableCredential, IVerifiablePresentation, IZcapQuery, WalletRequestProfile } from './types.js';
16
+ import type { CHAPIStoreEvent, IAppConnectRequest, ICapabilityQueryDetail, ICredentialQuery, IQueryByExample, IVPOffer, IVPRequest, IVPRDetails, IVPRQuery, IVerifiableCredential, IVerifiablePresentation, WalletRequestProfile } from './types.js';
17
17
  import type { CHAPIGetEvent } from './types.js';
18
+ import { isZcapQuery } from './queryPredicates.js';
19
+ export { isZcapQuery };
18
20
  /**
19
21
  * The VC data model version a presentation carrying the given credentials must
20
22
  * use, so its `@context` stays coherent with what it carries: `2.0` when any
@@ -78,19 +80,6 @@ export declare function queriesOf(request: IVPRDetails): IVPRQuery[];
78
80
  * @returns {ICredentialQuery[]}
79
81
  */
80
82
  export declare function credentialQueriesOf(query: IQueryByExample): ICredentialQuery[];
81
- /**
82
- * Whether a query is a standalone capability query, under either type string:
83
- * `AuthorizationCapabilityQuery` (the canonical VCALM spelling) or the legacy
84
- * `ZcapQuery`.
85
- *
86
- * The one reader of that alias pair. Both exclusivity checks and both
87
- * capability extractors ask through here, so retiring or extending the pair
88
- * is one edit rather than four.
89
- *
90
- * @param query {IVPRQuery}
91
- * @returns {boolean}
92
- */
93
- export declare function isZcapQuery(query: IVPRQuery): query is IZcapQuery;
94
83
  /**
95
84
  * Collects the requested capabilities from a query set: filters the two zcap
96
85
  * query type strings (`AuthorizationCapabilityQuery` canonical, `ZcapQuery`
@@ -1 +1 @@
1
- {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/request/classify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EACV,eAAe,EAGf,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAEhB,eAAe,EACf,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,oBAAoB,EACrB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAoB/C;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,qBAAqB,EAAE,GACnC,MAAM,CAOR;AA0DD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,YAAY,EAAE,uBAAuB,GACpC,qBAAqB,EAAE,CAQzB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAYtE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,QAAQ,CAKxE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,SAAS,EAAE,CAAA;CACrB,GAAG,OAAO,CAQV;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,EAAE,CAS3D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,GACrB,gBAAgB,EAAE,CAMpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,UAAU,CAIjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,sBAAsB,EAAE,CAc5E;AAED;;;;;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AuBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,MAAM,EACP,EAAE;IACD,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,kBAAkB,GAAG,IAAI,CA2C5B;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAEvC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAoBtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAS9B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,oBAAoB,CAW1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAMpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,kBAAmB,CAAA;AAE/D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,EAAE,EACpB,kBAAkB,GAAE,SAAS,MAAM,EAAoC,GACtE,OAAO,CAWT"}
@@ -1,4 +1,6 @@
1
1
  import { typeArray } from '@interop/data-integrity-core/guards';
2
+ import { isAppConnectQuery, isWalletOnboardingQuery, isZcapQuery, parsedAbsoluteUrl, singletonQueryOf } from './queryPredicates.js';
3
+ export { isZcapQuery };
2
4
  const VC_1_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1';
3
5
  const VC_2_CONTEXT_URL = 'https://www.w3.org/ns/credentials/v2';
4
6
  /**
@@ -164,21 +166,6 @@ export function credentialQueriesOf(query) {
164
166
  }
165
167
  return Array.isArray(credentialQuery) ? credentialQuery : [credentialQuery];
166
168
  }
167
- /**
168
- * Whether a query is a standalone capability query, under either type string:
169
- * `AuthorizationCapabilityQuery` (the canonical VCALM spelling) or the legacy
170
- * `ZcapQuery`.
171
- *
172
- * The one reader of that alias pair. Both exclusivity checks and both
173
- * capability extractors ask through here, so retiring or extending the pair
174
- * is one edit rather than four.
175
- *
176
- * @param query {IVPRQuery}
177
- * @returns {boolean}
178
- */
179
- export function isZcapQuery(query) {
180
- return (query.type === 'AuthorizationCapabilityQuery' || query.type === 'ZcapQuery');
181
- }
182
169
  /**
183
170
  * Collects the requested capabilities from a query set: filters the two zcap
184
171
  * query type strings (`AuthorizationCapabilityQuery` canonical, `ZcapQuery`
@@ -223,16 +210,11 @@ export function zcapQueriesOf(queries) {
223
210
  * @returns {string} The parsed URL's serialization.
224
211
  */
225
212
  export function serializedAppUrl({ appUrl, origin }) {
226
- let url;
227
- try {
228
- url = new URL(appUrl);
229
- }
230
- catch (err) {
231
- throw new Error(`An AppConnectQuery "appUrl" must be an absolute URL (got "${appUrl}").`, { cause: err });
232
- }
233
- if (url.href.includes('#')) {
234
- throw new Error(`An AppConnectQuery "appUrl" must not carry a fragment (got "${appUrl}").`);
235
- }
213
+ const url = parsedAbsoluteUrl({
214
+ value: appUrl,
215
+ notAbsoluteMessage: `An AppConnectQuery "appUrl" must be an absolute URL (got "${appUrl}").`,
216
+ fragmentMessage: `An AppConnectQuery "appUrl" must not carry a fragment (got "${appUrl}").`
217
+ });
236
218
  let attestedOrigin;
237
219
  try {
238
220
  attestedOrigin = new URL(origin).origin;
@@ -271,23 +253,20 @@ export function serializedAppUrl({ appUrl, origin }) {
271
253
  * @returns {IAppConnectRequest | null}
272
254
  */
273
255
  export function appConnectRequestOf({ queries, origin }) {
274
- // `AppConnectQuery` extends the spec query union, so it is matched by its
275
- // `type` string and upcast rather than narrowed via a type predicate.
276
- const appConnectQueries = queries.filter(query => query.type === 'AppConnectQuery');
277
- if (appConnectQueries.length === 0) {
256
+ const appConnectQuery = singletonQueryOf({
257
+ queries,
258
+ isSingleton: isAppConnectQuery,
259
+ isExcluded: query => query.type === 'QueryByExample' ||
260
+ isZcapQuery(query) ||
261
+ isWalletOnboardingQuery(query),
262
+ typeName: 'AppConnectQuery',
263
+ mixedMessage: 'An AppConnectQuery cannot be combined with QueryByExample, ' +
264
+ 'standalone capability queries, or a WalletOnboardingQuery.'
265
+ });
266
+ if (appConnectQuery === null) {
278
267
  return null;
279
268
  }
280
- if (appConnectQueries.length > 1) {
281
- throw new Error('More than one AppConnectQuery found, exiting.');
282
- }
283
- const mixed = queries.some(query => query.type === 'QueryByExample' ||
284
- isZcapQuery(query) ||
285
- query.type === 'WalletOnboardingQuery');
286
- if (mixed) {
287
- throw new Error('An AppConnectQuery cannot be combined with QueryByExample, ' +
288
- 'standalone capability queries, or a WalletOnboardingQuery.');
289
- }
290
- const { app, capabilityQuery } = appConnectQueries[0];
269
+ const { app, capabilityQuery } = appConnectQuery;
291
270
  if (!app || typeof app.name !== 'string' || typeof app.appUrl !== 'string') {
292
271
  throw new Error('An AppConnectQuery is missing its app name / appUrl.');
293
272
  }