keri-ts 2.1.0 → 2.2.1

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 (300) hide show
  1. package/README.md +30 -2
  2. package/esm/keri/npm/src/acdc/authoring.js +195 -0
  3. package/esm/keri/npm/src/acdc/custody.js +187 -0
  4. package/esm/keri/npm/src/acdc/dhking.js +244 -32
  5. package/esm/keri/npm/src/acdc/regbasing.js +10 -0
  6. package/esm/keri/npm/src/acdc/salting.js +16 -1
  7. package/esm/keri/npm/src/acdc/scheming.js +93 -54
  8. package/esm/keri/npm/src/acdc/unblinding.js +118 -95
  9. package/esm/keri/npm/src/app/bootstrap/authenticating.js +4 -6
  10. package/esm/keri/npm/src/app/bootstrap/oobi-resolving.js +41 -0
  11. package/esm/keri/npm/src/app/bootstrap/oobiery.js +4 -6
  12. package/esm/keri/npm/src/app/credentials/credential-revoking.js +1 -0
  13. package/esm/keri/npm/src/app/credentials/credential-workflows.js +2 -0
  14. package/esm/keri/npm/src/app/credentials/registry-settling.js +44 -0
  15. package/esm/keri/npm/src/app/credentials/root-replicating.js +68 -60
  16. package/esm/keri/npm/src/app/credentials/root-replicator.js +198 -0
  17. package/esm/keri/npm/src/app/credentials/tel-completion.js +36 -0
  18. package/esm/keri/npm/src/app/delivery/forwarding.js +16 -3
  19. package/esm/keri/npm/src/app/exchanges/exchanging.js +14 -4
  20. package/esm/keri/npm/src/app/identity/challenging.js +50 -0
  21. package/esm/keri/npm/src/app/identity/delegating.js +77 -77
  22. package/esm/keri/npm/src/app/identity/delegation-approval.js +333 -0
  23. package/esm/keri/npm/src/app/identity/event-completion.js +154 -0
  24. package/esm/keri/npm/src/app/identity/habbing.js +129 -6
  25. package/esm/keri/npm/src/app/identity/keeping.js +77 -4
  26. package/esm/keri/npm/src/app/ipex/group-ipex.js +341 -0
  27. package/esm/keri/npm/src/app/ipex/group-issuance.js +905 -0
  28. package/esm/keri/npm/src/app/ipex/ipex-admitting.js +120 -0
  29. package/esm/keri/npm/src/app/ipex/ipex-conversation.js +197 -0
  30. package/esm/keri/npm/src/app/ipex/ipex-discloser.js +591 -0
  31. package/esm/keri/npm/src/app/ipex/ipex-granting.js +93 -0
  32. package/esm/keri/npm/src/app/ipex/ipex-grouping.js +50 -19
  33. package/esm/keri/npm/src/app/ipex/ipex-node-authentication.js +42 -18
  34. package/esm/keri/npm/src/app/ipex/issuance.js +896 -0
  35. package/esm/keri/npm/src/app/ipex/pending-presentations.js +46 -0
  36. package/esm/keri/npm/src/app/ipex/presentation-files.js +200 -0
  37. package/esm/keri/npm/src/app/ipex/presenting.js +408 -0
  38. package/esm/keri/npm/src/app/ipex/receive-issuance.js +86 -0
  39. package/esm/keri/npm/src/app/ipex/unblinding-workflow.js +667 -0
  40. package/esm/keri/npm/src/app/mailbox/ipex-arrival.js +103 -0
  41. package/esm/keri/npm/src/app/mailbox/kel-publisher.js +322 -0
  42. package/esm/keri/npm/src/app/mailbox/kel-publishing.js +65 -0
  43. package/esm/keri/npm/src/app/mailbox/kel-submission.js +24 -0
  44. package/esm/keri/npm/src/app/mailbox/mailbox-admin.js +208 -0
  45. package/esm/keri/npm/src/app/mailbox/mailbox-poller.js +212 -47
  46. package/esm/keri/npm/src/app/mailbox/mailboxing.js +10 -5
  47. package/esm/keri/npm/src/app/multisig/counseling.js +488 -0
  48. package/esm/keri/npm/src/app/multisig/group-members.js +18 -0
  49. package/esm/keri/npm/src/app/multisig/multisig-messaging.js +33 -6
  50. package/esm/keri/npm/src/app/multisig/multisig-workflows.js +98 -147
  51. package/esm/keri/npm/src/app/multisig/proposals.js +281 -0
  52. package/esm/keri/npm/src/app/multisig/proposing.js +122 -0
  53. package/esm/keri/npm/src/app/notifications/signaling.js +5 -5
  54. package/esm/keri/npm/src/app/protocol/parsering.js +26 -1
  55. package/esm/keri/npm/src/app/protocol/protocol-processing.js +9 -3
  56. package/esm/keri/npm/src/app/queries/query-workflows.js +98 -0
  57. package/esm/keri/npm/src/app/runtime/agent-runtime.js +106 -55
  58. package/esm/keri/npm/src/app/runtime/cue-runtime.js +3 -6
  59. package/esm/keri/npm/src/app/runtime/delivery-outbox.js +87 -0
  60. package/esm/keri/npm/src/app/runtime/doing.js +17 -0
  61. package/esm/keri/npm/src/app/runtime/ipex-auxiliaries.js +207 -0
  62. package/esm/keri/npm/src/app/runtime/operation-owners.js +151 -0
  63. package/esm/keri/npm/src/app/runtime/retry-backoff.js +93 -0
  64. package/esm/keri/npm/src/app/runtime/workflow-contract.js +80 -0
  65. package/esm/keri/npm/src/app/transport/http-client.js +25 -6
  66. package/esm/keri/npm/src/app/witness/http-endpoints.js +4 -4
  67. package/esm/keri/npm/src/cli/common/event-completion.js +49 -0
  68. package/esm/keri/npm/src/cli/common/runtime-workers.js +23 -0
  69. package/esm/keri/npm/src/cli/credentials/ipex.js +164 -191
  70. package/esm/keri/npm/src/cli/credentials/vc.js +53 -72
  71. package/esm/keri/npm/src/cli/endpoints/did.js +12 -3
  72. package/esm/keri/npm/src/cli/endpoints/oobi.js +10 -13
  73. package/esm/keri/npm/src/cli/identity/challenge.js +8 -34
  74. package/esm/keri/npm/src/cli/identity/delegate.js +81 -258
  75. package/esm/keri/npm/src/cli/identity/incept.js +15 -32
  76. package/esm/keri/npm/src/cli/identity/interact.js +5 -17
  77. package/esm/keri/npm/src/cli/identity/rotate.js +8 -36
  78. package/esm/keri/npm/src/cli/index.js +3 -1
  79. package/esm/keri/npm/src/cli/messaging/group-join.js +83 -0
  80. package/esm/keri/npm/src/cli/messaging/group-wait.js +88 -0
  81. package/esm/keri/npm/src/cli/messaging/multisig.js +190 -285
  82. package/esm/keri/npm/src/cli/messaging/root-copy-lines.js +31 -0
  83. package/esm/keri/npm/src/core/kel/eventing.js +66 -10
  84. package/esm/keri/npm/src/core/mailbox/kram-policy.js +39 -6
  85. package/esm/keri/npm/src/core/mailbox/kraming.js +2 -0
  86. package/esm/keri/npm/src/core/records.js +23 -0
  87. package/esm/keri/npm/src/core/routing.js +13 -0
  88. package/esm/keri/npm/src/db/basing.js +34 -2
  89. package/esm/keri/npm/src/db/core/indexeddb-persistence.js +221 -0
  90. package/esm/keri/npm/src/db/indexeddb.js +98 -0
  91. package/esm/keri/npm/src/db/keeping.js +11 -2
  92. package/esm/keri/npm/src/db/store-lock.js +150 -0
  93. package/esm/keri/npm/src/npm/db-indexeddb.browser.js +2 -0
  94. package/esm/keri/npm/src/npm/db-indexeddb.js +3 -0
  95. package/esm/keri/npm/src/npm/db.browser.js +2 -0
  96. package/esm/keri/npm/src/npm/index.browser.js +9 -0
  97. package/esm/keri/npm/src/npm/runtime-web.browser.js +2 -0
  98. package/esm/keri/npm/src/npm/runtime-web.js +3 -0
  99. package/esm/keri/npm/src/npm/runtime.browser.js +2 -0
  100. package/esm/keri/npm/src/runtime/index.js +51 -4
  101. package/esm/keri/npm/src/runtime/web/output-barrier.js +47 -0
  102. package/esm/keri/npm/src/runtime/web/persistent-storage.js +37 -0
  103. package/esm/keri/npm/src/runtime/web.js +10 -0
  104. package/esm/keri/npm/src/vdr/tel-publication.js +16 -0
  105. package/esm/keri/npm/src/version.js +2 -2
  106. package/package.json +15 -2
  107. package/types/acdc/authoring.d.ts +54 -0
  108. package/types/acdc/authoring.d.ts.map +1 -0
  109. package/types/acdc/custody.d.ts +84 -0
  110. package/types/acdc/custody.d.ts.map +1 -0
  111. package/types/acdc/dhking.d.ts +94 -3
  112. package/types/acdc/dhking.d.ts.map +1 -1
  113. package/types/acdc/regbasing.d.ts +4 -0
  114. package/types/acdc/regbasing.d.ts.map +1 -1
  115. package/types/acdc/salting.d.ts +6 -1
  116. package/types/acdc/salting.d.ts.map +1 -1
  117. package/types/acdc/scheming.d.ts +2 -0
  118. package/types/acdc/scheming.d.ts.map +1 -1
  119. package/types/acdc/unblinding.d.ts +58 -19
  120. package/types/acdc/unblinding.d.ts.map +1 -1
  121. package/types/app/bootstrap/authenticating.d.ts +3 -1
  122. package/types/app/bootstrap/authenticating.d.ts.map +1 -1
  123. package/types/app/bootstrap/oobi-resolving.d.ts +92 -0
  124. package/types/app/bootstrap/oobi-resolving.d.ts.map +1 -0
  125. package/types/app/bootstrap/oobiery.d.ts +3 -1
  126. package/types/app/bootstrap/oobiery.d.ts.map +1 -1
  127. package/types/app/credentials/credential-revoking.d.ts +3 -0
  128. package/types/app/credentials/credential-revoking.d.ts.map +1 -1
  129. package/types/app/credentials/credential-workflows.d.ts +5 -0
  130. package/types/app/credentials/credential-workflows.d.ts.map +1 -1
  131. package/types/app/credentials/registry-settling.d.ts +85 -0
  132. package/types/app/credentials/registry-settling.d.ts.map +1 -0
  133. package/types/app/credentials/root-replicating.d.ts +56 -44
  134. package/types/app/credentials/root-replicating.d.ts.map +1 -1
  135. package/types/app/credentials/root-replicator.d.ts +105 -0
  136. package/types/app/credentials/root-replicator.d.ts.map +1 -0
  137. package/types/app/credentials/tel-completion.d.ts +55 -0
  138. package/types/app/credentials/tel-completion.d.ts.map +1 -0
  139. package/types/app/delivery/forwarding.d.ts +6 -0
  140. package/types/app/delivery/forwarding.d.ts.map +1 -1
  141. package/types/app/exchanges/exchanging.d.ts.map +1 -1
  142. package/types/app/identity/challenging.d.ts +54 -0
  143. package/types/app/identity/challenging.d.ts.map +1 -1
  144. package/types/app/identity/delegating.d.ts +21 -4
  145. package/types/app/identity/delegating.d.ts.map +1 -1
  146. package/types/app/identity/delegation-approval.d.ts +228 -0
  147. package/types/app/identity/delegation-approval.d.ts.map +1 -0
  148. package/types/app/identity/event-completion.d.ts +151 -0
  149. package/types/app/identity/event-completion.d.ts.map +1 -0
  150. package/types/app/identity/habbing.d.ts +67 -2
  151. package/types/app/identity/habbing.d.ts.map +1 -1
  152. package/types/app/identity/keeping.d.ts +49 -3
  153. package/types/app/identity/keeping.d.ts.map +1 -1
  154. package/types/app/ipex/group-ipex.d.ts +254 -0
  155. package/types/app/ipex/group-ipex.d.ts.map +1 -0
  156. package/types/app/ipex/group-issuance.d.ts +281 -0
  157. package/types/app/ipex/group-issuance.d.ts.map +1 -0
  158. package/types/app/ipex/ipex-admitting.d.ts +47 -0
  159. package/types/app/ipex/ipex-admitting.d.ts.map +1 -0
  160. package/types/app/ipex/ipex-conversation.d.ts +195 -0
  161. package/types/app/ipex/ipex-conversation.d.ts.map +1 -0
  162. package/types/app/ipex/ipex-discloser.d.ts +156 -0
  163. package/types/app/ipex/ipex-discloser.d.ts.map +1 -0
  164. package/types/app/ipex/ipex-granting.d.ts +145 -0
  165. package/types/app/ipex/ipex-granting.d.ts.map +1 -0
  166. package/types/app/ipex/ipex-grouping.d.ts +18 -0
  167. package/types/app/ipex/ipex-grouping.d.ts.map +1 -1
  168. package/types/app/ipex/ipex-node-authentication.d.ts +9 -1
  169. package/types/app/ipex/ipex-node-authentication.d.ts.map +1 -1
  170. package/types/app/ipex/issuance.d.ts +445 -0
  171. package/types/app/ipex/issuance.d.ts.map +1 -0
  172. package/types/app/ipex/pending-presentations.d.ts +25 -0
  173. package/types/app/ipex/pending-presentations.d.ts.map +1 -0
  174. package/types/app/ipex/presentation-files.d.ts +47 -0
  175. package/types/app/ipex/presentation-files.d.ts.map +1 -0
  176. package/types/app/ipex/presenting.d.ts +300 -0
  177. package/types/app/ipex/presenting.d.ts.map +1 -0
  178. package/types/app/ipex/receive-issuance.d.ts +99 -0
  179. package/types/app/ipex/receive-issuance.d.ts.map +1 -0
  180. package/types/app/ipex/unblinding-workflow.d.ts +257 -0
  181. package/types/app/ipex/unblinding-workflow.d.ts.map +1 -0
  182. package/types/app/mailbox/ipex-arrival.d.ts +104 -0
  183. package/types/app/mailbox/ipex-arrival.d.ts.map +1 -0
  184. package/types/app/mailbox/kel-publisher.d.ts +141 -0
  185. package/types/app/mailbox/kel-publisher.d.ts.map +1 -0
  186. package/types/app/mailbox/kel-publishing.d.ts +70 -0
  187. package/types/app/mailbox/kel-publishing.d.ts.map +1 -0
  188. package/types/app/mailbox/kel-submission.d.ts +18 -0
  189. package/types/app/mailbox/kel-submission.d.ts.map +1 -0
  190. package/types/app/mailbox/mailbox-admin.d.ts +113 -0
  191. package/types/app/mailbox/mailbox-admin.d.ts.map +1 -0
  192. package/types/app/mailbox/mailbox-poller.d.ts +92 -3
  193. package/types/app/mailbox/mailbox-poller.d.ts.map +1 -1
  194. package/types/app/mailbox/mailboxing.d.ts +3 -0
  195. package/types/app/mailbox/mailboxing.d.ts.map +1 -1
  196. package/types/app/multisig/counseling.d.ts +196 -0
  197. package/types/app/multisig/counseling.d.ts.map +1 -0
  198. package/types/app/multisig/group-members.d.ts +11 -0
  199. package/types/app/multisig/group-members.d.ts.map +1 -1
  200. package/types/app/multisig/grouping.d.ts +39 -20
  201. package/types/app/multisig/grouping.d.ts.map +1 -1
  202. package/types/app/multisig/multisig-messaging.d.ts +23 -6
  203. package/types/app/multisig/multisig-messaging.d.ts.map +1 -1
  204. package/types/app/multisig/multisig-workflows.d.ts +91 -22
  205. package/types/app/multisig/multisig-workflows.d.ts.map +1 -1
  206. package/types/app/multisig/proposals.d.ts +129 -0
  207. package/types/app/multisig/proposals.d.ts.map +1 -0
  208. package/types/app/multisig/proposing.d.ts +125 -0
  209. package/types/app/multisig/proposing.d.ts.map +1 -0
  210. package/types/app/notifications/signaling.d.ts +3 -1
  211. package/types/app/notifications/signaling.d.ts.map +1 -1
  212. package/types/app/protocol/parsering.d.ts +13 -0
  213. package/types/app/protocol/parsering.d.ts.map +1 -1
  214. package/types/app/protocol/protocol-processing.d.ts +7 -1
  215. package/types/app/protocol/protocol-processing.d.ts.map +1 -1
  216. package/types/app/queries/query-workflows.d.ts +98 -0
  217. package/types/app/queries/query-workflows.d.ts.map +1 -0
  218. package/types/app/runtime/agent-runtime.d.ts +72 -25
  219. package/types/app/runtime/agent-runtime.d.ts.map +1 -1
  220. package/types/app/runtime/cue-runtime.d.ts +2 -1
  221. package/types/app/runtime/cue-runtime.d.ts.map +1 -1
  222. package/types/app/runtime/delivery-outbox.d.ts +68 -0
  223. package/types/app/runtime/delivery-outbox.d.ts.map +1 -0
  224. package/types/app/runtime/doing.d.ts +27 -0
  225. package/types/app/runtime/doing.d.ts.map +1 -0
  226. package/types/app/runtime/ipex-auxiliaries.d.ts +74 -0
  227. package/types/app/runtime/ipex-auxiliaries.d.ts.map +1 -0
  228. package/types/app/runtime/operation-owners.d.ts +137 -0
  229. package/types/app/runtime/operation-owners.d.ts.map +1 -0
  230. package/types/app/runtime/retry-backoff.d.ts +49 -0
  231. package/types/app/runtime/retry-backoff.d.ts.map +1 -0
  232. package/types/app/runtime/workflow-contract.d.ts +79 -0
  233. package/types/app/runtime/workflow-contract.d.ts.map +1 -0
  234. package/types/app/transport/http-client.d.ts.map +1 -1
  235. package/types/cli/common/event-completion.d.ts +26 -0
  236. package/types/cli/common/event-completion.d.ts.map +1 -0
  237. package/types/cli/common/runtime-workers.d.ts +23 -0
  238. package/types/cli/common/runtime-workers.d.ts.map +1 -0
  239. package/types/cli/credentials/ipex.d.ts.map +1 -1
  240. package/types/cli/credentials/vc.d.ts +1 -1
  241. package/types/cli/credentials/vc.d.ts.map +1 -1
  242. package/types/cli/endpoints/did.d.ts.map +1 -1
  243. package/types/cli/endpoints/oobi.d.ts +3 -1
  244. package/types/cli/endpoints/oobi.d.ts.map +1 -1
  245. package/types/cli/identity/challenge.d.ts +1 -1
  246. package/types/cli/identity/challenge.d.ts.map +1 -1
  247. package/types/cli/identity/delegate.d.ts +14 -1
  248. package/types/cli/identity/delegate.d.ts.map +1 -1
  249. package/types/cli/identity/incept.d.ts.map +1 -1
  250. package/types/cli/identity/interact.d.ts.map +1 -1
  251. package/types/cli/identity/rotate.d.ts.map +1 -1
  252. package/types/cli/index.d.ts +3 -1
  253. package/types/cli/index.d.ts.map +1 -1
  254. package/types/cli/messaging/group-join.d.ts +56 -0
  255. package/types/cli/messaging/group-join.d.ts.map +1 -0
  256. package/types/cli/messaging/group-wait.d.ts +34 -0
  257. package/types/cli/messaging/group-wait.d.ts.map +1 -0
  258. package/types/cli/messaging/multisig.d.ts +29 -5
  259. package/types/cli/messaging/multisig.d.ts.map +1 -1
  260. package/types/cli/messaging/root-copy-lines.d.ts +39 -0
  261. package/types/cli/messaging/root-copy-lines.d.ts.map +1 -0
  262. package/types/core/cues.d.ts +11 -0
  263. package/types/core/cues.d.ts.map +1 -1
  264. package/types/core/kel/eventing.d.ts.map +1 -1
  265. package/types/core/mailbox/kram-policy.d.ts +14 -0
  266. package/types/core/mailbox/kram-policy.d.ts.map +1 -1
  267. package/types/core/mailbox/kraming.d.ts +1 -1
  268. package/types/core/mailbox/kraming.d.ts.map +1 -1
  269. package/types/core/records.d.ts +61 -0
  270. package/types/core/records.d.ts.map +1 -1
  271. package/types/core/routing.d.ts +6 -0
  272. package/types/core/routing.d.ts.map +1 -1
  273. package/types/db/basing.d.ts +8 -2
  274. package/types/db/basing.d.ts.map +1 -1
  275. package/types/db/core/indexeddb-persistence.d.ts +59 -0
  276. package/types/db/core/indexeddb-persistence.d.ts.map +1 -0
  277. package/types/db/indexeddb.d.ts +37 -0
  278. package/types/db/indexeddb.d.ts.map +1 -0
  279. package/types/db/keeping.d.ts +5 -2
  280. package/types/db/keeping.d.ts.map +1 -1
  281. package/types/db/store-lock.d.ts +72 -0
  282. package/types/db/store-lock.d.ts.map +1 -0
  283. package/types/npm/db-indexeddb.d.ts +4 -0
  284. package/types/npm/db-indexeddb.d.ts.map +1 -0
  285. package/types/npm/runtime-web.d.ts +4 -0
  286. package/types/npm/runtime-web.d.ts.map +1 -0
  287. package/types/runtime/index.d.ts +42 -7
  288. package/types/runtime/index.d.ts.map +1 -1
  289. package/types/runtime/web/output-barrier.d.ts +30 -0
  290. package/types/runtime/web/output-barrier.d.ts.map +1 -0
  291. package/types/runtime/web/persistent-storage.d.ts +36 -0
  292. package/types/runtime/web/persistent-storage.d.ts.map +1 -0
  293. package/types/runtime/web.d.ts +11 -0
  294. package/types/runtime/web.d.ts.map +1 -0
  295. package/types/vdr/tel-publication.d.ts +6 -0
  296. package/types/vdr/tel-publication.d.ts.map +1 -1
  297. package/types/version.d.ts +2 -2
  298. package/esm/keri/npm/src/cli/common/tel-completion.js +0 -24
  299. package/types/cli/common/tel-completion.d.ts +0 -8
  300. package/types/cli/common/tel-completion.d.ts.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import * as dntShim from "../../_dnt.shims.js";
2
2
  import { concatBytes } from "cesr-ts";
3
- import { call, spawn } from "effection";
4
3
  import { importCredentialStream } from "../../app/credentials/credential-importing.js";
5
4
  import { deliverCredentialRevocation, revocationRecipients, revokeCredential, } from "../../app/credentials/credential-revoking.js";
6
5
  import { createCredential, credentialRegistryRecords, credentialRegistryStatus, credentialStreamBytes, exportCredentialStream, inceptCredentialRegistry, listCredentials, pinSchemaBytes, } from "../../app/credentials/credential-workflows.js";
6
+ import { waitForIssuedCredential, waitForTelEvent } from "../../app/credentials/tel-completion.js";
7
7
  import { isLocalGroupHab, localGroupMember } from "../../app/multisig/group-members.js";
8
- import { runAgentRuntime } from "../../app/runtime/agent-runtime.js";
8
+ import { proposeCredentialIssue, proposeCredentialRegistry, proposeCredentialRevocation, } from "../../app/multisig/proposing.js";
9
9
  import { ValidationError } from "../../core/errors.js";
10
10
  import { withAgentRuntime, withExistingHabery } from "../common/context.js";
11
11
  import { parseBooleanOption, parseNumberOption, parseStringListOption, parseStringOption } from "../common/parsing.js";
12
- import { waitForIssuedCredential, waitForTelPublication } from "../common/tel-completion.js";
12
+ import { withRuntimeWorkers } from "../common/runtime-workers.js";
13
13
  /** Implement `tufa vc schema import` by pinning JSON schemas into `schema.`. */
14
14
  export function* vcSchemaImportCommand(args) {
15
15
  const vcArgs = {
@@ -35,29 +35,22 @@ export function* vcRegistryInceptCommand(args) {
35
35
  const hab = requireHab(hby, vcArgs.alias);
36
36
  const group = isLocalGroupHab(hby, hab);
37
37
  const signer = group ? localGroupMember(hby, hab.pre) : hab;
38
- const result = yield* call(function* () {
39
- const postman = runtime.postman;
40
- const worker = yield* spawn(() => runAgentRuntime(runtime, { hab: signer, pollMailbox: group }));
41
- try {
42
- const deadline = Date.now() + timeout * 1000;
43
- const created = yield* inceptCredentialRegistry(rgy, runtime.reactor, postman, hab, {
44
- registryName: vcArgs.registryName,
45
- estOnly: vcArgs.estOnly,
46
- usage: vcArgs.usage,
47
- });
48
- created.publicationComplete = yield* waitForTelPublication(rgy.publication, created.registry, 0, deadline);
49
- if (created.group) {
50
- created.group.accepted = rgy.reger.tels.getOn(created.registry, 0)?.qb64 === created.registry;
51
- if (created.group.accepted)
52
- created.group.status = "accept";
53
- }
54
- return created;
55
- }
56
- finally {
57
- yield* worker.halt();
38
+ return yield* withRuntimeWorkers(runtime, { hab: signer, pollMailbox: group }, function* () {
39
+ const deadline = Date.now() + timeout * 1000;
40
+ const options = { registryName: vcArgs.registryName, estOnly: vcArgs.estOnly, usage: vcArgs.usage };
41
+ const created = group
42
+ ? yield* proposeCredentialRegistry(proposeDeps(rgy, runtime), hab, options, GROUP_INPUTS)
43
+ : yield* inceptCredentialRegistry(rgy, runtime.reactor, runtime.postman, hab, options);
44
+ const waited = yield* waitForTelEvent(rgy, created.registry, 0, { deadline });
45
+ created.publicationComplete = waited.outcome === "settled";
46
+ // Report the accepted state the wait ended with; sending the proposal is not acceptance.
47
+ if (created.group) {
48
+ created.group.accepted = rgy.reger.tels.getOn(created.registry, 0)?.qb64 === created.registry;
49
+ if (created.group.accepted)
50
+ created.group.status = "accept";
58
51
  }
52
+ return created;
59
53
  });
60
- return result;
61
54
  });
62
55
  }
63
56
  /** Implement `tufa vc registry list` from local `Reger.regs` state. */
@@ -112,34 +105,23 @@ export function* vcCreateCommand(args) {
112
105
  throw new ValidationError("Selected alias does not control this registry.");
113
106
  const group = isLocalGroupHab(hby, issuer);
114
107
  const signer = group ? localGroupMember(hby, issuer.pre) : issuer;
115
- const result = yield* call(function* () {
116
- const postman = runtime.postman;
117
- const worker = yield* spawn(() => runAgentRuntime(runtime, { hab: signer, pollMailbox: group }));
118
- try {
119
- const deadline = Date.now() + timeout * 1000;
120
- const created = yield* createCredential(rgy, runtime.reactor, postman, {
121
- registryName: vcArgs.registryName,
122
- schema: schema,
123
- recipient,
124
- data,
125
- edges,
126
- rules,
127
- });
128
- yield* waitForIssuedCredential(rgy.publication, created.creder.said, deadline);
129
- const saved = rgy.reger.saved.get(created.creder.said) !== null;
130
- created.publicationComplete = rgy.publication.complete(created.creder.said);
131
- if (saved)
132
- created.status = "accept";
133
- if (created.group) {
134
- created.group.saved = saved;
135
- if (rgy.reger.tels.getOn(created.creder.said, 0)?.qb64 === created.tel)
136
- created.group.telStatus = "accept";
137
- }
138
- return created;
139
- }
140
- finally {
141
- yield* worker.halt();
108
+ const result = yield* withRuntimeWorkers(runtime, { hab: signer, pollMailbox: group }, function* () {
109
+ const deadline = Date.now() + timeout * 1000;
110
+ const options = { registryName: vcArgs.registryName, schema: schema, recipient, data, edges, rules };
111
+ const created = group
112
+ ? yield* proposeCredentialIssue(proposeDeps(rgy, runtime), options, GROUP_INPUTS)
113
+ : yield* createCredential(rgy, runtime.reactor, runtime.postman, options);
114
+ yield* waitForIssuedCredential(rgy, created.creder.said, { deadline });
115
+ const saved = rgy.reger.saved.get(created.creder.said) !== null;
116
+ created.publicationComplete = rgy.publication.complete(created.creder.said);
117
+ if (saved)
118
+ created.status = "accept";
119
+ if (created.group) {
120
+ created.group.saved = saved;
121
+ if (rgy.reger.tels.getOn(created.creder.said, 0)?.qb64 === created.tel)
122
+ created.group.telStatus = "accept";
142
123
  }
124
+ return created;
143
125
  });
144
126
  if (vcArgs.out) {
145
127
  writeBytes(credentialStreamBytes(hby, reger, result.creder, result.recipient), vcArgs.out);
@@ -235,28 +217,22 @@ export function* vcRevokeCommand(args) {
235
217
  }
236
218
  const group = isLocalGroupHab(hby, registry.hab);
237
219
  const signer = group ? localGroupMember(hby, registry.hab.pre) : registry.hab;
238
- const result = yield* call(function* () {
239
- const postman = runtime.postman;
240
- const worker = yield* spawn(() => runAgentRuntime(runtime, { hab: signer, pollMailbox: group }));
241
- try {
242
- const deadline = Date.now() + timeout * 1000;
243
- const revoked = yield* revokeCredential(rgy, runtime.reactor, postman, {
244
- registryName: vcArgs.registryName,
245
- credentialSaid: vcArgs.said,
246
- });
247
- revoked.publicationComplete = yield* waitForTelPublication(rgy.publication, revoked.said, 1, deadline);
248
- revoked.accepted = reger.tels.getOn(revoked.said, 1)?.qb64 === revoked.tel;
249
- if (revoked.accepted)
250
- revoked.status = "accept";
251
- const recipients = revocationRecipients(revoked.creder, vcArgs.send ?? [], !!vcArgs.alias);
252
- if (recipients.length > 0) {
253
- revoked.deliveries = yield* deliverCredentialRevocation(rgy, postman, revoked.said, recipients);
254
- }
255
- return revoked;
256
- }
257
- finally {
258
- yield* worker.halt();
220
+ const result = yield* withRuntimeWorkers(runtime, { hab: signer, pollMailbox: group }, function* () {
221
+ const deadline = Date.now() + timeout * 1000;
222
+ const options = { registryName: vcArgs.registryName, credentialSaid: vcArgs.said };
223
+ const revoked = group
224
+ ? yield* proposeCredentialRevocation(proposeDeps(rgy, runtime), options, GROUP_INPUTS)
225
+ : yield* revokeCredential(rgy, runtime.reactor, runtime.postman, options);
226
+ const waited = yield* waitForTelEvent(rgy, revoked.said, 1, { deadline });
227
+ revoked.publicationComplete = waited.outcome === "settled";
228
+ revoked.accepted = reger.tels.getOn(revoked.said, 1)?.qb64 === revoked.tel;
229
+ if (revoked.accepted)
230
+ revoked.status = "accept";
231
+ const recipients = revocationRecipients(revoked.creder, vcArgs.send ?? [], !!vcArgs.alias);
232
+ if (recipients.length > 0) {
233
+ revoked.deliveries = yield* deliverCredentialRevocation(rgy, runtime.postman, revoked.said, recipients);
259
234
  }
235
+ return revoked;
260
236
  });
261
237
  if (vcArgs.out && result.accepted && result.publicationComplete) {
262
238
  const recipient = vcArgs.recipient ? resolveAid(hby, vcArgs.recipient) : result.creder.issuee ?? "";
@@ -265,6 +241,11 @@ export function* vcRevokeCommand(args) {
265
241
  return result;
266
242
  });
267
243
  }
244
+ /** Every group member submits receipts for the anchors it proposes, as this command always has. */
245
+ const GROUP_INPUTS = { fallbackAfterMs: 0 };
246
+ function proposeDeps(rgy, runtime) {
247
+ return { rgy, input: runtime.reactor, postman: runtime.postman, counselor: runtime.counselor };
248
+ }
268
249
  function baseArgs(args) {
269
250
  return {
270
251
  name: parseStringOption(args.name, "name"),
@@ -2,13 +2,14 @@
2
2
  * DID-related CLI operations shared by the Tufa command dispatcher.
3
3
  */
4
4
  import * as dntShim from "../../_dnt.shims.js";
5
+ import { beginOobi, waitForOobi } from "../../app/bootstrap/oobi-resolving.js";
5
6
  import { isLocalGroupHab } from "../../app/multisig/group-members.js";
6
- import { runAgentRuntimeUntil, runtimeOobiConverged } from "../../app/runtime/agent-runtime.js";
7
7
  import { WitnessReceiptor } from "../../app/witness/receipting.js";
8
8
  import { ValidationError } from "../../core/errors.js";
9
9
  import { bindDesignatedAliases, DEFAULT_DESIGNATED_ALIASES_REGISTRY_NAME, generateDidWebsArtifacts, parseDidKeriIdentifier, parseDidWebs, resolveDidKeri, resolveDidWebs, } from "../../did/index.js";
10
10
  import { withAgentRuntime } from "../common/context.js";
11
11
  import { parseBooleanOption, parseStringListOption, parseStringOption, requireNonEmpty } from "../common/parsing.js";
12
+ import { withRuntimeWorkers } from "../common/runtime-workers.js";
12
13
  /** Implement `tufa dws bind`. */
13
14
  export function* dwsBindCommand(args) {
14
15
  const commandArgs = {
@@ -125,9 +126,17 @@ export function* dkrResolveCommand(args) {
125
126
  if (!rgy)
126
127
  throw new ValidationError("Legacy credential registry is unavailable in this runtime.");
127
128
  for (const oobi of commandArgs.oobis)
128
- runtime.oobiery.resolve(oobi);
129
+ beginOobi({ oobiery: runtime.oobiery }, oobi);
129
130
  if (commandArgs.oobis.length > 0) {
130
- yield* runAgentRuntimeUntil(runtime, () => commandArgs.oobis.every((url) => runtimeOobiConverged(runtime, url)), { timeoutMs: 30_000, pollMailbox: false });
131
+ // Each wait observes its own URL's record; the jobs progress together under one set of workers.
132
+ yield* withRuntimeWorkers(runtime, { pollMailbox: false }, function* () {
133
+ for (const url of commandArgs.oobis) {
134
+ const result = yield* waitForOobi({ db: hby.db }, url, { timeoutMs: 30_000 });
135
+ if (result.outcome === "timed-out") {
136
+ throw new Error(`OOBI ${url} did not resolve within ${result.timeoutMs}ms.`);
137
+ }
138
+ }
139
+ });
131
140
  }
132
141
  const result = resolveDidKeri(hby, rgy, did);
133
142
  console.log(JSON.stringify(commandArgs.meta ? result.resolution : result.document, null, 2));
@@ -1,13 +1,13 @@
1
- import { oobiTerminalState } from "../../app/bootstrap/oobiery.js";
1
+ import { resolveOobi } from "../../app/bootstrap/oobi-resolving.js";
2
2
  import { OOBI_MAILBOX_TOPIC, OOBI_REQUEST_ROUTE, oobiRequestExn } from "../../app/bootstrap/oobiery.js";
3
3
  import { sendExchangeMessage } from "../../app/exchanges/exchange-messaging.js";
4
- import { enqueueOobi, runAgentRuntimeUntil, runtimeOobiConverged } from "../../app/runtime/agent-runtime.js";
5
4
  import { systemClock } from "../../app/runtime/runtime-clock.js";
6
5
  import { NodeHttpClient } from "../../app/transport/node-http-client.js";
7
6
  import { ValidationError } from "../../core/errors.js";
8
7
  import { EndpointRoles, isEndpointRole } from "../../core/roles.js";
9
8
  import { parseBooleanOption, parseStringOption } from "../common/parsing.js";
10
9
  import { withAgentRuntime, withExistingHab } from "../common/context.js";
10
+ import { withRuntimeWorkers } from "../common/runtime-workers.js";
11
11
  /**
12
12
  * Choose one preferred URL from a scheme-keyed location map.
13
13
  *
@@ -107,7 +107,9 @@ export function* oobiGenerateCommand(args) {
107
107
  *
108
108
  * The command queues one OOBI job, runs the shared workers, and succeeds only if
109
109
  * the URL lands in `roobi.`. Any reply/event material fetched from the OOBI is
110
- * forced through the same parser/routing path used by the long-lived host.
110
+ * forced through the same parser/routing path used by the long-lived host. It
111
+ * waits on that URL's own record, never on unrelated pending runtime work such
112
+ * as group proposals or delegation escrows.
111
113
  */
112
114
  export function* oobiResolveCommand(args) {
113
115
  const commandArgs = {
@@ -132,17 +134,12 @@ export function* oobiResolveCommand(args) {
132
134
  skipConfig: false,
133
135
  skipSignator: false,
134
136
  }, function* ({ runtime }) {
135
- enqueueOobi(runtime, {
136
- url,
137
- alias: commandArgs.oobiAlias,
138
- });
139
- yield* runAgentRuntimeUntil(runtime, () => runtimeOobiConverged(runtime, url), { timeoutMs: 30_000, pollMailbox: false });
140
- const terminal = oobiTerminalState(runtime.hby.db, url);
141
- if (terminal.status === "failed") {
142
- throw new ValidationError(`OOBI ${url} failed: ${terminal.record?.state ?? "failed"}`);
137
+ const result = yield* withRuntimeWorkers(runtime, { pollMailbox: false }, () => resolveOobi({ oobiery: runtime.oobiery, db: runtime.hby.db }, url, { alias: commandArgs.oobiAlias, timeoutMs: 30_000 }));
138
+ if (result.outcome === "timed-out") {
139
+ throw new Error(`OOBI ${url} did not resolve within ${result.timeoutMs}ms.`);
143
140
  }
144
- if (terminal.status !== "resolved") {
145
- throw new ValidationError(`OOBI ${url} did not resolve.`);
141
+ if (result.status.state === "failed") {
142
+ throw new ValidationError(`OOBI ${url} failed: ${result.status.reason}`);
146
143
  }
147
144
  console.log(url);
148
145
  });
@@ -1,14 +1,11 @@
1
- import { action, spawn } from "effection";
2
- import { sendExchangeMessage } from "../../app/exchanges/exchange-messaging.js";
3
- import { CHALLENGE_RESPONSE_ROUTE, findVerifiedChallengeResponse, formatChallengeWords, generateChallengeWords, markChallengeVerified, parseChallengeWords, } from "../../app/identity/challenging.js";
1
+ import { challengeStatus, formatChallengeWords, generateChallengeWords, markChallengeVerified, parseChallengeWords, respondToChallenge, waitForChallengeResponse, } from "../../app/identity/challenging.js";
4
2
  import { Organizer } from "../../app/identity/organizing.js";
5
- import { isLocalGroupHab } from "../../app/multisig/group-members.js";
6
- import { runAgentRuntime } from "../../app/runtime/agent-runtime.js";
7
3
  import { systemClock } from "../../app/runtime/runtime-clock.js";
8
4
  import { NodeHttpClient } from "../../app/transport/node-http-client.js";
9
5
  import { ValidationError } from "../../core/errors.js";
10
6
  import { parseBooleanOption, parseIntegerOption, parseNumberOption, parseStringOption } from "../common/parsing.js";
11
7
  import { withAgentRuntime, withExistingHab } from "../common/context.js";
8
+ import { withRuntimeWorkers } from "../common/runtime-workers.js";
12
9
  /** Implement `tufa challenge generate`. */
13
10
  export function* challengeGenerateCommand(args) {
14
11
  const commandArgs = {
@@ -58,16 +55,7 @@ export function* challengeRespondCommand(args) {
58
55
  skipConfig: false,
59
56
  skipSignator: false,
60
57
  }, function* ({ hby, hab }) {
61
- if (isLocalGroupHab(hby, hab)) {
62
- throw new ValidationError("Challenge respond does not coordinate group approval. Select the responding member alias.");
63
- }
64
- const payload = { words };
65
- const { serder } = yield* sendExchangeMessage(hby, hab, new NodeHttpClient(), systemClock, {
66
- dest: recipient,
67
- route: CHALLENGE_RESPONSE_ROUTE,
68
- topic: "challenge",
69
- payload: { i: hab.pre, ...payload },
70
- });
58
+ const serder = yield* respondToChallenge({ hby, http: new NodeHttpClient(), clock: systemClock }, hab, recipient, words);
71
59
  console.log("Sent EXN message");
72
60
  console.log(serder.pretty());
73
61
  });
@@ -125,20 +113,12 @@ export function* challengeVerifyCommand(args) {
125
113
  runtime.mailboxDirector.registerTopic("/challenge");
126
114
  const timeoutMs = commandArgs.timeout * 1000;
127
115
  const pollDelayMs = commandArgs.pollDelayMs;
128
- const deadline = Date.now() + timeoutMs;
129
- let match = findVerifiedChallengeResponse(hby.db, signer, words);
130
- if (!match && timeoutMs > 0) {
131
- const worker = yield* spawn(() => runAgentRuntime(runtime));
132
- try {
133
- while (!match && Date.now() < deadline) {
134
- yield* sleep(Math.min(pollDelayMs, Math.max(0, deadline - Date.now())));
135
- match = findVerifiedChallengeResponse(hby.db, signer, words);
136
- }
137
- }
138
- finally {
139
- yield* worker.halt();
140
- }
116
+ let status = challengeStatus(hby, signer, words);
117
+ if (status.state === "waiting" && timeoutMs > 0) {
118
+ const waited = yield* withRuntimeWorkers(runtime, {}, () => waitForChallengeResponse(hby, signer, words, { timeoutMs, pollMs: pollDelayMs }));
119
+ status = waited.status;
141
120
  }
121
+ const match = status.state === "waiting" ? null : status.response;
142
122
  if (!match) {
143
123
  throw new ValidationError(`No challenge response from ${signerInput} matched the provided words.`);
144
124
  }
@@ -166,12 +146,6 @@ function normalizeOutput(input) {
166
146
  }
167
147
  throw new ValidationError(`Unsupported challenge output ${String(input)}.`);
168
148
  }
169
- function* sleep(ms) {
170
- yield* action((resolve) => {
171
- const timeoutId = setTimeout(() => resolve(undefined), ms);
172
- return () => clearTimeout(timeoutId);
173
- });
174
- }
175
149
  /** Challenge entropy is a positive whole bit count; omission selects the command default. */
176
150
  function parseStrength(value) {
177
151
  const strength = parseIntegerOption(value, "strength") ?? 128;