@bcts/frost-hubert 1.0.0-beta.1 → 1.0.0-beta.2

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 (110) hide show
  1. package/dist/bin/frost.cjs +16 -16
  2. package/dist/bin/frost.cjs.map +1 -1
  3. package/dist/bin/frost.mjs +16 -16
  4. package/dist/bin/frost.mjs.map +1 -1
  5. package/dist/cmd/index.cjs +3 -3
  6. package/dist/cmd/index.mjs +3 -3
  7. package/dist/{cmd-CCVhHzG7.cjs → cmd-Cd5Bmjy8.cjs} +26 -26
  8. package/dist/{cmd-DNsHd19v.mjs.map → cmd-Cd5Bmjy8.cjs.map} +1 -1
  9. package/dist/{cmd-DNsHd19v.mjs → cmd-ChW3eHA8.mjs} +20 -20
  10. package/dist/{cmd-CCVhHzG7.cjs.map → cmd-ChW3eHA8.mjs.map} +1 -1
  11. package/dist/{common-DNrD_-EI.mjs → common--IfAHVkl.mjs} +2 -2
  12. package/dist/{common-DNrD_-EI.mjs.map → common--IfAHVkl.mjs.map} +1 -1
  13. package/dist/{common-CnvAUC2b.cjs → common-3msAx7hO.cjs} +3 -3
  14. package/dist/{common-CnvAUC2b.cjs.map → common-3msAx7hO.cjs.map} +1 -1
  15. package/dist/{common-Cf1UvJaP.mjs → common-4spC1kNw.mjs} +2 -2
  16. package/dist/{common-Cf1UvJaP.mjs.map → common-4spC1kNw.mjs.map} +1 -1
  17. package/dist/{common-7-BOgaTt.cjs → common-CeTqMwj0.cjs} +2 -2
  18. package/dist/{common-7-BOgaTt.cjs.map → common-CeTqMwj0.cjs.map} +1 -1
  19. package/dist/dkg/index.cjs.map +1 -1
  20. package/dist/dkg/index.mjs.map +1 -1
  21. package/dist/{finalize-BpC0rz93.mjs → finalize-BAwtGCQW.mjs} +4 -4
  22. package/dist/{finalize-BpC0rz93.mjs.map → finalize-BAwtGCQW.mjs.map} +1 -1
  23. package/dist/{finalize-Cb0obTSo.cjs → finalize-BUUNWqKC.cjs} +7 -7
  24. package/dist/{finalize-Cb0obTSo.cjs.map → finalize-BUUNWqKC.cjs.map} +1 -1
  25. package/dist/{finalize-DtRxHZ7H.mjs → finalize-Bm5RZIox.mjs} +3 -3
  26. package/dist/{finalize-DtRxHZ7H.mjs.map → finalize-Bm5RZIox.mjs.map} +1 -1
  27. package/dist/{finalize-T83Ko8nG.mjs → finalize-CELJsR4C.mjs} +4 -4
  28. package/dist/{finalize-T83Ko8nG.mjs.map → finalize-CELJsR4C.mjs.map} +1 -1
  29. package/dist/{finalize-DQ0VGUHO.cjs → finalize-D091kTVy.cjs} +7 -7
  30. package/dist/{finalize-DQ0VGUHO.cjs.map → finalize-D091kTVy.cjs.map} +1 -1
  31. package/dist/{finalize-DHEnKobp.cjs → finalize-SzzTi9BL.cjs} +6 -6
  32. package/dist/{finalize-DHEnKobp.cjs.map → finalize-SzzTi9BL.cjs.map} +1 -1
  33. package/dist/frost/index.cjs +2 -2
  34. package/dist/frost/index.cjs.map +1 -1
  35. package/dist/frost/index.d.cts.map +1 -1
  36. package/dist/frost/index.d.mts.map +1 -1
  37. package/dist/frost/index.mjs +1 -1
  38. package/dist/frost/index.mjs.map +1 -1
  39. package/dist/index-BErX9AZF.d.cts.map +1 -1
  40. package/dist/index-BaUVw4b1.d.mts.map +1 -1
  41. package/dist/index-CD50Qtgw.d.cts.map +1 -1
  42. package/dist/index-CD50Qtgw.d.mts.map +1 -1
  43. package/dist/index-Drklne-Y.d.mts.map +1 -1
  44. package/dist/index-gkmZzEuD.d.cts.map +1 -1
  45. package/dist/index.cjs +3 -3
  46. package/dist/index.d.cts.map +1 -1
  47. package/dist/index.d.mts.map +1 -1
  48. package/dist/index.mjs +3 -3
  49. package/dist/{invite-BLwtexAu.cjs → invite-5sYctfsS.cjs} +6 -6
  50. package/dist/{invite-BLwtexAu.cjs.map → invite-5sYctfsS.cjs.map} +1 -1
  51. package/dist/{invite-D8mQSnFz.mjs → invite-DNlTkwzM.mjs} +4 -4
  52. package/dist/{invite-D8mQSnFz.mjs.map → invite-DNlTkwzM.mjs.map} +1 -1
  53. package/dist/{invite-1tzg0B0P.cjs → invite-T3L4N2m0.cjs} +7 -7
  54. package/dist/{invite-1tzg0B0P.cjs.map → invite-T3L4N2m0.cjs.map} +1 -1
  55. package/dist/{invite-Be2v2SVc.mjs → invite-vRv9LMEE.mjs} +3 -3
  56. package/dist/{invite-Be2v2SVc.mjs.map → invite-vRv9LMEE.mjs.map} +1 -1
  57. package/dist/parallel-PZiwHZT8.mjs.map +1 -1
  58. package/dist/parallel-szwYx-bi.cjs.map +1 -1
  59. package/dist/proposed-participant-BvHNnpcZ.cjs.map +1 -1
  60. package/dist/proposed-participant-Detb823_.mjs.map +1 -1
  61. package/dist/{receive-g8EhZF2Y.mjs → receive-Bzn87ahI.mjs} +4 -4
  62. package/dist/{receive-g8EhZF2Y.mjs.map → receive-Bzn87ahI.mjs.map} +1 -1
  63. package/dist/{receive-dkSCSGpl.mjs → receive-C2Dwb_FQ.mjs} +4 -4
  64. package/dist/{receive-dkSCSGpl.mjs.map → receive-C2Dwb_FQ.mjs.map} +1 -1
  65. package/dist/{receive-D_r4Mryr.cjs → receive-Coqg6eFx.cjs} +7 -7
  66. package/dist/{receive-D_r4Mryr.cjs.map → receive-Coqg6eFx.cjs.map} +1 -1
  67. package/dist/{receive-BR-knnGv.cjs → receive-DZARudBa.cjs} +7 -7
  68. package/dist/{receive-BR-knnGv.cjs.map → receive-DZARudBa.cjs.map} +1 -1
  69. package/dist/registry/index.cjs +3 -3
  70. package/dist/registry/index.cjs.map +1 -1
  71. package/dist/registry/index.mjs.map +1 -1
  72. package/dist/{registry-CkIbA7nt.cjs → registry-D-rFKk9R.cjs} +5 -5
  73. package/dist/{registry-CkIbA7nt.cjs.map → registry-D-rFKk9R.cjs.map} +1 -1
  74. package/dist/{registry-DGjs4qDK.mjs → registry-ycylEdoc.mjs} +2 -2
  75. package/dist/{registry-DGjs4qDK.mjs.map → registry-ycylEdoc.mjs.map} +1 -1
  76. package/dist/{round1-D8t7EzIo.mjs → round1-BRgDPU4Y.mjs} +4 -4
  77. package/dist/{round1-D8t7EzIo.mjs.map → round1-BRgDPU4Y.mjs.map} +1 -1
  78. package/dist/{round1-CXkXoVQU.cjs → round1-BwNBKLYm.cjs} +8 -8
  79. package/dist/{round1-CXkXoVQU.cjs.map → round1-BwNBKLYm.cjs.map} +1 -1
  80. package/dist/{round1-9FAqFvL5.cjs → round1-C1IlXH-9.cjs} +6 -6
  81. package/dist/{round1-9FAqFvL5.cjs.map → round1-C1IlXH-9.cjs.map} +1 -1
  82. package/dist/{round1-DriPu15x.cjs → round1-CEbz7cnL.cjs} +8 -8
  83. package/dist/{round1-DriPu15x.cjs.map → round1-CEbz7cnL.cjs.map} +1 -1
  84. package/dist/{round1-B8haiMM8.mjs → round1-DL4N2QJ5.mjs} +5 -5
  85. package/dist/{round1-B8haiMM8.mjs.map → round1-DL4N2QJ5.mjs.map} +1 -1
  86. package/dist/{round1-BOIE1E4O.mjs → round1-DSaOFCar.mjs} +3 -3
  87. package/dist/{round1-BOIE1E4O.mjs.map → round1-DSaOFCar.mjs.map} +1 -1
  88. package/dist/{round1-Y2kcVwnR.mjs → round1-_fHip4H1.mjs} +5 -5
  89. package/dist/{round1-Y2kcVwnR.mjs.map → round1-_fHip4H1.mjs.map} +1 -1
  90. package/dist/{round1-Bq0vweyQ.cjs → round1-ek-G6qVi.cjs} +7 -7
  91. package/dist/{round1-Bq0vweyQ.cjs.map → round1-ek-G6qVi.cjs.map} +1 -1
  92. package/dist/{round2-Dk_w97nl.cjs → round2-BD_0N7Ab.cjs} +6 -6
  93. package/dist/{round2-Dk_w97nl.cjs.map → round2-BD_0N7Ab.cjs.map} +1 -1
  94. package/dist/{round2-Z2JhMwxc.mjs → round2-BLOgZeAo.mjs} +4 -4
  95. package/dist/{round2-Z2JhMwxc.mjs.map → round2-BLOgZeAo.mjs.map} +1 -1
  96. package/dist/{round2-BHQKVJFo.cjs → round2-C684Nir0.cjs} +7 -7
  97. package/dist/{round2-BHQKVJFo.cjs.map → round2-C684Nir0.cjs.map} +1 -1
  98. package/dist/{round2-mF6UlkT-.mjs → round2-CU-yTXHT.mjs} +4 -4
  99. package/dist/{round2-mF6UlkT-.mjs.map → round2-CU-yTXHT.mjs.map} +1 -1
  100. package/dist/{round2-BfetYacV.mjs → round2-Cq2SD6F8.mjs} +3 -3
  101. package/dist/{round2-BfetYacV.mjs.map → round2-Cq2SD6F8.mjs.map} +1 -1
  102. package/dist/{round2-AMDYMUIg.cjs → round2-D8l1PUm5.cjs} +7 -7
  103. package/dist/{round2-AMDYMUIg.cjs.map → round2-D8l1PUm5.cjs.map} +1 -1
  104. package/dist/{round2-CvrmylN1.cjs → round2-DhdFarwY.cjs} +7 -7
  105. package/dist/{round2-CvrmylN1.cjs.map → round2-DhdFarwY.cjs.map} +1 -1
  106. package/dist/{round2-Cf5CJc_8.mjs → round2-DmQvJDVj.mjs} +4 -4
  107. package/dist/{round2-Cf5CJc_8.mjs.map → round2-DmQvJDVj.mjs.map} +1 -1
  108. package/package.json +16 -16
  109. /package/dist/{chunk-DakpK96I.cjs → rolldown-runtime-DakpK96I.cjs} +0 -0
  110. /package/dist/{chunk-z9aeyW2b.mjs → rolldown-runtime-z9aeyW2b.mjs} +0 -0
@@ -1,22 +1,22 @@
1
- const require_chunk = require("./chunk-DakpK96I.cjs");
2
- const require_common = require("./common-CnvAUC2b.cjs");
3
- require("./registry-CkIbA7nt.cjs");
4
- const require_invite = require("./invite-BLwtexAu.cjs");
5
- const require_round1 = require("./round1-9FAqFvL5.cjs");
6
- const require_round2 = require("./round2-Dk_w97nl.cjs");
7
- const require_finalize = require("./finalize-DHEnKobp.cjs");
8
- const require_receive = require("./receive-BR-knnGv.cjs");
9
- const require_round1$1 = require("./round1-CXkXoVQU.cjs");
10
- const require_round2$1 = require("./round2-CvrmylN1.cjs");
11
- const require_finalize$1 = require("./finalize-DQ0VGUHO.cjs");
12
- const require_common$1 = require("./common-7-BOgaTt.cjs");
13
- const require_invite$1 = require("./invite-1tzg0B0P.cjs");
14
- const require_round1$2 = require("./round1-Bq0vweyQ.cjs");
15
- const require_round2$2 = require("./round2-BHQKVJFo.cjs");
16
- const require_receive$1 = require("./receive-D_r4Mryr.cjs");
17
- const require_round1$3 = require("./round1-DriPu15x.cjs");
18
- const require_round2$3 = require("./round2-AMDYMUIg.cjs");
19
- const require_finalize$2 = require("./finalize-Cb0obTSo.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
+ const require_common = require("./common-3msAx7hO.cjs");
3
+ require("./registry-D-rFKk9R.cjs");
4
+ const require_invite = require("./invite-5sYctfsS.cjs");
5
+ const require_round1 = require("./round1-C1IlXH-9.cjs");
6
+ const require_round2 = require("./round2-BD_0N7Ab.cjs");
7
+ const require_finalize = require("./finalize-SzzTi9BL.cjs");
8
+ const require_receive = require("./receive-DZARudBa.cjs");
9
+ const require_round1$1 = require("./round1-BwNBKLYm.cjs");
10
+ const require_round2$1 = require("./round2-DhdFarwY.cjs");
11
+ const require_finalize$1 = require("./finalize-D091kTVy.cjs");
12
+ const require_common$1 = require("./common-CeTqMwj0.cjs");
13
+ const require_invite$1 = require("./invite-T3L4N2m0.cjs");
14
+ const require_round1$2 = require("./round1-ek-G6qVi.cjs");
15
+ const require_round2$2 = require("./round2-C684Nir0.cjs");
16
+ const require_receive$1 = require("./receive-Coqg6eFx.cjs");
17
+ const require_round1$3 = require("./round1-CEbz7cnL.cjs");
18
+ const require_round2$3 = require("./round2-D8l1PUm5.cjs");
19
+ const require_finalize$2 = require("./finalize-BUUNWqKC.cjs");
20
20
  //#region src/cmd/check.ts
21
21
  /**
22
22
  * Check if an ARID exists in storage.
@@ -28,7 +28,7 @@ async function checkAridExists(client, arid) {
28
28
  }
29
29
  //#endregion
30
30
  //#region src/cmd/dkg/coordinator/index.ts
31
- var coordinator_exports$1 = /* @__PURE__ */ require_chunk.__exportAll({
31
+ var coordinator_exports$1 = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
32
32
  buildFinalizeRequestForParticipant: () => require_round2.buildFinalizeRequestForParticipant,
33
33
  collectRound2Parallel: () => require_round2.collectRound2Parallel,
34
34
  dispatchFinalizeRequestsParallel: () => require_round2.dispatchFinalizeRequestsParallel,
@@ -42,7 +42,7 @@ var coordinator_exports$1 = /* @__PURE__ */ require_chunk.__exportAll({
42
42
  });
43
43
  //#endregion
44
44
  //#region src/cmd/dkg/participant/index.ts
45
- var participant_exports$1 = /* @__PURE__ */ require_chunk.__exportAll({
45
+ var participant_exports$1 = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
46
46
  decodeInviteDetails: () => require_receive.decodeInviteDetails,
47
47
  finalize: () => require_finalize$1.finalize,
48
48
  receive: () => require_receive.receive,
@@ -52,7 +52,7 @@ var participant_exports$1 = /* @__PURE__ */ require_chunk.__exportAll({
52
52
  });
53
53
  //#endregion
54
54
  //#region src/cmd/dkg/index.ts
55
- var dkg_exports = /* @__PURE__ */ require_chunk.__exportAll({
55
+ var dkg_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
56
56
  buildGroupParticipants: () => require_common.buildGroupParticipants,
57
57
  coordinator: () => coordinator_exports$1,
58
58
  dkgStateDir: () => require_common.dkgStateDir,
@@ -71,7 +71,7 @@ var dkg_exports = /* @__PURE__ */ require_chunk.__exportAll({
71
71
  });
72
72
  //#endregion
73
73
  //#region src/cmd/sign/coordinator/index.ts
74
- var coordinator_exports = /* @__PURE__ */ require_chunk.__exportAll({
74
+ var coordinator_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
75
75
  buildSessionStateJson: () => require_invite$1.buildSessionStateJson,
76
76
  buildShareRequestForParticipant: () => require_round1$2.buildShareRequestForParticipant,
77
77
  buildSignInviteRequest: () => require_invite$1.buildSignInviteRequest,
@@ -91,7 +91,7 @@ var coordinator_exports = /* @__PURE__ */ require_chunk.__exportAll({
91
91
  });
92
92
  //#endregion
93
93
  //#region src/cmd/sign/participant/index.ts
94
- var participant_exports = /* @__PURE__ */ require_chunk.__exportAll({
94
+ var participant_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
95
95
  finalize: () => require_finalize$2.finalize,
96
96
  receive: () => require_receive$1.receive,
97
97
  round1: () => require_round1$3.round1,
@@ -99,7 +99,7 @@ var participant_exports = /* @__PURE__ */ require_chunk.__exportAll({
99
99
  });
100
100
  //#endregion
101
101
  //#region src/cmd/sign/index.ts
102
- var sign_exports = /* @__PURE__ */ require_chunk.__exportAll({
102
+ var sign_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
103
103
  SignFinalizeContent: () => require_common$1.SignFinalizeContent,
104
104
  coordinator: () => coordinator_exports,
105
105
  participant: () => participant_exports,
@@ -126,4 +126,4 @@ Object.defineProperty(exports, "sign_exports", {
126
126
  }
127
127
  });
128
128
 
129
- //# sourceMappingURL=cmd-CCVhHzG7.cjs.map
129
+ //# sourceMappingURL=cmd-Cd5Bmjy8.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cmd-DNsHd19v.mjs","names":[],"sources":["../src/cmd/check.ts","../src/cmd/dkg/coordinator/index.ts","../src/cmd/dkg/participant/index.ts","../src/cmd/dkg/index.ts","../src/cmd/sign/coordinator/index.ts","../src/cmd/sign/participant/index.ts","../src/cmd/sign/index.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Check command utilities.\n *\n * Port of cmd/check.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type ARID } from \"@bcts/components\";\n\nimport { type StorageClient } from \"./storage.js\";\n\n/**\n * Check if an ARID exists in storage.\n *\n * Port of check functionality from cmd/check.rs.\n */\nexport async function checkAridExists(client: StorageClient, arid: ARID): Promise<boolean> {\n return client.exists(arid);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG coordinator commands.\n *\n * Port of cmd/dkg/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG participant commands.\n *\n * Port of cmd/dkg/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG command module.\n *\n * Port of cmd/dkg/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign coordinator commands.\n *\n * Port of cmd/sign/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign participant commands.\n *\n * Port of cmd/sign/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign command module.\n *\n * Port of cmd/sign/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,gBAAgB,QAAuB,MAA8B;CACzF,OAAO,OAAO,OAAO,IAAI;AAC3B"}
1
+ {"version":3,"file":"cmd-Cd5Bmjy8.cjs","names":[],"sources":["../src/cmd/check.ts","../src/cmd/dkg/coordinator/index.ts","../src/cmd/dkg/participant/index.ts","../src/cmd/dkg/index.ts","../src/cmd/sign/coordinator/index.ts","../src/cmd/sign/participant/index.ts","../src/cmd/sign/index.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Check command utilities.\n *\n * Port of cmd/check.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type ARID } from \"@bcts/components\";\n\nimport { type StorageClient } from \"./storage.js\";\n\n/**\n * Check if an ARID exists in storage.\n *\n * Port of check functionality from cmd/check.rs.\n */\nexport async function checkAridExists(client: StorageClient, arid: ARID): Promise<boolean> {\n return client.exists(arid);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG coordinator commands.\n *\n * Port of cmd/dkg/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG participant commands.\n *\n * Port of cmd/dkg/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG command module.\n *\n * Port of cmd/dkg/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign coordinator commands.\n *\n * Port of cmd/sign/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign participant commands.\n *\n * Port of cmd/sign/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign command module.\n *\n * Port of cmd/sign/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,gBAAgB,QAAuB,MAA8B;CACzF,OAAO,OAAO,OAAO,IAAI;AAC3B"}
@@ -1,22 +1,22 @@
1
- import { t as __exportAll } from "./chunk-z9aeyW2b.mjs";
2
- import { a as dkgStateDir, c as parseAridUr, d as resolveOwnerXidDocument, f as resolveParticipants, h as signingKeyFromVerifying, i as buildGroupParticipants, l as parseEnvelopeUr, m as resolveSenderName, o as formatNameWithOwnerMarker, p as resolveSender, s as groupParticipantFromRegistry, t as groupStateDir, u as participantNamesFromRegistry } from "./common-Cf1UvJaP.mjs";
3
- import "./registry-DGjs4qDK.mjs";
4
- import { t as invite } from "./invite-Be2v2SVc.mjs";
5
- import { t as round1 } from "./round1-BOIE1E4O.mjs";
6
- import { a as round2, c as validateAndExtractRound2Response, i as persistRound2Packages, n as collectRound2Parallel, r as dispatchFinalizeRequestsParallel, s as updatePendingForFinalizeFromCollection, t as buildFinalizeRequestForParticipant } from "./round2-BfetYacV.mjs";
7
- import { t as finalize } from "./finalize-DtRxHZ7H.mjs";
8
- import { i as resolveInviteEnvelope, n as receive, t as decodeInviteDetails } from "./receive-dkSCSGpl.mjs";
9
- import { t as round1$1 } from "./round1-Y2kcVwnR.mjs";
10
- import { t as round2$1 } from "./round2-mF6UlkT-.mjs";
11
- import { t as finalize$1 } from "./finalize-T83Ko8nG.mjs";
12
- import { n as signingStateDir, r as signingStateDirForGroup, t as SignFinalizeContent } from "./common-DNrD_-EI.mjs";
13
- import { a as invite$1, c as persistSessionState, i as gatherRecipientDocuments, l as validateCoordinator, n as buildSignInviteRequest, r as createSessionArids, s as loadEnvelopeFromPath, t as buildSessionStateJson } from "./invite-D8mQSnFz.mjs";
14
- import { a as round1$2, c as validateAndExtractCommitResponse, i as persistCommitments, n as collectCommitmentsParallel, r as dispatchShareRequestsParallel, s as updatePendingForShare, t as buildShareRequestForParticipant } from "./round1-D8t7EzIo.mjs";
15
- import { t as round2$2 } from "./round2-Cf5CJc_8.mjs";
16
- import { t as receive$1 } from "./receive-g8EhZF2Y.mjs";
17
- import { t as round1$3 } from "./round1-B8haiMM8.mjs";
18
- import { t as round2$3 } from "./round2-Z2JhMwxc.mjs";
19
- import { t as finalize$2 } from "./finalize-BpC0rz93.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-z9aeyW2b.mjs";
2
+ import { a as dkgStateDir, c as parseAridUr, d as resolveOwnerXidDocument, f as resolveParticipants, h as signingKeyFromVerifying, i as buildGroupParticipants, l as parseEnvelopeUr, m as resolveSenderName, o as formatNameWithOwnerMarker, p as resolveSender, s as groupParticipantFromRegistry, t as groupStateDir, u as participantNamesFromRegistry } from "./common-4spC1kNw.mjs";
3
+ import "./registry-ycylEdoc.mjs";
4
+ import { t as invite } from "./invite-vRv9LMEE.mjs";
5
+ import { t as round1 } from "./round1-DSaOFCar.mjs";
6
+ import { a as round2, c as validateAndExtractRound2Response, i as persistRound2Packages, n as collectRound2Parallel, r as dispatchFinalizeRequestsParallel, s as updatePendingForFinalizeFromCollection, t as buildFinalizeRequestForParticipant } from "./round2-Cq2SD6F8.mjs";
7
+ import { t as finalize } from "./finalize-Bm5RZIox.mjs";
8
+ import { i as resolveInviteEnvelope, n as receive, t as decodeInviteDetails } from "./receive-C2Dwb_FQ.mjs";
9
+ import { t as round1$1 } from "./round1-_fHip4H1.mjs";
10
+ import { t as round2$1 } from "./round2-CU-yTXHT.mjs";
11
+ import { t as finalize$1 } from "./finalize-CELJsR4C.mjs";
12
+ import { n as signingStateDir, r as signingStateDirForGroup, t as SignFinalizeContent } from "./common--IfAHVkl.mjs";
13
+ import { a as invite$1, c as persistSessionState, i as gatherRecipientDocuments, l as validateCoordinator, n as buildSignInviteRequest, r as createSessionArids, s as loadEnvelopeFromPath, t as buildSessionStateJson } from "./invite-DNlTkwzM.mjs";
14
+ import { a as round1$2, c as validateAndExtractCommitResponse, i as persistCommitments, n as collectCommitmentsParallel, r as dispatchShareRequestsParallel, s as updatePendingForShare, t as buildShareRequestForParticipant } from "./round1-BRgDPU4Y.mjs";
15
+ import { t as round2$2 } from "./round2-DmQvJDVj.mjs";
16
+ import { t as receive$1 } from "./receive-Bzn87ahI.mjs";
17
+ import { t as round1$3 } from "./round1-DL4N2QJ5.mjs";
18
+ import { t as round2$3 } from "./round2-BLOgZeAo.mjs";
19
+ import { t as finalize$2 } from "./finalize-BAwtGCQW.mjs";
20
20
  //#region src/cmd/check.ts
21
21
  /**
22
22
  * Check if an ARID exists in storage.
@@ -109,4 +109,4 @@ var sign_exports = /* @__PURE__ */ __exportAll({
109
109
  //#endregion
110
110
  export { dkg_exports as n, checkAridExists as r, sign_exports as t };
111
111
 
112
- //# sourceMappingURL=cmd-DNsHd19v.mjs.map
112
+ //# sourceMappingURL=cmd-ChW3eHA8.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cmd-CCVhHzG7.cjs","names":[],"sources":["../src/cmd/check.ts","../src/cmd/dkg/coordinator/index.ts","../src/cmd/dkg/participant/index.ts","../src/cmd/dkg/index.ts","../src/cmd/sign/coordinator/index.ts","../src/cmd/sign/participant/index.ts","../src/cmd/sign/index.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Check command utilities.\n *\n * Port of cmd/check.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type ARID } from \"@bcts/components\";\n\nimport { type StorageClient } from \"./storage.js\";\n\n/**\n * Check if an ARID exists in storage.\n *\n * Port of check functionality from cmd/check.rs.\n */\nexport async function checkAridExists(client: StorageClient, arid: ARID): Promise<boolean> {\n return client.exists(arid);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG coordinator commands.\n *\n * Port of cmd/dkg/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG participant commands.\n *\n * Port of cmd/dkg/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG command module.\n *\n * Port of cmd/dkg/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign coordinator commands.\n *\n * Port of cmd/sign/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign participant commands.\n *\n * Port of cmd/sign/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign command module.\n *\n * Port of cmd/sign/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,gBAAgB,QAAuB,MAA8B;CACzF,OAAO,OAAO,OAAO,IAAI;AAC3B"}
1
+ {"version":3,"file":"cmd-ChW3eHA8.mjs","names":[],"sources":["../src/cmd/check.ts","../src/cmd/dkg/coordinator/index.ts","../src/cmd/dkg/participant/index.ts","../src/cmd/dkg/index.ts","../src/cmd/sign/coordinator/index.ts","../src/cmd/sign/participant/index.ts","../src/cmd/sign/index.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Check command utilities.\n *\n * Port of cmd/check.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type ARID } from \"@bcts/components\";\n\nimport { type StorageClient } from \"./storage.js\";\n\n/**\n * Check if an ARID exists in storage.\n *\n * Port of check functionality from cmd/check.rs.\n */\nexport async function checkAridExists(client: StorageClient, arid: ARID): Promise<boolean> {\n return client.exists(arid);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG coordinator commands.\n *\n * Port of cmd/dkg/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG participant commands.\n *\n * Port of cmd/dkg/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG command module.\n *\n * Port of cmd/dkg/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign coordinator commands.\n *\n * Port of cmd/sign/coordinator/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./invite.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign participant commands.\n *\n * Port of cmd/sign/participant/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./receive.js\";\nexport * from \"./round1.js\";\nexport * from \"./round2.js\";\nexport * from \"./finalize.js\";\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Sign command module.\n *\n * Port of cmd/sign/mod.rs from frost-hubert-rust.\n *\n * @module\n */\n\nexport * from \"./common.js\";\nexport * as coordinator from \"./coordinator/index.js\";\nexport * as participant from \"./participant/index.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,gBAAgB,QAAuB,MAA8B;CACzF,OAAO,OAAO,OAAO,IAAI;AAC3B"}
@@ -1,4 +1,4 @@
1
- import { t as groupStateDir } from "./common-Cf1UvJaP.mjs";
1
+ import { t as groupStateDir } from "./common-4spC1kNw.mjs";
2
2
  import { Envelope } from "@bcts/envelope";
3
3
  //#region src/cmd/sign/common.ts
4
4
  /**
@@ -93,4 +93,4 @@ var SignFinalizeContent = class SignFinalizeContent {
93
93
  //#endregion
94
94
  export { signingStateDir as n, signingStateDirForGroup as r, SignFinalizeContent as t };
95
95
 
96
- //# sourceMappingURL=common-DNrD_-EI.mjs.map
96
+ //# sourceMappingURL=common--IfAHVkl.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-DNrD_-EI.mjs","names":[],"sources":["../src/cmd/sign/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for sign commands.\n *\n * Port of cmd/sign/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { Envelope, type EnvelopeEncodableValue } from \"@bcts/envelope\";\n\nimport { groupStateDir } from \"../common\";\n\n/**\n * Get the signing state directory for a group (without session).\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing`\n *\n * Port of `signing_state_dir_for_group()` from cmd/sign/common.rs.\n */\nexport function signingStateDirForGroup(registryPath: string, groupIdHex: string): string {\n return `${groupStateDir(registryPath, groupIdHex)}/signing`;\n}\n\n/**\n * Get the signing state directory for a given registry path, group ID, and session ID.\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing/{session_id.hex()}`\n *\n * Port of `signing_state_dir()` from cmd/sign/common.rs.\n */\nexport function signingStateDir(\n registryPath: string,\n groupIdHex: string,\n sessionIdHex: string,\n): string {\n return `${signingStateDirForGroup(registryPath, groupIdHex)}/${sessionIdHex}`;\n}\n\n/**\n * Content wrapper for signFinalize events.\n *\n * This wraps an envelope with a unit subject and type assertion\n * \"signFinalize\", implementing the traits required by SealedEvent<T>.\n *\n * Port of `struct SignFinalizeContent` from cmd/sign/common.rs.\n */\nexport class SignFinalizeContent {\n private readonly _envelope: Envelope;\n\n private constructor(envelope: Envelope) {\n this._envelope = envelope;\n }\n\n /**\n * Creates a new SignFinalizeContent with a unit subject and type assertion.\n *\n * Port of `SignFinalizeContent::new()` from cmd/sign/common.rs.\n */\n static new(): SignFinalizeContent {\n const envelope = Envelope.unit().addType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Adds an assertion to the content envelope.\n *\n * Port of `SignFinalizeContent::add_assertion()` from cmd/sign/common.rs.\n */\n addAssertion(\n predicate: EnvelopeEncodableValue,\n object: EnvelopeEncodableValue,\n ): SignFinalizeContent {\n const newEnvelope = this._envelope.addAssertion(predicate, object);\n return new SignFinalizeContent(newEnvelope);\n }\n\n /**\n * Returns the inner envelope.\n *\n * Port of `SignFinalizeContent::envelope()` from cmd/sign/common.rs.\n */\n envelope(): Envelope {\n return this._envelope;\n }\n\n /**\n * Creates a SignFinalizeContent from an envelope with validation.\n *\n * Validates that the envelope has a unit subject and type \"signFinalize\".\n *\n * Port of `TryFrom<Envelope> for SignFinalizeContent` from cmd/sign/common.rs.\n */\n static fromEnvelope(envelope: Envelope): SignFinalizeContent {\n // Validate it has a unit subject and type \"signFinalize\"\n envelope.checkSubjectUnit();\n envelope.checkType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Converts this SignFinalizeContent to an Envelope.\n *\n * Port of `From<SignFinalizeContent> for Envelope` from cmd/sign/common.rs.\n */\n toEnvelope(): Envelope {\n return this._envelope;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,wBAAwB,cAAsB,YAA4B;CACxF,OAAO,GAAG,cAAc,cAAc,UAAU,EAAE;AACpD;;;;;;;;AASA,SAAgB,gBACd,cACA,YACA,cACQ;CACR,OAAO,GAAG,wBAAwB,cAAc,UAAU,EAAE,GAAG;AACjE;;;;;;;;;AAUA,IAAa,sBAAb,MAAa,oBAAoB;CAC/B;CAEA,YAAoB,UAAoB;EACtC,KAAK,YAAY;CACnB;;;;;;CAOA,OAAO,MAA2B;EAEhC,OAAO,IAAI,oBADM,SAAS,KAAK,EAAE,QAAQ,cACH,CAAC;CACzC;;;;;;CAOA,aACE,WACA,QACqB;EAErB,OAAO,IAAI,oBADS,KAAK,UAAU,aAAa,WAAW,MAClB,CAAC;CAC5C;;;;;;CAOA,WAAqB;EACnB,OAAO,KAAK;CACd;;;;;;;;CASA,OAAO,aAAa,UAAyC;EAE3D,SAAS,iBAAiB;EAC1B,SAAS,UAAU,cAAc;EACjC,OAAO,IAAI,oBAAoB,QAAQ;CACzC;;;;;;CAOA,aAAuB;EACrB,OAAO,KAAK;CACd;AACF"}
1
+ {"version":3,"file":"common--IfAHVkl.mjs","names":[],"sources":["../src/cmd/sign/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for sign commands.\n *\n * Port of cmd/sign/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { Envelope, type EnvelopeEncodableValue } from \"@bcts/envelope\";\n\nimport { groupStateDir } from \"../common\";\n\n/**\n * Get the signing state directory for a group (without session).\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing`\n *\n * Port of `signing_state_dir_for_group()` from cmd/sign/common.rs.\n */\nexport function signingStateDirForGroup(registryPath: string, groupIdHex: string): string {\n return `${groupStateDir(registryPath, groupIdHex)}/signing`;\n}\n\n/**\n * Get the signing state directory for a given registry path, group ID, and session ID.\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing/{session_id.hex()}`\n *\n * Port of `signing_state_dir()` from cmd/sign/common.rs.\n */\nexport function signingStateDir(\n registryPath: string,\n groupIdHex: string,\n sessionIdHex: string,\n): string {\n return `${signingStateDirForGroup(registryPath, groupIdHex)}/${sessionIdHex}`;\n}\n\n/**\n * Content wrapper for signFinalize events.\n *\n * This wraps an envelope with a unit subject and type assertion\n * \"signFinalize\", implementing the traits required by SealedEvent<T>.\n *\n * Port of `struct SignFinalizeContent` from cmd/sign/common.rs.\n */\nexport class SignFinalizeContent {\n private readonly _envelope: Envelope;\n\n private constructor(envelope: Envelope) {\n this._envelope = envelope;\n }\n\n /**\n * Creates a new SignFinalizeContent with a unit subject and type assertion.\n *\n * Port of `SignFinalizeContent::new()` from cmd/sign/common.rs.\n */\n static new(): SignFinalizeContent {\n const envelope = Envelope.unit().addType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Adds an assertion to the content envelope.\n *\n * Port of `SignFinalizeContent::add_assertion()` from cmd/sign/common.rs.\n */\n addAssertion(\n predicate: EnvelopeEncodableValue,\n object: EnvelopeEncodableValue,\n ): SignFinalizeContent {\n const newEnvelope = this._envelope.addAssertion(predicate, object);\n return new SignFinalizeContent(newEnvelope);\n }\n\n /**\n * Returns the inner envelope.\n *\n * Port of `SignFinalizeContent::envelope()` from cmd/sign/common.rs.\n */\n envelope(): Envelope {\n return this._envelope;\n }\n\n /**\n * Creates a SignFinalizeContent from an envelope with validation.\n *\n * Validates that the envelope has a unit subject and type \"signFinalize\".\n *\n * Port of `TryFrom<Envelope> for SignFinalizeContent` from cmd/sign/common.rs.\n */\n static fromEnvelope(envelope: Envelope): SignFinalizeContent {\n // Validate it has a unit subject and type \"signFinalize\"\n envelope.checkSubjectUnit();\n envelope.checkType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Converts this SignFinalizeContent to an Envelope.\n *\n * Port of `From<SignFinalizeContent> for Envelope` from cmd/sign/common.rs.\n */\n toEnvelope(): Envelope {\n return this._envelope;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,wBAAwB,cAAsB,YAA4B;CACxF,OAAO,GAAG,cAAc,cAAc,UAAU,EAAE;AACpD;;;;;;;;AASA,SAAgB,gBACd,cACA,YACA,cACQ;CACR,OAAO,GAAG,wBAAwB,cAAc,UAAU,EAAE,GAAG;AACjE;;;;;;;;;AAUA,IAAa,sBAAb,MAAa,oBAAoB;CAC/B;CAEA,YAAoB,UAAoB;EACtC,KAAK,YAAY;CACnB;;;;;;CAOA,OAAO,MAA2B;EAEhC,OAAO,IAAI,oBADM,SAAS,KAAK,CAAC,CAAC,QAAQ,cACH,CAAC;CACzC;;;;;;CAOA,aACE,WACA,QACqB;EAErB,OAAO,IAAI,oBADS,KAAK,UAAU,aAAa,WAAW,MAClB,CAAC;CAC5C;;;;;;CAOA,WAAqB;EACnB,OAAO,KAAK;CACd;;;;;;;;CASA,OAAO,aAAa,UAAyC;EAE3D,SAAS,iBAAiB;EAC1B,SAAS,UAAU,cAAc;EACjC,OAAO,IAAI,oBAAoB,QAAQ;CACzC;;;;;;CAOA,aAAuB;EACrB,OAAO,KAAK;CACd;AACF"}
@@ -1,9 +1,9 @@
1
- const require_chunk = require("./chunk-DakpK96I.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
2
  const require_proposed_participant = require("./proposed-participant-BvHNnpcZ.cjs");
3
3
  const require_registry_index = require("./registry/index.cjs");
4
4
  let _bcts_uniform_resources = require("@bcts/uniform-resources");
5
5
  let node_path = require("node:path");
6
- node_path = require_chunk.__toESM(node_path, 1);
6
+ node_path = require_rolldown_runtime.__toESM(node_path, 1);
7
7
  //#region src/cmd/dkg/common.ts
8
8
  /**
9
9
  * Copyright © 2023-2026 Blockchain Commons, LLC
@@ -369,4 +369,4 @@ Object.defineProperty(exports, "signingKeyFromVerifying", {
369
369
  }
370
370
  });
371
371
 
372
- //# sourceMappingURL=common-CnvAUC2b.cjs.map
372
+ //# sourceMappingURL=common-3msAx7hO.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-CnvAUC2b.cjs","names":["UR","GroupParticipant","compareXidBytes","path","path"],"sources":["../src/cmd/dkg/common.ts","../src/cmd/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for DKG commands.\n *\n * Port of cmd/dkg/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nimport { type ARID, type XID } from \"@bcts/components\";\nimport { compareXidBytes } from \"../../dkg/proposed-participant.js\";\nimport { type Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { type XIDDocument } from \"@bcts/xid\";\n\nimport {\n GroupParticipant,\n type OwnerRecord,\n type ParticipantRecord,\n type Registry,\n} from \"../../registry/index.js\";\n\n// Re-export cross-cutting utilities for convenience\nexport { groupStateDir } from \"../common.js\";\n\n/**\n * Parse an ARID from a UR string.\n *\n * Mirrors Rust `parse_arid_ur` (`cmd/common.rs:27-43`):\n *\n * 1. Trim and reject empty input.\n * 2. Parse as a UR; require `ur_type` of `\"arid\"`.\n * 3. Try `ARID::try_from(cbor)` (the tagged-CBOR form).\n * 4. If that fails, fall back to interpreting the CBOR as a bare\n * byte string and constructing the ARID from those bytes via\n * `ARID::from_data_ref`.\n *\n * The earlier port only accepted the tagged form; this matches Rust\n * by accepting the byte-string fallback too.\n */\nexport function parseAridUr(urString: string): ARID {\n const trimmed = urString.trim();\n if (trimmed.length === 0) {\n throw new Error(\"ARID is required\");\n }\n const ur = UR.fromURString(trimmed);\n\n if (ur.urTypeStr() !== \"arid\") {\n throw new Error(`Expected a ur:arid, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { ARID: ARIDClass } = require(\"@bcts/components\");\n const cbor = ur.cbor();\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromTaggedCbor(cbor);\n } catch {\n // Fall back to a bare byte string payload, mirroring Rust's\n // `CBOR::try_into_byte_string(cbor) → ARID::from_data_ref(bytes)`.\n const bytes = (cbor as { asByteString(): Uint8Array | undefined }).asByteString?.();\n if (bytes === undefined) {\n throw new Error(\"Invalid ARID payload\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromData(bytes);\n }\n}\n\n/**\n * Parse an envelope from a UR string.\n *\n * Port of `parse_envelope_ur()` from cmd/dkg/common.rs.\n */\nexport function parseEnvelopeUr(urString: string): Envelope {\n const ur = UR.fromURString(urString.trim());\n\n if (ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected ur:envelope, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { Envelope: EnvelopeClass } = require(\"@bcts/envelope\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return EnvelopeClass.fromCbor(ur.cbor());\n}\n\n/**\n * Resolve the registry owner's XID document.\n *\n * The earlier port called this `resolveSender(registry)`, but its\n * behaviour — \"give me the owner\" — has nothing in common with Rust's\n * `resolve_sender(registry, input)` (which resolves an arbitrary\n * named sender). This helper is renamed to its actual behaviour;\n * the Rust-equivalent `resolveSender(registry, input)` lives below.\n */\nexport function resolveOwnerXidDocument(registry: Registry): XIDDocument {\n const owner = registry.owner();\n\n if (!owner) {\n throw new Error(\"No owner set in registry. Run 'registry owner set' first.\");\n }\n\n return owner.xidDocument();\n}\n\n/**\n * Resolve a sender XID document from the registry by UR or pet name.\n *\n * Mirrors Rust `resolve_sender(registry, input)`\n * (`cmd/dkg/common.rs:76-94`):\n *\n * 1. Trim and reject empty input.\n * 2. Try parsing the input as a `ur:xid`. If that succeeds, look it\n * up via `registry.participant(xid)`; if no record is found,\n * error with `Sender with XID {ur} not found`.\n * 3. Otherwise look it up by pet name via\n * `registry.participantByPetName(name)`; if no record is found,\n * error with `Sender with pet name '{name}' not found`.\n *\n * Note Rust does NOT check the owner here — only the participants\n * map. The earlier inline duplicate in `participant/round1.ts` did\n * an extra owner-check fallback which is removed to match Rust.\n */\nexport function resolveSender(registry: Registry, input: string): XIDDocument {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"Sender is required\");\n }\n\n // Try parsing as an XID UR string first. `XID.fromURString` throws\n // when the input isn't a `ur:xid`; that's the signal to fall back\n // to pet-name lookup.\n let xid: XID | undefined;\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n } catch {\n xid = undefined;\n }\n\n if (xid !== undefined) {\n const record = registry.participant(xid);\n if (record !== undefined) {\n return record.xidDocument();\n }\n throw new Error(`Sender with XID ${xid.urString()} not found`);\n }\n\n const result = registry.participantByPetName(trimmed);\n if (result !== undefined) {\n const [, record] = result;\n return record.xidDocument();\n }\n throw new Error(`Sender with pet name '${trimmed}' not found`);\n}\n\n// -----------------------------------------------------------------------------\n// Participant resolution\n// -----------------------------------------------------------------------------\n\n/**\n * Resolve participant identifiers (XID URs or pet names) to records.\n *\n * Port of `resolve_participants()` from cmd/dkg/common.rs lines 29-74.\n */\nexport function resolveParticipants(\n registry: Registry,\n inputs: string[],\n): [XID, ParticipantRecord][] {\n const seenArgs = new Set<string>();\n const seenXids = new Set<string>();\n const resolved: [XID, ParticipantRecord][] = [];\n\n for (const raw of inputs) {\n const trimmed = raw.trim();\n if (trimmed === \"\") {\n throw new Error(\"Participant identifier cannot be empty\");\n }\n if (seenArgs.has(trimmed)) {\n throw new Error(`Duplicate participant argument: ${trimmed}`);\n }\n seenArgs.add(trimmed);\n\n let xid: XID;\n let record: ParticipantRecord;\n\n // Try parsing as XID UR first\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n\n const foundRecord = registry.participant(xid);\n if (!foundRecord) {\n throw new Error(`Participant with XID ${xid.urString()} not found in registry`);\n }\n record = foundRecord;\n } catch {\n // Try looking up by pet name\n const result = registry.participantByPetName(trimmed);\n if (!result) {\n throw new Error(`Participant with pet name '${trimmed}' not found`);\n }\n [xid, record] = result;\n }\n\n const xidUr = xid.urString();\n if (seenXids.has(xidUr)) {\n throw new Error(`Duplicate participant specified; multiple inputs resolve to ${xidUr}`);\n }\n seenXids.add(xidUr);\n\n resolved.push([xid, record]);\n }\n\n return resolved;\n}\n\n/**\n * Get display name for sender from registry.\n *\n * Port of `resolve_sender_name()` from cmd/dkg/common.rs lines 96-116.\n */\nexport function resolveSenderName(registry: Registry, sender: XIDDocument): string | undefined {\n const owner = registry.owner();\n const senderXid = sender.xid();\n\n // Check if sender is the owner\n if (owner?.xidDocument().xid().urString() === senderXid.urString()) {\n const name = owner.petName() ?? senderXid.urString();\n return formatNameWithOwnerMarker(name, true);\n }\n\n // Look up in participants\n const record = registry.participant(senderXid);\n if (record) {\n const name = record.petName() ?? record.xid().urString();\n return formatNameWithOwnerMarker(name, false);\n }\n\n return undefined;\n}\n\n// -----------------------------------------------------------------------------\n// Group participant building\n// -----------------------------------------------------------------------------\n\n/**\n * Build GroupParticipant[] from XIDDocuments using registry lookups.\n *\n * Port of `build_group_participants()` from cmd/dkg/common.rs lines 122-131.\n */\nexport function buildGroupParticipants(\n registry: Registry,\n owner: OwnerRecord,\n participants: XIDDocument[],\n): GroupParticipant[] {\n return participants.map((doc) => groupParticipantFromRegistry(registry, owner, doc));\n}\n\n/**\n * Create a GroupParticipant from a XIDDocument, validating against the registry.\n *\n * Port of `group_participant_from_registry()` from cmd/dkg/common.rs lines 133-149.\n */\nexport function groupParticipantFromRegistry(\n registry: Registry,\n owner: OwnerRecord,\n document: XIDDocument,\n): GroupParticipant {\n const xid = document.xid();\n\n // If the document is the owner, allow it\n if (xid.urString() === owner.xid().urString()) {\n return new GroupParticipant(xid);\n }\n\n // Otherwise, verify the participant is in the registry\n if (!registry.participant(xid)) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n\n return new GroupParticipant(xid);\n}\n\n// -----------------------------------------------------------------------------\n// Name formatting\n// -----------------------------------------------------------------------------\n\n/**\n * Format a participant name with owner marker if applicable.\n *\n * Port of `format_name_with_owner_marker()` from cmd/dkg/common.rs lines 155-157.\n */\nexport function formatNameWithOwnerMarker(name: string, isOwner: boolean): string {\n return isOwner ? `* ${name}` : name;\n}\n\n/**\n * Get display names for participants, sorted by XID, with owner marked.\n *\n * Port of `participant_names_from_registry()` from cmd/dkg/common.rs lines 159-191.\n */\nexport function participantNamesFromRegistry(\n registry: Registry,\n participants: XIDDocument[],\n ownerXid: XID,\n ownerPetName: string | undefined,\n): string[] {\n // Sort by XID byte order — mirrors Rust `XID::cmp` (raw 32-byte\n // lex compare). The earlier port used\n // `urString().localeCompare(...)`, which diverges from byte order\n // for bytes ≥ 0x80 and is locale-aware.\n const sorted = [...participants].sort((a, b) =>\n compareXidBytes(a.xid().toData(), b.xid().toData()),\n );\n\n return sorted.map((document) => {\n const xid = document.xid();\n const isOwner = xid.urString() === ownerXid.urString();\n\n let name: string;\n if (isOwner) {\n name = ownerPetName ?? xid.urString();\n } else {\n const record = registry.participant(xid);\n if (!record) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n name = record.petName() ?? xid.urString();\n }\n\n return formatNameWithOwnerMarker(name, isOwner);\n });\n}\n\n/**\n * Get the DKG state directory for a given registry path and group ID.\n *\n * Port of `dkg_state_dir()` from cmd/dkg/common.rs.\n */\nexport function dkgStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex, \"dkg\");\n}\n\n/**\n * Convert a verifying key bytes to a SigningPublicKey.\n *\n * Port of `signing_key_from_verifying()` from cmd/dkg/common.rs.\n */\nexport function signingKeyFromVerifying(verifyingKeyBytes: Uint8Array): unknown {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { SigningPublicKey: SigningPublicKeyClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return SigningPublicKeyClass.fromBytes(verifyingKeyBytes);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for commands.\n *\n * Port of `cmd/common.rs` from `frost-hubert-rust`.\n *\n * Rust's `cmd::common` exports four cross-cutting helpers used by\n * both the DKG and signing subcommand trees:\n *\n * - `parse_arid_ur` / `signing_key_from_verifying` — re-exported\n * here so the TS module layout matches Rust. The implementations\n * live alongside their other DKG-specific siblings in\n * `cmd/dkg/common.ts` so callers in either tree can keep using\n * them; this file just surfaces them at the parallel-to-Rust\n * import path (`@bcts/frost-hubert/cmd/common`).\n * - `group_state_dir` and the verbose-flag helpers are TS-native here.\n *\n * `OptionalStorageSelector` is intentionally not ported: it's a\n * `clap`-specific argument struct and the TS port surfaces the same\n * effect via the `StorageSelection` string-literal union — see the\n * `parity audit` for context.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nexport { parseAridUr, signingKeyFromVerifying } from \"./dkg/common.js\";\n\n/**\n * Get the group state directory for a given registry path and group ID.\n *\n * Port of `group_state_dir()` from cmd/common.rs.\n */\nexport function groupStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex);\n}\n\n/**\n * Global verbose flag.\n */\nlet verboseFlag = false;\n\n/**\n * Set the verbose flag.\n */\nexport function setVerbose(value: boolean): void {\n verboseFlag = value;\n}\n\n/**\n * Check if verbose mode is enabled.\n *\n * Port of `is_verbose()` from cmd/common.rs.\n */\n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AM,SAAS,SAAS;EAErD,IAAI;EACJ,IAAI,SACF,OAAO,gBAAgB,IAAI,SAAS;OAC/B;GACL,MAAM,SAAS,SAAS,YAAY,GAAG;GACvC,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,6CAA6C,IAAI,SAAS,GAAG;GAE/E,OAAO,OAAO,QAAQ,KAAK,IAAI,SAAS;EAC1C;EAEA,OAAO,0BAA0B,MAAM,OAAO;CAChD,CAAC;AACH;;;;;;AAOA,SAAgB,YAAY,cAAsB,YAA4B;CAC5E,MAAM,OAAOC,UAAK,QAAQ,YAAY;CACtC,OAAOA,UAAK,KAAK,MAAM,eAAe,YAAY,KAAK;AACzD;;;;;;AAOA,SAAgB,wBAAwB,mBAAwC;CAE9E,MAAM,EAAE,kBAAkB,0BAA0B,QAAQ,kBAAkB;CAE9E,OAAO,sBAAsB,UAAU,iBAAiB;AAC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxUA,SAAgB,cAAc,cAAsB,YAA4B;CAC9E,MAAM,OAAOC,UAAK,QAAQ,YAAY;CACtC,OAAOA,UAAK,KAAK,MAAM,eAAe,UAAU;AAClD;;;;AAKA,IAAI,cAAc;;;;AAKlB,SAAgB,WAAW,OAAsB;CAC/C,cAAc;AAChB;;;;;;AAOA,SAAgB,YAAqB;CACnC,OAAO;AACT"}
1
+ {"version":3,"file":"common-3msAx7hO.cjs","names":["UR","GroupParticipant","compareXidBytes","path","path"],"sources":["../src/cmd/dkg/common.ts","../src/cmd/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for DKG commands.\n *\n * Port of cmd/dkg/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nimport { type ARID, type XID } from \"@bcts/components\";\nimport { compareXidBytes } from \"../../dkg/proposed-participant.js\";\nimport { type Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { type XIDDocument } from \"@bcts/xid\";\n\nimport {\n GroupParticipant,\n type OwnerRecord,\n type ParticipantRecord,\n type Registry,\n} from \"../../registry/index.js\";\n\n// Re-export cross-cutting utilities for convenience\nexport { groupStateDir } from \"../common.js\";\n\n/**\n * Parse an ARID from a UR string.\n *\n * Mirrors Rust `parse_arid_ur` (`cmd/common.rs:27-43`):\n *\n * 1. Trim and reject empty input.\n * 2. Parse as a UR; require `ur_type` of `\"arid\"`.\n * 3. Try `ARID::try_from(cbor)` (the tagged-CBOR form).\n * 4. If that fails, fall back to interpreting the CBOR as a bare\n * byte string and constructing the ARID from those bytes via\n * `ARID::from_data_ref`.\n *\n * The earlier port only accepted the tagged form; this matches Rust\n * by accepting the byte-string fallback too.\n */\nexport function parseAridUr(urString: string): ARID {\n const trimmed = urString.trim();\n if (trimmed.length === 0) {\n throw new Error(\"ARID is required\");\n }\n const ur = UR.fromURString(trimmed);\n\n if (ur.urTypeStr() !== \"arid\") {\n throw new Error(`Expected a ur:arid, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { ARID: ARIDClass } = require(\"@bcts/components\");\n const cbor = ur.cbor();\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromTaggedCbor(cbor);\n } catch {\n // Fall back to a bare byte string payload, mirroring Rust's\n // `CBOR::try_into_byte_string(cbor) → ARID::from_data_ref(bytes)`.\n const bytes = (cbor as { asByteString(): Uint8Array | undefined }).asByteString?.();\n if (bytes === undefined) {\n throw new Error(\"Invalid ARID payload\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromData(bytes);\n }\n}\n\n/**\n * Parse an envelope from a UR string.\n *\n * Port of `parse_envelope_ur()` from cmd/dkg/common.rs.\n */\nexport function parseEnvelopeUr(urString: string): Envelope {\n const ur = UR.fromURString(urString.trim());\n\n if (ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected ur:envelope, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { Envelope: EnvelopeClass } = require(\"@bcts/envelope\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return EnvelopeClass.fromCbor(ur.cbor());\n}\n\n/**\n * Resolve the registry owner's XID document.\n *\n * The earlier port called this `resolveSender(registry)`, but its\n * behaviour — \"give me the owner\" — has nothing in common with Rust's\n * `resolve_sender(registry, input)` (which resolves an arbitrary\n * named sender). This helper is renamed to its actual behaviour;\n * the Rust-equivalent `resolveSender(registry, input)` lives below.\n */\nexport function resolveOwnerXidDocument(registry: Registry): XIDDocument {\n const owner = registry.owner();\n\n if (!owner) {\n throw new Error(\"No owner set in registry. Run 'registry owner set' first.\");\n }\n\n return owner.xidDocument();\n}\n\n/**\n * Resolve a sender XID document from the registry by UR or pet name.\n *\n * Mirrors Rust `resolve_sender(registry, input)`\n * (`cmd/dkg/common.rs:76-94`):\n *\n * 1. Trim and reject empty input.\n * 2. Try parsing the input as a `ur:xid`. If that succeeds, look it\n * up via `registry.participant(xid)`; if no record is found,\n * error with `Sender with XID {ur} not found`.\n * 3. Otherwise look it up by pet name via\n * `registry.participantByPetName(name)`; if no record is found,\n * error with `Sender with pet name '{name}' not found`.\n *\n * Note Rust does NOT check the owner here — only the participants\n * map. The earlier inline duplicate in `participant/round1.ts` did\n * an extra owner-check fallback which is removed to match Rust.\n */\nexport function resolveSender(registry: Registry, input: string): XIDDocument {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"Sender is required\");\n }\n\n // Try parsing as an XID UR string first. `XID.fromURString` throws\n // when the input isn't a `ur:xid`; that's the signal to fall back\n // to pet-name lookup.\n let xid: XID | undefined;\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n } catch {\n xid = undefined;\n }\n\n if (xid !== undefined) {\n const record = registry.participant(xid);\n if (record !== undefined) {\n return record.xidDocument();\n }\n throw new Error(`Sender with XID ${xid.urString()} not found`);\n }\n\n const result = registry.participantByPetName(trimmed);\n if (result !== undefined) {\n const [, record] = result;\n return record.xidDocument();\n }\n throw new Error(`Sender with pet name '${trimmed}' not found`);\n}\n\n// -----------------------------------------------------------------------------\n// Participant resolution\n// -----------------------------------------------------------------------------\n\n/**\n * Resolve participant identifiers (XID URs or pet names) to records.\n *\n * Port of `resolve_participants()` from cmd/dkg/common.rs lines 29-74.\n */\nexport function resolveParticipants(\n registry: Registry,\n inputs: string[],\n): [XID, ParticipantRecord][] {\n const seenArgs = new Set<string>();\n const seenXids = new Set<string>();\n const resolved: [XID, ParticipantRecord][] = [];\n\n for (const raw of inputs) {\n const trimmed = raw.trim();\n if (trimmed === \"\") {\n throw new Error(\"Participant identifier cannot be empty\");\n }\n if (seenArgs.has(trimmed)) {\n throw new Error(`Duplicate participant argument: ${trimmed}`);\n }\n seenArgs.add(trimmed);\n\n let xid: XID;\n let record: ParticipantRecord;\n\n // Try parsing as XID UR first\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n\n const foundRecord = registry.participant(xid);\n if (!foundRecord) {\n throw new Error(`Participant with XID ${xid.urString()} not found in registry`);\n }\n record = foundRecord;\n } catch {\n // Try looking up by pet name\n const result = registry.participantByPetName(trimmed);\n if (!result) {\n throw new Error(`Participant with pet name '${trimmed}' not found`);\n }\n [xid, record] = result;\n }\n\n const xidUr = xid.urString();\n if (seenXids.has(xidUr)) {\n throw new Error(`Duplicate participant specified; multiple inputs resolve to ${xidUr}`);\n }\n seenXids.add(xidUr);\n\n resolved.push([xid, record]);\n }\n\n return resolved;\n}\n\n/**\n * Get display name for sender from registry.\n *\n * Port of `resolve_sender_name()` from cmd/dkg/common.rs lines 96-116.\n */\nexport function resolveSenderName(registry: Registry, sender: XIDDocument): string | undefined {\n const owner = registry.owner();\n const senderXid = sender.xid();\n\n // Check if sender is the owner\n if (owner?.xidDocument().xid().urString() === senderXid.urString()) {\n const name = owner.petName() ?? senderXid.urString();\n return formatNameWithOwnerMarker(name, true);\n }\n\n // Look up in participants\n const record = registry.participant(senderXid);\n if (record) {\n const name = record.petName() ?? record.xid().urString();\n return formatNameWithOwnerMarker(name, false);\n }\n\n return undefined;\n}\n\n// -----------------------------------------------------------------------------\n// Group participant building\n// -----------------------------------------------------------------------------\n\n/**\n * Build GroupParticipant[] from XIDDocuments using registry lookups.\n *\n * Port of `build_group_participants()` from cmd/dkg/common.rs lines 122-131.\n */\nexport function buildGroupParticipants(\n registry: Registry,\n owner: OwnerRecord,\n participants: XIDDocument[],\n): GroupParticipant[] {\n return participants.map((doc) => groupParticipantFromRegistry(registry, owner, doc));\n}\n\n/**\n * Create a GroupParticipant from a XIDDocument, validating against the registry.\n *\n * Port of `group_participant_from_registry()` from cmd/dkg/common.rs lines 133-149.\n */\nexport function groupParticipantFromRegistry(\n registry: Registry,\n owner: OwnerRecord,\n document: XIDDocument,\n): GroupParticipant {\n const xid = document.xid();\n\n // If the document is the owner, allow it\n if (xid.urString() === owner.xid().urString()) {\n return new GroupParticipant(xid);\n }\n\n // Otherwise, verify the participant is in the registry\n if (!registry.participant(xid)) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n\n return new GroupParticipant(xid);\n}\n\n// -----------------------------------------------------------------------------\n// Name formatting\n// -----------------------------------------------------------------------------\n\n/**\n * Format a participant name with owner marker if applicable.\n *\n * Port of `format_name_with_owner_marker()` from cmd/dkg/common.rs lines 155-157.\n */\nexport function formatNameWithOwnerMarker(name: string, isOwner: boolean): string {\n return isOwner ? `* ${name}` : name;\n}\n\n/**\n * Get display names for participants, sorted by XID, with owner marked.\n *\n * Port of `participant_names_from_registry()` from cmd/dkg/common.rs lines 159-191.\n */\nexport function participantNamesFromRegistry(\n registry: Registry,\n participants: XIDDocument[],\n ownerXid: XID,\n ownerPetName: string | undefined,\n): string[] {\n // Sort by XID byte order — mirrors Rust `XID::cmp` (raw 32-byte\n // lex compare). The earlier port used\n // `urString().localeCompare(...)`, which diverges from byte order\n // for bytes ≥ 0x80 and is locale-aware.\n const sorted = [...participants].sort((a, b) =>\n compareXidBytes(a.xid().toData(), b.xid().toData()),\n );\n\n return sorted.map((document) => {\n const xid = document.xid();\n const isOwner = xid.urString() === ownerXid.urString();\n\n let name: string;\n if (isOwner) {\n name = ownerPetName ?? xid.urString();\n } else {\n const record = registry.participant(xid);\n if (!record) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n name = record.petName() ?? xid.urString();\n }\n\n return formatNameWithOwnerMarker(name, isOwner);\n });\n}\n\n/**\n * Get the DKG state directory for a given registry path and group ID.\n *\n * Port of `dkg_state_dir()` from cmd/dkg/common.rs.\n */\nexport function dkgStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex, \"dkg\");\n}\n\n/**\n * Convert a verifying key bytes to a SigningPublicKey.\n *\n * Port of `signing_key_from_verifying()` from cmd/dkg/common.rs.\n */\nexport function signingKeyFromVerifying(verifyingKeyBytes: Uint8Array): unknown {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { SigningPublicKey: SigningPublicKeyClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return SigningPublicKeyClass.fromBytes(verifyingKeyBytes);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for commands.\n *\n * Port of `cmd/common.rs` from `frost-hubert-rust`.\n *\n * Rust's `cmd::common` exports four cross-cutting helpers used by\n * both the DKG and signing subcommand trees:\n *\n * - `parse_arid_ur` / `signing_key_from_verifying` — re-exported\n * here so the TS module layout matches Rust. The implementations\n * live alongside their other DKG-specific siblings in\n * `cmd/dkg/common.ts` so callers in either tree can keep using\n * them; this file just surfaces them at the parallel-to-Rust\n * import path (`@bcts/frost-hubert/cmd/common`).\n * - `group_state_dir` and the verbose-flag helpers are TS-native here.\n *\n * `OptionalStorageSelector` is intentionally not ported: it's a\n * `clap`-specific argument struct and the TS port surfaces the same\n * effect via the `StorageSelection` string-literal union — see the\n * `parity audit` for context.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nexport { parseAridUr, signingKeyFromVerifying } from \"./dkg/common.js\";\n\n/**\n * Get the group state directory for a given registry path and group ID.\n *\n * Port of `group_state_dir()` from cmd/common.rs.\n */\nexport function groupStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex);\n}\n\n/**\n * Global verbose flag.\n */\nlet verboseFlag = false;\n\n/**\n * Set the verbose flag.\n */\nexport function setVerbose(value: boolean): void {\n verboseFlag = value;\n}\n\n/**\n * Check if verbose mode is enabled.\n *\n * Port of `is_verbose()` from cmd/common.rs.\n */\nexport function isVerbose(): boolean {\n return verboseFlag;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,YAAY,UAAwB;CAClD,MAAM,UAAU,SAAS,KAAK;CAC9B,IAAI,QAAQ,WAAW,GACrB,MAAM,IAAI,MAAM,kBAAkB;CAEpC,MAAM,KAA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SAAS,GAAG;GAE/E,OAAO,OAAO,QAAQ,KAAK,IAAI,SAAS;EAC1C;EAEA,OAAO,0BAA0B,MAAM,OAAO;CAChD,CAAC;AACH;;;;;;AAOA,SAAgB,YAAY,cAAsB,YAA4B;CAC5E,MAAM,OAAOC,UAAK,QAAQ,YAAY;CACtC,OAAOA,UAAK,KAAK,MAAM,eAAe,YAAY,KAAK;AACzD;;;;;;AAOA,SAAgB,wBAAwB,mBAAwC;CAE9E,MAAM,EAAE,kBAAkB,0BAA0B,QAAQ,kBAAkB;CAE9E,OAAO,sBAAsB,UAAU,iBAAiB;AAC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxUA,SAAgB,cAAc,cAAsB,YAA4B;CAC9E,MAAM,OAAOC,UAAK,QAAQ,YAAY;CACtC,OAAOA,UAAK,KAAK,MAAM,eAAe,UAAU;AAClD;;;;AAKA,IAAI,cAAc;;;;AAKlB,SAAgB,WAAW,OAAsB;CAC/C,cAAc;AAChB;;;;;;AAOA,SAAgB,YAAqB;CACnC,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { n as __require } from "./chunk-z9aeyW2b.mjs";
1
+ import { n as __require } from "./rolldown-runtime-z9aeyW2b.mjs";
2
2
  import { n as compareXidBytes } from "./proposed-participant-Detb823_.mjs";
3
3
  import { GroupParticipant } from "./registry/index.mjs";
4
4
  import { UR } from "@bcts/uniform-resources";
@@ -279,4 +279,4 @@ function isVerbose() {
279
279
  //#endregion
280
280
  export { dkgStateDir as a, parseAridUr as c, resolveOwnerXidDocument as d, resolveParticipants as f, signingKeyFromVerifying as h, buildGroupParticipants as i, parseEnvelopeUr as l, resolveSenderName as m, isVerbose as n, formatNameWithOwnerMarker as o, resolveSender as p, setVerbose as r, groupParticipantFromRegistry as s, groupStateDir as t, participantNamesFromRegistry as u };
281
281
 
282
- //# sourceMappingURL=common-Cf1UvJaP.mjs.map
282
+ //# sourceMappingURL=common-4spC1kNw.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-Cf1UvJaP.mjs","names":[],"sources":["../src/cmd/dkg/common.ts","../src/cmd/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for DKG commands.\n *\n * Port of cmd/dkg/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nimport { type ARID, type XID } from \"@bcts/components\";\nimport { compareXidBytes } from \"../../dkg/proposed-participant.js\";\nimport { type Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { type XIDDocument } from \"@bcts/xid\";\n\nimport {\n GroupParticipant,\n type OwnerRecord,\n type ParticipantRecord,\n type Registry,\n} from \"../../registry/index.js\";\n\n// Re-export cross-cutting utilities for convenience\nexport { groupStateDir } from \"../common.js\";\n\n/**\n * Parse an ARID from a UR string.\n *\n * Mirrors Rust `parse_arid_ur` (`cmd/common.rs:27-43`):\n *\n * 1. Trim and reject empty input.\n * 2. Parse as a UR; require `ur_type` of `\"arid\"`.\n * 3. Try `ARID::try_from(cbor)` (the tagged-CBOR form).\n * 4. If that fails, fall back to interpreting the CBOR as a bare\n * byte string and constructing the ARID from those bytes via\n * `ARID::from_data_ref`.\n *\n * The earlier port only accepted the tagged form; this matches Rust\n * by accepting the byte-string fallback too.\n */\nexport function parseAridUr(urString: string): ARID {\n const trimmed = urString.trim();\n if (trimmed.length === 0) {\n throw new Error(\"ARID is required\");\n }\n const ur = UR.fromURString(trimmed);\n\n if (ur.urTypeStr() !== \"arid\") {\n throw new Error(`Expected a ur:arid, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { ARID: ARIDClass } = require(\"@bcts/components\");\n const cbor = ur.cbor();\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromTaggedCbor(cbor);\n } catch {\n // Fall back to a bare byte string payload, mirroring Rust's\n // `CBOR::try_into_byte_string(cbor) → ARID::from_data_ref(bytes)`.\n const bytes = (cbor as { asByteString(): Uint8Array | undefined }).asByteString?.();\n if (bytes === undefined) {\n throw new Error(\"Invalid ARID payload\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromData(bytes);\n }\n}\n\n/**\n * Parse an envelope from a UR string.\n *\n * Port of `parse_envelope_ur()` from cmd/dkg/common.rs.\n */\nexport function parseEnvelopeUr(urString: string): Envelope {\n const ur = UR.fromURString(urString.trim());\n\n if (ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected ur:envelope, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { Envelope: EnvelopeClass } = require(\"@bcts/envelope\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return EnvelopeClass.fromCbor(ur.cbor());\n}\n\n/**\n * Resolve the registry owner's XID document.\n *\n * The earlier port called this `resolveSender(registry)`, but its\n * behaviour — \"give me the owner\" — has nothing in common with Rust's\n * `resolve_sender(registry, input)` (which resolves an arbitrary\n * named sender). This helper is renamed to its actual behaviour;\n * the Rust-equivalent `resolveSender(registry, input)` lives below.\n */\nexport function resolveOwnerXidDocument(registry: Registry): XIDDocument {\n const owner = registry.owner();\n\n if (!owner) {\n throw new Error(\"No owner set in registry. Run 'registry owner set' first.\");\n }\n\n return owner.xidDocument();\n}\n\n/**\n * Resolve a sender XID document from the registry by UR or pet name.\n *\n * Mirrors Rust `resolve_sender(registry, input)`\n * (`cmd/dkg/common.rs:76-94`):\n *\n * 1. Trim and reject empty input.\n * 2. Try parsing the input as a `ur:xid`. If that succeeds, look it\n * up via `registry.participant(xid)`; if no record is found,\n * error with `Sender with XID {ur} not found`.\n * 3. Otherwise look it up by pet name via\n * `registry.participantByPetName(name)`; if no record is found,\n * error with `Sender with pet name '{name}' not found`.\n *\n * Note Rust does NOT check the owner here — only the participants\n * map. The earlier inline duplicate in `participant/round1.ts` did\n * an extra owner-check fallback which is removed to match Rust.\n */\nexport function resolveSender(registry: Registry, input: string): XIDDocument {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"Sender is required\");\n }\n\n // Try parsing as an XID UR string first. `XID.fromURString` throws\n // when the input isn't a `ur:xid`; that's the signal to fall back\n // to pet-name lookup.\n let xid: XID | undefined;\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n } catch {\n xid = undefined;\n }\n\n if (xid !== undefined) {\n const record = registry.participant(xid);\n if (record !== undefined) {\n return record.xidDocument();\n }\n throw new Error(`Sender with XID ${xid.urString()} not found`);\n }\n\n const result = registry.participantByPetName(trimmed);\n if (result !== undefined) {\n const [, record] = result;\n return record.xidDocument();\n }\n throw new Error(`Sender with pet name '${trimmed}' not found`);\n}\n\n// -----------------------------------------------------------------------------\n// Participant resolution\n// -----------------------------------------------------------------------------\n\n/**\n * Resolve participant identifiers (XID URs or pet names) to records.\n *\n * Port of `resolve_participants()` from cmd/dkg/common.rs lines 29-74.\n */\nexport function resolveParticipants(\n registry: Registry,\n inputs: string[],\n): [XID, ParticipantRecord][] {\n const seenArgs = new Set<string>();\n const seenXids = new Set<string>();\n const resolved: [XID, ParticipantRecord][] = [];\n\n for (const raw of inputs) {\n const trimmed = raw.trim();\n if (trimmed === \"\") {\n throw new Error(\"Participant identifier cannot be empty\");\n }\n if (seenArgs.has(trimmed)) {\n throw new Error(`Duplicate participant argument: ${trimmed}`);\n }\n seenArgs.add(trimmed);\n\n let xid: XID;\n let record: ParticipantRecord;\n\n // Try parsing as XID UR first\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n\n const foundRecord = registry.participant(xid);\n if (!foundRecord) {\n throw new Error(`Participant with XID ${xid.urString()} not found in registry`);\n }\n record = foundRecord;\n } catch {\n // Try looking up by pet name\n const result = registry.participantByPetName(trimmed);\n if (!result) {\n throw new Error(`Participant with pet name '${trimmed}' not found`);\n }\n [xid, record] = result;\n }\n\n const xidUr = xid.urString();\n if (seenXids.has(xidUr)) {\n throw new Error(`Duplicate participant specified; multiple inputs resolve to ${xidUr}`);\n }\n seenXids.add(xidUr);\n\n resolved.push([xid, record]);\n }\n\n return resolved;\n}\n\n/**\n * Get display name for sender from registry.\n *\n * Port of `resolve_sender_name()` from cmd/dkg/common.rs lines 96-116.\n */\nexport function resolveSenderName(registry: Registry, sender: XIDDocument): string | undefined {\n const owner = registry.owner();\n const senderXid = sender.xid();\n\n // Check if sender is the owner\n if (owner?.xidDocument().xid().urString() === senderXid.urString()) {\n const name = owner.petName() ?? senderXid.urString();\n return formatNameWithOwnerMarker(name, true);\n }\n\n // Look up in participants\n const record = registry.participant(senderXid);\n if (record) {\n const name = record.petName() ?? record.xid().urString();\n return formatNameWithOwnerMarker(name, false);\n }\n\n return undefined;\n}\n\n// -----------------------------------------------------------------------------\n// Group participant building\n// -----------------------------------------------------------------------------\n\n/**\n * Build GroupParticipant[] from XIDDocuments using registry lookups.\n *\n * Port of `build_group_participants()` from cmd/dkg/common.rs lines 122-131.\n */\nexport function buildGroupParticipants(\n registry: Registry,\n owner: OwnerRecord,\n participants: XIDDocument[],\n): GroupParticipant[] {\n return participants.map((doc) => groupParticipantFromRegistry(registry, owner, doc));\n}\n\n/**\n * Create a GroupParticipant from a XIDDocument, validating against the registry.\n *\n * Port of `group_participant_from_registry()` from cmd/dkg/common.rs lines 133-149.\n */\nexport function groupParticipantFromRegistry(\n registry: Registry,\n owner: OwnerRecord,\n document: XIDDocument,\n): GroupParticipant {\n const xid = document.xid();\n\n // If the document is the owner, allow it\n if (xid.urString() === owner.xid().urString()) {\n return new GroupParticipant(xid);\n }\n\n // Otherwise, verify the participant is in the registry\n if (!registry.participant(xid)) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n\n return new GroupParticipant(xid);\n}\n\n// -----------------------------------------------------------------------------\n// Name formatting\n// -----------------------------------------------------------------------------\n\n/**\n * Format a participant name with owner marker if applicable.\n *\n * Port of `format_name_with_owner_marker()` from cmd/dkg/common.rs lines 155-157.\n */\nexport function formatNameWithOwnerMarker(name: string, isOwner: boolean): string {\n return isOwner ? `* ${name}` : name;\n}\n\n/**\n * Get display names for participants, sorted by XID, with owner marked.\n *\n * Port of `participant_names_from_registry()` from cmd/dkg/common.rs lines 159-191.\n */\nexport function participantNamesFromRegistry(\n registry: Registry,\n participants: XIDDocument[],\n ownerXid: XID,\n ownerPetName: string | undefined,\n): string[] {\n // Sort by XID byte order — mirrors Rust `XID::cmp` (raw 32-byte\n // lex compare). The earlier port used\n // `urString().localeCompare(...)`, which diverges from byte order\n // for bytes ≥ 0x80 and is locale-aware.\n const sorted = [...participants].sort((a, b) =>\n compareXidBytes(a.xid().toData(), b.xid().toData()),\n );\n\n return sorted.map((document) => {\n const xid = document.xid();\n const isOwner = xid.urString() === ownerXid.urString();\n\n let name: string;\n if (isOwner) {\n name = ownerPetName ?? xid.urString();\n } else {\n const record = registry.participant(xid);\n if (!record) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n name = record.petName() ?? xid.urString();\n }\n\n return formatNameWithOwnerMarker(name, isOwner);\n });\n}\n\n/**\n * Get the DKG state directory for a given registry path and group ID.\n *\n * Port of `dkg_state_dir()` from cmd/dkg/common.rs.\n */\nexport function dkgStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex, \"dkg\");\n}\n\n/**\n * Convert a verifying key bytes to a SigningPublicKey.\n *\n * Port of `signing_key_from_verifying()` from cmd/dkg/common.rs.\n */\nexport function signingKeyFromVerifying(verifyingKeyBytes: Uint8Array): unknown {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { SigningPublicKey: SigningPublicKeyClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return SigningPublicKeyClass.fromBytes(verifyingKeyBytes);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for commands.\n *\n * Port of `cmd/common.rs` from `frost-hubert-rust`.\n *\n * Rust's `cmd::common` exports four cross-cutting helpers used by\n * both the DKG and signing subcommand trees:\n *\n * - `parse_arid_ur` / `signing_key_from_verifying` — re-exported\n * here so the TS module layout matches Rust. The implementations\n * live alongside their other DKG-specific siblings in\n * `cmd/dkg/common.ts` so callers in either tree can keep using\n * them; this file just surfaces them at the parallel-to-Rust\n * import path (`@bcts/frost-hubert/cmd/common`).\n * - `group_state_dir` and the verbose-flag helpers are TS-native here.\n *\n * `OptionalStorageSelector` is intentionally not ported: it's a\n * `clap`-specific argument struct and the TS port surfaces the same\n * effect via the `StorageSelection` string-literal union — see the\n * `parity audit` for context.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nexport { parseAridUr, signingKeyFromVerifying } from \"./dkg/common.js\";\n\n/**\n * Get the group state directory for a given registry path and group ID.\n *\n * Port of `group_state_dir()` from cmd/common.rs.\n */\nexport function groupStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex);\n}\n\n/**\n * Global verbose flag.\n */\nlet verboseFlag = false;\n\n/**\n * Set the verbose flag.\n */\nexport function setVerbose(value: boolean): void {\n verboseFlag = value;\n}\n\n/**\n * Check if verbose mode is enabled.\n *\n * Port of `is_verbose()` from cmd/common.rs.\n */\nexport function isVerbose(): boolean {\n return verboseFlag;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,YAAY,UAAwB;CAClD,MAAM,UAAU,SAAS,KAAK;CAC9B,IAAI,QAAQ,WAAW,GACrB,MAAM,IAAI,MAAM,kBAAkB;CAEpC,MAAM,KAAK,GAAG,aAAa,OAAO;CAElC,IAAI,GAAG,UAAU,MAAM,QACrB,MAAM,IAAI,MAAM,gCAAgC,GAAG,UAAU,GAAG;CAIlE,MAAM,EAAE,MAAM,cAAA,UAAsB,kBAAkB;CACtD,MAAM,OAAO,GAAG,KAAK;CACrB,IAAI;EAEF,OAAO,UAAU,eAAe,IAAI;CACtC,QAAQ;EAGN,MAAM,QAAS,KAAoD,eAAe;EAClF,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,MAAM,sBAAsB;EAGxC,OAAO,UAAU,SAAS,KAAK;CACjC;AACF;;;;;;AAOA,SAAgB,gBAAgB,UAA4B;CAC1D,MAAM,KAAK,GAAG,aAAa,SAAS,KAAK,CAAC;CAE1C,IAAI,GAAG,UAAU,MAAM,YACrB,MAAM,IAAI,MAAM,kCAAkC,GAAG,UAAU,GAAG;CAIpE,MAAM,EAAE,UAAU,kBAAA,UAA0B,gBAAgB;CAE5D,OAAO,cAAc,SAAS,GAAG,KAAK,CAAC;AACzC;;;;;;;;;;AAWA,SAAgB,wBAAwB,UAAiC;CACvE,MAAM,QAAQ,SAAS,MAAM;CAE7B,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,2DAA2D;CAG7E,OAAO,MAAM,YAAY;AAC3B;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,cAAc,UAAoB,OAA4B;CAC5E,MAAM,UAAU,MAAM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AE,OAAO,CAAC,CAGxC,EAAE,KAAK,aAAa;EAC9B,MAAM,MAAM,SAAS,IAAI;EACzB,MAAM,UAAU,IAAI,SAAS,MAAM,SAAS,SAAS;EAErD,IAAI;EACJ,IAAI,SACF,OAAO,gBAAgB,IAAI,SAAS;OAC/B;GACL,MAAM,SAAS,SAAS,YAAY,GAAG;GACvC,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,6CAA6C,IAAI,SAAS,GAAG;GAE/E,OAAO,OAAO,QAAQ,KAAK,IAAI,SAAS;EAC1C;EAEA,OAAO,0BAA0B,MAAM,OAAO;CAChD,CAAC;AACH;;;;;;AAOA,SAAgB,YAAY,cAAsB,YAA4B;CAC5E,MAAM,OAAO,KAAK,QAAQ,YAAY;CACtC,OAAO,KAAK,KAAK,MAAM,eAAe,YAAY,KAAK;AACzD;;;;;;AAOA,SAAgB,wBAAwB,mBAAwC;CAE9E,MAAM,EAAE,kBAAkB,0BAAA,UAAkC,kBAAkB;CAE9E,OAAO,sBAAsB,UAAU,iBAAiB;AAC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxUA,SAAgB,cAAc,cAAsB,YAA4B;CAC9E,MAAM,OAAO,KAAK,QAAQ,YAAY;CACtC,OAAO,KAAK,KAAK,MAAM,eAAe,UAAU;AAClD;;;;AAKA,IAAI,cAAc;;;;AAKlB,SAAgB,WAAW,OAAsB;CAC/C,cAAc;AAChB;;;;;;AAOA,SAAgB,YAAqB;CACnC,OAAO;AACT"}
1
+ {"version":3,"file":"common-4spC1kNw.mjs","names":[],"sources":["../src/cmd/dkg/common.ts","../src/cmd/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for DKG commands.\n *\n * Port of cmd/dkg/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nimport { type ARID, type XID } from \"@bcts/components\";\nimport { compareXidBytes } from \"../../dkg/proposed-participant.js\";\nimport { type Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { type XIDDocument } from \"@bcts/xid\";\n\nimport {\n GroupParticipant,\n type OwnerRecord,\n type ParticipantRecord,\n type Registry,\n} from \"../../registry/index.js\";\n\n// Re-export cross-cutting utilities for convenience\nexport { groupStateDir } from \"../common.js\";\n\n/**\n * Parse an ARID from a UR string.\n *\n * Mirrors Rust `parse_arid_ur` (`cmd/common.rs:27-43`):\n *\n * 1. Trim and reject empty input.\n * 2. Parse as a UR; require `ur_type` of `\"arid\"`.\n * 3. Try `ARID::try_from(cbor)` (the tagged-CBOR form).\n * 4. If that fails, fall back to interpreting the CBOR as a bare\n * byte string and constructing the ARID from those bytes via\n * `ARID::from_data_ref`.\n *\n * The earlier port only accepted the tagged form; this matches Rust\n * by accepting the byte-string fallback too.\n */\nexport function parseAridUr(urString: string): ARID {\n const trimmed = urString.trim();\n if (trimmed.length === 0) {\n throw new Error(\"ARID is required\");\n }\n const ur = UR.fromURString(trimmed);\n\n if (ur.urTypeStr() !== \"arid\") {\n throw new Error(`Expected a ur:arid, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { ARID: ARIDClass } = require(\"@bcts/components\");\n const cbor = ur.cbor();\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromTaggedCbor(cbor);\n } catch {\n // Fall back to a bare byte string payload, mirroring Rust's\n // `CBOR::try_into_byte_string(cbor) → ARID::from_data_ref(bytes)`.\n const bytes = (cbor as { asByteString(): Uint8Array | undefined }).asByteString?.();\n if (bytes === undefined) {\n throw new Error(\"Invalid ARID payload\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return ARIDClass.fromData(bytes);\n }\n}\n\n/**\n * Parse an envelope from a UR string.\n *\n * Port of `parse_envelope_ur()` from cmd/dkg/common.rs.\n */\nexport function parseEnvelopeUr(urString: string): Envelope {\n const ur = UR.fromURString(urString.trim());\n\n if (ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected ur:envelope, found ur:${ur.urTypeStr()}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { Envelope: EnvelopeClass } = require(\"@bcts/envelope\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return EnvelopeClass.fromCbor(ur.cbor());\n}\n\n/**\n * Resolve the registry owner's XID document.\n *\n * The earlier port called this `resolveSender(registry)`, but its\n * behaviour — \"give me the owner\" — has nothing in common with Rust's\n * `resolve_sender(registry, input)` (which resolves an arbitrary\n * named sender). This helper is renamed to its actual behaviour;\n * the Rust-equivalent `resolveSender(registry, input)` lives below.\n */\nexport function resolveOwnerXidDocument(registry: Registry): XIDDocument {\n const owner = registry.owner();\n\n if (!owner) {\n throw new Error(\"No owner set in registry. Run 'registry owner set' first.\");\n }\n\n return owner.xidDocument();\n}\n\n/**\n * Resolve a sender XID document from the registry by UR or pet name.\n *\n * Mirrors Rust `resolve_sender(registry, input)`\n * (`cmd/dkg/common.rs:76-94`):\n *\n * 1. Trim and reject empty input.\n * 2. Try parsing the input as a `ur:xid`. If that succeeds, look it\n * up via `registry.participant(xid)`; if no record is found,\n * error with `Sender with XID {ur} not found`.\n * 3. Otherwise look it up by pet name via\n * `registry.participantByPetName(name)`; if no record is found,\n * error with `Sender with pet name '{name}' not found`.\n *\n * Note Rust does NOT check the owner here — only the participants\n * map. The earlier inline duplicate in `participant/round1.ts` did\n * an extra owner-check fallback which is removed to match Rust.\n */\nexport function resolveSender(registry: Registry, input: string): XIDDocument {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"Sender is required\");\n }\n\n // Try parsing as an XID UR string first. `XID.fromURString` throws\n // when the input isn't a `ur:xid`; that's the signal to fall back\n // to pet-name lookup.\n let xid: XID | undefined;\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n } catch {\n xid = undefined;\n }\n\n if (xid !== undefined) {\n const record = registry.participant(xid);\n if (record !== undefined) {\n return record.xidDocument();\n }\n throw new Error(`Sender with XID ${xid.urString()} not found`);\n }\n\n const result = registry.participantByPetName(trimmed);\n if (result !== undefined) {\n const [, record] = result;\n return record.xidDocument();\n }\n throw new Error(`Sender with pet name '${trimmed}' not found`);\n}\n\n// -----------------------------------------------------------------------------\n// Participant resolution\n// -----------------------------------------------------------------------------\n\n/**\n * Resolve participant identifiers (XID URs or pet names) to records.\n *\n * Port of `resolve_participants()` from cmd/dkg/common.rs lines 29-74.\n */\nexport function resolveParticipants(\n registry: Registry,\n inputs: string[],\n): [XID, ParticipantRecord][] {\n const seenArgs = new Set<string>();\n const seenXids = new Set<string>();\n const resolved: [XID, ParticipantRecord][] = [];\n\n for (const raw of inputs) {\n const trimmed = raw.trim();\n if (trimmed === \"\") {\n throw new Error(\"Participant identifier cannot be empty\");\n }\n if (seenArgs.has(trimmed)) {\n throw new Error(`Duplicate participant argument: ${trimmed}`);\n }\n seenArgs.add(trimmed);\n\n let xid: XID;\n let record: ParticipantRecord;\n\n // Try parsing as XID UR first\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { XID: XIDClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n xid = XIDClass.fromURString(trimmed) as XID;\n\n const foundRecord = registry.participant(xid);\n if (!foundRecord) {\n throw new Error(`Participant with XID ${xid.urString()} not found in registry`);\n }\n record = foundRecord;\n } catch {\n // Try looking up by pet name\n const result = registry.participantByPetName(trimmed);\n if (!result) {\n throw new Error(`Participant with pet name '${trimmed}' not found`);\n }\n [xid, record] = result;\n }\n\n const xidUr = xid.urString();\n if (seenXids.has(xidUr)) {\n throw new Error(`Duplicate participant specified; multiple inputs resolve to ${xidUr}`);\n }\n seenXids.add(xidUr);\n\n resolved.push([xid, record]);\n }\n\n return resolved;\n}\n\n/**\n * Get display name for sender from registry.\n *\n * Port of `resolve_sender_name()` from cmd/dkg/common.rs lines 96-116.\n */\nexport function resolveSenderName(registry: Registry, sender: XIDDocument): string | undefined {\n const owner = registry.owner();\n const senderXid = sender.xid();\n\n // Check if sender is the owner\n if (owner?.xidDocument().xid().urString() === senderXid.urString()) {\n const name = owner.petName() ?? senderXid.urString();\n return formatNameWithOwnerMarker(name, true);\n }\n\n // Look up in participants\n const record = registry.participant(senderXid);\n if (record) {\n const name = record.petName() ?? record.xid().urString();\n return formatNameWithOwnerMarker(name, false);\n }\n\n return undefined;\n}\n\n// -----------------------------------------------------------------------------\n// Group participant building\n// -----------------------------------------------------------------------------\n\n/**\n * Build GroupParticipant[] from XIDDocuments using registry lookups.\n *\n * Port of `build_group_participants()` from cmd/dkg/common.rs lines 122-131.\n */\nexport function buildGroupParticipants(\n registry: Registry,\n owner: OwnerRecord,\n participants: XIDDocument[],\n): GroupParticipant[] {\n return participants.map((doc) => groupParticipantFromRegistry(registry, owner, doc));\n}\n\n/**\n * Create a GroupParticipant from a XIDDocument, validating against the registry.\n *\n * Port of `group_participant_from_registry()` from cmd/dkg/common.rs lines 133-149.\n */\nexport function groupParticipantFromRegistry(\n registry: Registry,\n owner: OwnerRecord,\n document: XIDDocument,\n): GroupParticipant {\n const xid = document.xid();\n\n // If the document is the owner, allow it\n if (xid.urString() === owner.xid().urString()) {\n return new GroupParticipant(xid);\n }\n\n // Otherwise, verify the participant is in the registry\n if (!registry.participant(xid)) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n\n return new GroupParticipant(xid);\n}\n\n// -----------------------------------------------------------------------------\n// Name formatting\n// -----------------------------------------------------------------------------\n\n/**\n * Format a participant name with owner marker if applicable.\n *\n * Port of `format_name_with_owner_marker()` from cmd/dkg/common.rs lines 155-157.\n */\nexport function formatNameWithOwnerMarker(name: string, isOwner: boolean): string {\n return isOwner ? `* ${name}` : name;\n}\n\n/**\n * Get display names for participants, sorted by XID, with owner marked.\n *\n * Port of `participant_names_from_registry()` from cmd/dkg/common.rs lines 159-191.\n */\nexport function participantNamesFromRegistry(\n registry: Registry,\n participants: XIDDocument[],\n ownerXid: XID,\n ownerPetName: string | undefined,\n): string[] {\n // Sort by XID byte order — mirrors Rust `XID::cmp` (raw 32-byte\n // lex compare). The earlier port used\n // `urString().localeCompare(...)`, which diverges from byte order\n // for bytes ≥ 0x80 and is locale-aware.\n const sorted = [...participants].sort((a, b) =>\n compareXidBytes(a.xid().toData(), b.xid().toData()),\n );\n\n return sorted.map((document) => {\n const xid = document.xid();\n const isOwner = xid.urString() === ownerXid.urString();\n\n let name: string;\n if (isOwner) {\n name = ownerPetName ?? xid.urString();\n } else {\n const record = registry.participant(xid);\n if (!record) {\n throw new Error(`Invite participant not found in registry: ${xid.urString()}`);\n }\n name = record.petName() ?? xid.urString();\n }\n\n return formatNameWithOwnerMarker(name, isOwner);\n });\n}\n\n/**\n * Get the DKG state directory for a given registry path and group ID.\n *\n * Port of `dkg_state_dir()` from cmd/dkg/common.rs.\n */\nexport function dkgStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex, \"dkg\");\n}\n\n/**\n * Convert a verifying key bytes to a SigningPublicKey.\n *\n * Port of `signing_key_from_verifying()` from cmd/dkg/common.rs.\n */\nexport function signingKeyFromVerifying(verifyingKeyBytes: Uint8Array): unknown {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports, no-undef\n const { SigningPublicKey: SigningPublicKeyClass } = require(\"@bcts/components\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return SigningPublicKeyClass.fromBytes(verifyingKeyBytes);\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for commands.\n *\n * Port of `cmd/common.rs` from `frost-hubert-rust`.\n *\n * Rust's `cmd::common` exports four cross-cutting helpers used by\n * both the DKG and signing subcommand trees:\n *\n * - `parse_arid_ur` / `signing_key_from_verifying` — re-exported\n * here so the TS module layout matches Rust. The implementations\n * live alongside their other DKG-specific siblings in\n * `cmd/dkg/common.ts` so callers in either tree can keep using\n * them; this file just surfaces them at the parallel-to-Rust\n * import path (`@bcts/frost-hubert/cmd/common`).\n * - `group_state_dir` and the verbose-flag helpers are TS-native here.\n *\n * `OptionalStorageSelector` is intentionally not ported: it's a\n * `clap`-specific argument struct and the TS port surfaces the same\n * effect via the `StorageSelection` string-literal union — see the\n * `parity audit` for context.\n *\n * @module\n */\n\nimport * as path from \"node:path\";\n\nexport { parseAridUr, signingKeyFromVerifying } from \"./dkg/common.js\";\n\n/**\n * Get the group state directory for a given registry path and group ID.\n *\n * Port of `group_state_dir()` from cmd/common.rs.\n */\nexport function groupStateDir(registryPath: string, groupIdHex: string): string {\n const base = path.dirname(registryPath);\n return path.join(base, \"group-state\", groupIdHex);\n}\n\n/**\n * Global verbose flag.\n */\nlet verboseFlag = false;\n\n/**\n * Set the verbose flag.\n */\nexport function setVerbose(value: boolean): void {\n verboseFlag = value;\n}\n\n/**\n * Check if verbose mode is enabled.\n *\n * Port of `is_verbose()` from cmd/common.rs.\n */\nexport function isVerbose(): boolean {\n return verboseFlag;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,YAAY,UAAwB;CAClD,MAAM,UAAU,SAAS,KAAK;CAC9B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MAAM,6CAA6C,IAAI,SAAS,GAAG;GAE/E,OAAO,OAAO,QAAQ,KAAK,IAAI,SAAS;EAC1C;EAEA,OAAO,0BAA0B,MAAM,OAAO;CAChD,CAAC;AACH;;;;;;AAOA,SAAgB,YAAY,cAAsB,YAA4B;CAC5E,MAAM,OAAO,KAAK,QAAQ,YAAY;CACtC,OAAO,KAAK,KAAK,MAAM,eAAe,YAAY,KAAK;AACzD;;;;;;AAOA,SAAgB,wBAAwB,mBAAwC;CAE9E,MAAM,EAAE,kBAAkB,0BAAA,UAAkC,kBAAkB;CAE9E,OAAO,sBAAsB,UAAU,iBAAiB;AAC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxUA,SAAgB,cAAc,cAAsB,YAA4B;CAC9E,MAAM,OAAO,KAAK,QAAQ,YAAY;CACtC,OAAO,KAAK,KAAK,MAAM,eAAe,UAAU;AAClD;;;;AAKA,IAAI,cAAc;;;;AAKlB,SAAgB,WAAW,OAAsB;CAC/C,cAAc;AAChB;;;;;;AAOA,SAAgB,YAAqB;CACnC,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- const require_common = require("./common-CnvAUC2b.cjs");
1
+ const require_common = require("./common-3msAx7hO.cjs");
2
2
  let _bcts_envelope = require("@bcts/envelope");
3
3
  //#region src/cmd/sign/common.ts
4
4
  /**
@@ -110,4 +110,4 @@ Object.defineProperty(exports, "signingStateDirForGroup", {
110
110
  }
111
111
  });
112
112
 
113
- //# sourceMappingURL=common-7-BOgaTt.cjs.map
113
+ //# sourceMappingURL=common-CeTqMwj0.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-7-BOgaTt.cjs","names":["groupStateDir","Envelope"],"sources":["../src/cmd/sign/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for sign commands.\n *\n * Port of cmd/sign/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { Envelope, type EnvelopeEncodableValue } from \"@bcts/envelope\";\n\nimport { groupStateDir } from \"../common\";\n\n/**\n * Get the signing state directory for a group (without session).\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing`\n *\n * Port of `signing_state_dir_for_group()` from cmd/sign/common.rs.\n */\nexport function signingStateDirForGroup(registryPath: string, groupIdHex: string): string {\n return `${groupStateDir(registryPath, groupIdHex)}/signing`;\n}\n\n/**\n * Get the signing state directory for a given registry path, group ID, and session ID.\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing/{session_id.hex()}`\n *\n * Port of `signing_state_dir()` from cmd/sign/common.rs.\n */\nexport function signingStateDir(\n registryPath: string,\n groupIdHex: string,\n sessionIdHex: string,\n): string {\n return `${signingStateDirForGroup(registryPath, groupIdHex)}/${sessionIdHex}`;\n}\n\n/**\n * Content wrapper for signFinalize events.\n *\n * This wraps an envelope with a unit subject and type assertion\n * \"signFinalize\", implementing the traits required by SealedEvent<T>.\n *\n * Port of `struct SignFinalizeContent` from cmd/sign/common.rs.\n */\nexport class SignFinalizeContent {\n private readonly _envelope: Envelope;\n\n private constructor(envelope: Envelope) {\n this._envelope = envelope;\n }\n\n /**\n * Creates a new SignFinalizeContent with a unit subject and type assertion.\n *\n * Port of `SignFinalizeContent::new()` from cmd/sign/common.rs.\n */\n static new(): SignFinalizeContent {\n const envelope = Envelope.unit().addType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Adds an assertion to the content envelope.\n *\n * Port of `SignFinalizeContent::add_assertion()` from cmd/sign/common.rs.\n */\n addAssertion(\n predicate: EnvelopeEncodableValue,\n object: EnvelopeEncodableValue,\n ): SignFinalizeContent {\n const newEnvelope = this._envelope.addAssertion(predicate, object);\n return new SignFinalizeContent(newEnvelope);\n }\n\n /**\n * Returns the inner envelope.\n *\n * Port of `SignFinalizeContent::envelope()` from cmd/sign/common.rs.\n */\n envelope(): Envelope {\n return this._envelope;\n }\n\n /**\n * Creates a SignFinalizeContent from an envelope with validation.\n *\n * Validates that the envelope has a unit subject and type \"signFinalize\".\n *\n * Port of `TryFrom<Envelope> for SignFinalizeContent` from cmd/sign/common.rs.\n */\n static fromEnvelope(envelope: Envelope): SignFinalizeContent {\n // Validate it has a unit subject and type \"signFinalize\"\n envelope.checkSubjectUnit();\n envelope.checkType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Converts this SignFinalizeContent to an Envelope.\n *\n * Port of `From<SignFinalizeContent> for Envelope` from cmd/sign/common.rs.\n */\n toEnvelope(): Envelope {\n return this._envelope;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,wBAAwB,cAAsB,YAA4B;CACxF,OAAO,GAAGA,eAAAA,cAAc,cAAc,UAAU,EAAE;AACpD;;;;;;;;AASA,SAAgB,gBACd,cACA,YACA,cACQ;CACR,OAAO,GAAG,wBAAwB,cAAc,UAAU,EAAE,GAAG;AACjE;;;;;;;;;AAUA,IAAa,sBAAb,MAAa,oBAAoB;CAC/B;CAEA,YAAoB,UAAoB;EACtC,KAAK,YAAY;CACnB;;;;;;CAOA,OAAO,MAA2B;EAEhC,OAAO,IAAI,oBADMC,eAAAA,SAAS,KAAK,EAAE,QAAQ,cACH,CAAC;CACzC;;;;;;CAOA,aACE,WACA,QACqB;EAErB,OAAO,IAAI,oBADS,KAAK,UAAU,aAAa,WAAW,MAClB,CAAC;CAC5C;;;;;;CAOA,WAAqB;EACnB,OAAO,KAAK;CACd;;;;;;;;CASA,OAAO,aAAa,UAAyC;EAE3D,SAAS,iBAAiB;EAC1B,SAAS,UAAU,cAAc;EACjC,OAAO,IAAI,oBAAoB,QAAQ;CACzC;;;;;;CAOA,aAAuB;EACrB,OAAO,KAAK;CACd;AACF"}
1
+ {"version":3,"file":"common-CeTqMwj0.cjs","names":["groupStateDir","Envelope"],"sources":["../src/cmd/sign/common.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Common utilities for sign commands.\n *\n * Port of cmd/sign/common.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { Envelope, type EnvelopeEncodableValue } from \"@bcts/envelope\";\n\nimport { groupStateDir } from \"../common\";\n\n/**\n * Get the signing state directory for a group (without session).\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing`\n *\n * Port of `signing_state_dir_for_group()` from cmd/sign/common.rs.\n */\nexport function signingStateDirForGroup(registryPath: string, groupIdHex: string): string {\n return `${groupStateDir(registryPath, groupIdHex)}/signing`;\n}\n\n/**\n * Get the signing state directory for a given registry path, group ID, and session ID.\n *\n * Path: `{registry_dir}/group-state/{group_id.hex()}/signing/{session_id.hex()}`\n *\n * Port of `signing_state_dir()` from cmd/sign/common.rs.\n */\nexport function signingStateDir(\n registryPath: string,\n groupIdHex: string,\n sessionIdHex: string,\n): string {\n return `${signingStateDirForGroup(registryPath, groupIdHex)}/${sessionIdHex}`;\n}\n\n/**\n * Content wrapper for signFinalize events.\n *\n * This wraps an envelope with a unit subject and type assertion\n * \"signFinalize\", implementing the traits required by SealedEvent<T>.\n *\n * Port of `struct SignFinalizeContent` from cmd/sign/common.rs.\n */\nexport class SignFinalizeContent {\n private readonly _envelope: Envelope;\n\n private constructor(envelope: Envelope) {\n this._envelope = envelope;\n }\n\n /**\n * Creates a new SignFinalizeContent with a unit subject and type assertion.\n *\n * Port of `SignFinalizeContent::new()` from cmd/sign/common.rs.\n */\n static new(): SignFinalizeContent {\n const envelope = Envelope.unit().addType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Adds an assertion to the content envelope.\n *\n * Port of `SignFinalizeContent::add_assertion()` from cmd/sign/common.rs.\n */\n addAssertion(\n predicate: EnvelopeEncodableValue,\n object: EnvelopeEncodableValue,\n ): SignFinalizeContent {\n const newEnvelope = this._envelope.addAssertion(predicate, object);\n return new SignFinalizeContent(newEnvelope);\n }\n\n /**\n * Returns the inner envelope.\n *\n * Port of `SignFinalizeContent::envelope()` from cmd/sign/common.rs.\n */\n envelope(): Envelope {\n return this._envelope;\n }\n\n /**\n * Creates a SignFinalizeContent from an envelope with validation.\n *\n * Validates that the envelope has a unit subject and type \"signFinalize\".\n *\n * Port of `TryFrom<Envelope> for SignFinalizeContent` from cmd/sign/common.rs.\n */\n static fromEnvelope(envelope: Envelope): SignFinalizeContent {\n // Validate it has a unit subject and type \"signFinalize\"\n envelope.checkSubjectUnit();\n envelope.checkType(\"signFinalize\");\n return new SignFinalizeContent(envelope);\n }\n\n /**\n * Converts this SignFinalizeContent to an Envelope.\n *\n * Port of `From<SignFinalizeContent> for Envelope` from cmd/sign/common.rs.\n */\n toEnvelope(): Envelope {\n return this._envelope;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,wBAAwB,cAAsB,YAA4B;CACxF,OAAO,GAAGA,eAAAA,cAAc,cAAc,UAAU,EAAE;AACpD;;;;;;;;AASA,SAAgB,gBACd,cACA,YACA,cACQ;CACR,OAAO,GAAG,wBAAwB,cAAc,UAAU,EAAE,GAAG;AACjE;;;;;;;;;AAUA,IAAa,sBAAb,MAAa,oBAAoB;CAC/B;CAEA,YAAoB,UAAoB;EACtC,KAAK,YAAY;CACnB;;;;;;CAOA,OAAO,MAA2B;EAEhC,OAAO,IAAI,oBADMC,eAAAA,SAAS,KAAK,CAAC,CAAC,QAAQ,cACH,CAAC;CACzC;;;;;;CAOA,aACE,WACA,QACqB;EAErB,OAAO,IAAI,oBADS,KAAK,UAAU,aAAa,WAAW,MAClB,CAAC;CAC5C;;;;;;CAOA,WAAqB;EACnB,OAAO,KAAK;CACd;;;;;;;;CASA,OAAO,aAAa,UAAyC;EAE3D,SAAS,iBAAiB;EAC1B,SAAS,UAAU,cAAc;EACjC,OAAO,IAAI,oBAAoB,QAAQ;CACzC;;;;;;CAOA,aAAuB;EACrB,OAAO,KAAK;CACd;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["DkgProposedParticipant","SealedRequest","CborDate","Envelope","SealedResponse","EnvelopeFunction","XIDDocument","XIDVerifySignature","ARID"],"sources":["../../src/dkg/group-invite.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG Group Invite structures.\n *\n * Port of dkg/group_invite.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { ARID } from \"@bcts/components\";\nimport { CborDate } from \"@bcts/dcbor\";\nimport { Envelope, Function as EnvelopeFunction } from \"@bcts/envelope\";\nimport { SealedRequest, SealedResponse } from \"@bcts/gstp\";\nimport { XIDDocument, XIDVerifySignature } from \"@bcts/xid\";\n\nimport { DkgProposedParticipant } from \"./proposed-participant.js\";\n\n/**\n * Result of a DKG invitation.\n *\n * Port of `enum DkgInvitationResult` from group_invite.rs lines 170-173.\n */\nexport type DkgInvitationResult = { type: \"accepted\" } | { type: \"declined\"; reason: string };\n\n/**\n * Helper to create an accepted result.\n */\nexport function accepted(): DkgInvitationResult {\n return { type: \"accepted\" };\n}\n\n/**\n * Helper to create a declined result.\n */\nexport function declined(reason: string): DkgInvitationResult {\n return { type: \"declined\", reason };\n}\n\n/**\n * DKG Invite - represents an invitation to participate in a DKG session.\n *\n * Port of `struct DkgInvite` from group_invite.rs lines 11-27.\n */\nexport class DkgInvite {\n private readonly _requestId: ARID;\n private readonly _sender: XIDDocument;\n private readonly _groupId: ARID;\n private readonly _date: Date;\n private readonly _validUntil: Date;\n private readonly _minSigners: number;\n private readonly _charter: string;\n private readonly _orderedParticipants: DkgProposedParticipant[];\n\n private constructor(\n requestId: ARID,\n sender: XIDDocument,\n groupId: ARID,\n date: Date,\n validUntil: Date,\n minSigners: number,\n charter: string,\n orderedParticipants: DkgProposedParticipant[],\n ) {\n this._requestId = requestId;\n this._sender = sender;\n this._groupId = groupId;\n this._date = date;\n this._validUntil = validUntil;\n this._minSigners = minSigners;\n this._charter = charter;\n this._orderedParticipants = orderedParticipants;\n }\n\n /**\n * Create a new DKG invite.\n *\n * Port of `DkgInvite::new()` from group_invite.rs lines 30-67.\n */\n static create(\n requestId: ARID,\n sender: XIDDocument,\n groupId: ARID,\n date: Date,\n validUntil: Date,\n minSigners: number,\n charter: string,\n participants: string[],\n responseArids: ARID[],\n ): DkgInvite {\n if (participants.length !== responseArids.length) {\n throw new Error(\n `Number of participants (${participants.length}) does not match number of response ARIDs (${responseArids.length})`,\n );\n }\n\n if (minSigners < 2) {\n throw new Error(\"min_signers must be at least 2\");\n }\n\n const orderedParticipants = participants.map((urString, i) =>\n DkgProposedParticipant.create(urString, responseArids[i]),\n );\n\n if (minSigners > orderedParticipants.length) {\n throw new Error(\"min_signers cannot exceed number of participants\");\n }\n\n // Sort by XID\n orderedParticipants.sort((a, b) => a.compareTo(b));\n\n return new DkgInvite(\n requestId,\n sender,\n groupId,\n date,\n validUntil,\n minSigners,\n charter,\n orderedParticipants,\n );\n }\n\n requestId(): ARID {\n return this._requestId;\n }\n\n sender(): XIDDocument {\n return this._sender;\n }\n\n groupId(): ARID {\n return this._groupId;\n }\n\n date(): Date {\n return this._date;\n }\n\n validUntil(): Date {\n return this._validUntil;\n }\n\n minSigners(): number {\n return this._minSigners;\n }\n\n charter(): string {\n return this._charter;\n }\n\n participants(): DkgProposedParticipant[] {\n return this._orderedParticipants;\n }\n\n /**\n * Create a GSTP sealed request from this invite.\n *\n * Port of `DkgInvite::to_request()` from group_invite.rs lines 87-121.\n */\n toRequest(): SealedRequest {\n let request = SealedRequest.new(\"dkgInvite\", this.requestId(), this.sender())\n .withParameter(\"group\", this.groupId())\n .withParameter(\"minSigners\", BigInt(this.minSigners()))\n .withParameter(\"charter\", this.charter())\n .withDate(this.date())\n .withParameter(\"validUntil\", CborDate.fromDatetime(this.validUntil()));\n\n for (const participant of this.participants()) {\n const xidDocumentEnvelope = participant.xidDocumentEnvelope();\n const responseArid = participant.responseArid();\n const encryptionKey = participant.xidDocument().encryptionKey();\n\n if (encryptionKey === undefined) {\n throw new Error(\"Participant XID document has no encryption key\");\n }\n\n const encryptedResponseArid = Envelope.new(responseArid).encryptToRecipients([encryptionKey]);\n\n const participantEnvelope = xidDocumentEnvelope\n .wrap()\n .addAssertion(\"response_arid\", encryptedResponseArid);\n\n request = request.withParameter(\"participant\", participantEnvelope);\n }\n\n return request;\n }\n\n /**\n * Creates a signed but unencrypted envelope for auditing/preview.\n *\n * Port of `DkgInvite::to_unsealed_envelope()` from group_invite.rs lines 124-139.\n */\n toUnsealedEnvelope(): Envelope {\n const request = this.toRequest();\n const sender = this.sender();\n const signerPrivateKeys = sender.inceptionPrivateKeys();\n\n if (signerPrivateKeys === undefined) {\n throw new Error(\"Sender XID document has no inception signing key\");\n }\n\n return request.toEnvelope(\n this.validUntil(),\n signerPrivateKeys,\n undefined, // No recipient = signed but not encrypted\n );\n }\n\n /**\n * Creates a sealed envelope encrypted to all participants.\n *\n * Port of `DkgInvite::to_envelope()` from group_invite.rs lines 142-166.\n */\n toEnvelope(): Envelope {\n const request = this.toRequest();\n const sender = this.sender();\n const signerPrivateKeys = sender.inceptionPrivateKeys();\n\n if (signerPrivateKeys === undefined) {\n throw new Error(\"Sender XID document has no inception signing key\");\n }\n\n const recipients = this.participants().map((p) => p.xidDocument());\n\n return request.toEnvelopeForRecipients(this.validUntil(), signerPrivateKeys, recipients);\n }\n}\n\n/**\n * DKG Invitation - represents a received invitation from a participant's perspective.\n *\n * Port of `struct DkgInvitation` from group_invite.rs lines 175-186.\n */\nexport class DkgInvitation {\n private readonly _responseArid: ARID;\n private readonly _validUntil: Date;\n private readonly _sender: XIDDocument;\n private readonly _requestId: ARID;\n private readonly _peerContinuation: Envelope | undefined;\n private readonly _minSigners: number;\n private readonly _charter: string;\n private readonly _groupId: ARID;\n\n private constructor(\n responseArid: ARID,\n validUntil: Date,\n sender: XIDDocument,\n requestId: ARID,\n peerContinuation: Envelope | undefined,\n minSigners: number,\n charter: string,\n groupId: ARID,\n ) {\n this._responseArid = responseArid;\n this._validUntil = validUntil;\n this._sender = sender;\n this._requestId = requestId;\n this._peerContinuation = peerContinuation;\n this._minSigners = minSigners;\n this._charter = charter;\n this._groupId = groupId;\n }\n\n responseArid(): ARID {\n return this._responseArid;\n }\n\n validUntil(): Date {\n return this._validUntil;\n }\n\n sender(): XIDDocument {\n return this._sender;\n }\n\n requestId(): ARID {\n return this._requestId;\n }\n\n peerContinuation(): Envelope | undefined {\n return this._peerContinuation;\n }\n\n minSigners(): number {\n return this._minSigners;\n }\n\n charter(): string {\n return this._charter;\n }\n\n groupId(): ARID {\n return this._groupId;\n }\n\n /**\n * Build a GSTP response for this invitation result.\n *\n * Port of `DkgInvitation::to_response()` from group_invite.rs lines 207-224.\n */\n toResponse(response: DkgInvitationResult, recipient: XIDDocument): SealedResponse {\n let base: SealedResponse;\n if (response.type === \"accepted\") {\n base = SealedResponse.newSuccess(this.requestId(), recipient);\n } else {\n base = SealedResponse.newFailure(this.requestId(), recipient).withError(response.reason);\n }\n\n return base.withPeerContinuation(this.peerContinuation());\n }\n\n /**\n * Create a signed/encrypted GSTP envelope containing the response for the coordinator.\n *\n * Port of `DkgInvitation::to_envelope()` from group_invite.rs lines 228-244.\n */\n toEnvelope(response: DkgInvitationResult, recipient: XIDDocument): Envelope {\n const responseObj = this.toResponse(response, recipient);\n const signerPrivateKeys = recipient.inceptionPrivateKeys();\n\n if (signerPrivateKeys === undefined) {\n throw new Error(\"Recipient XID document has no signing keys\");\n }\n\n const recipients = [this.sender()];\n\n return responseObj.toEnvelopeForRecipients(this.validUntil(), signerPrivateKeys, recipients);\n }\n\n /**\n * Parse a DKG invitation from an invite envelope.\n *\n * Port of `DkgInvitation::from_invite()` from group_invite.rs lines 255-344.\n */\n static fromInvite(\n invite: Envelope,\n now: Date,\n expectedSender: XIDDocument | undefined,\n recipient: XIDDocument,\n ): DkgInvitation {\n const recipientPrivateKeys = recipient.inceptionPrivateKeys();\n\n if (recipientPrivateKeys === undefined) {\n throw new Error(\"Recipient XID document has no inception private keys\");\n }\n\n const sealedRequest = SealedRequest.tryFromEnvelope(\n invite,\n undefined,\n now,\n recipientPrivateKeys,\n );\n\n // Rust `group_invite.rs:275-279` uses `!=` on `XID`, which is the\n // derived `PartialEq` (byte-wise compare on the 32-byte ARID). TS\n // `!==` is reference identity — two distinct XID instances with\n // the same bytes would fail. Compare via hex equality instead.\n if (\n expectedSender !== undefined &&\n !sealedRequest.sender().xid().equals(expectedSender.xid())\n ) {\n throw new Error(\"Invite sender does not match expected sender\");\n }\n\n if (!sealedRequest.request().function().equals(EnvelopeFunction.fromString(\"dkgInvite\"))) {\n throw new Error(\"Unexpected invite function\");\n }\n\n const validUntil = sealedRequest.extractObjectForParameter<Date>(\"validUntil\");\n\n if (validUntil <= now) {\n throw new Error(\"Invitation expired\");\n }\n\n const recipientXid = recipient.xid();\n const minSigners = sealedRequest.extractObjectForParameter<number>(\"minSigners\");\n const charter = sealedRequest.extractObjectForParameter<string>(\"charter\");\n const groupId = sealedRequest.extractObjectForParameter<ARID>(\"group\");\n const participantObjects = sealedRequest.objectsForParameter(\"participant\");\n\n if (minSigners < 2) {\n throw new Error(\"min_signers must be at least 2\");\n }\n\n if (minSigners > participantObjects.length) {\n throw new Error(\"min_signers exceeds participant count\");\n }\n\n for (const participant of participantObjects) {\n const xidDocumentEnvelope = participant.tryUnwrap();\n const xidDocument = XIDDocument.fromEnvelope(\n xidDocumentEnvelope,\n undefined,\n XIDVerifySignature.Inception,\n );\n\n // Rust `group_invite.rs` compares via `XID::PartialEq` (byte-wise).\n // TS reference identity would never match for two distinct\n // `XID` instances representing the same identity.\n if (!xidDocument.xid().equals(recipientXid)) {\n continue;\n }\n\n const encryptedResponseArid = participant.objectForPredicate(\"response_arid\");\n const responseAridEnvelope = encryptedResponseArid.decryptToRecipient(recipientPrivateKeys);\n const responseArid: ARID = responseAridEnvelope.extractSubject((cbor) =>\n ARID.fromTaggedCbor(cbor),\n );\n\n return new DkgInvitation(\n responseArid,\n validUntil,\n sealedRequest.sender(),\n sealedRequest.request().id(),\n sealedRequest.peerContinuation(),\n minSigners,\n charter,\n groupId,\n );\n }\n\n throw new Error(\"Recipient not found in invite\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,WAAgC;CAC9C,OAAO,EAAE,MAAM,WAAW;AAC5B;;;;AAKA,SAAgB,SAAS,QAAqC;CAC5D,OAAO;EAAE,MAAM;EAAY;CAAO;AACpC;;;;;;AAOA,IAAa,YAAb,MAAa,UAAU;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,WACA,QACA,SACA,MACA,YACA,YACA,SACA,qBACA;EACA,KAAK,aAAa;EAClB,KAAK,UAAU;EACf,KAAK,WAAW;EAChB,KAAK,QAAQ;EACb,KAAK,cAAc;EACnB,KAAK,cAAc;EACnB,KAAK,WAAW;EAChB,KAAK,uBAAuB;CAC9B;;;;;;CAOA,OAAO,OACL,WACA,QACA,SACA,MACA,YACA,YACA,SACA,cACA,eACW;EACX,IAAI,aAAa,WAAW,cAAc,QACxC,MAAM,IAAI,MACR,2BAA2B,aAAa,OAAO,6CAA6C,cAAc,OAAO,EACnH;EAGF,IAAI,aAAa,GACf,MAAM,IAAI,MAAM,gCAAgC;EAGlD,MAAM,sBAAsB,aAAa,KAAK,UAAU,MACtDA,6BAAAA,uBAAuB,OAAO,UAAU,cAAc,EAAE,CAC1D;EAEA,IAAI,aAAa,oBAAoB,QACnC,MAAM,IAAI,MAAM,kDAAkD;EAIpE,oBAAoB,MAAM,GAAG,MAAM,EAAE,UAAU,CAAC,CAAC;EAEjD,OAAO,IAAI,UACT,WACA,QACA,SACA,MACA,YACA,YACA,SACA,mBACF;CACF;CAEA,YAAkB;EAChB,OAAO,KAAK;CACd;CAEA,SAAsB;EACpB,OAAO,KAAK;CACd;CAEA,UAAgB;EACd,OAAO,KAAK;CACd;CAEA,OAAa;EACX,OAAO,KAAK;CACd;CAEA,aAAmB;EACjB,OAAO,KAAK;CACd;CAEA,aAAqB;EACn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SACA,OACF;EACF;EAEA,MAAM,IAAI,MAAM,+BAA+B;CACjD;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["DkgProposedParticipant","SealedRequest","CborDate","Envelope","SealedResponse","EnvelopeFunction","XIDDocument","XIDVerifySignature","ARID"],"sources":["../../src/dkg/group-invite.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * DKG Group Invite structures.\n *\n * Port of dkg/group_invite.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { ARID } from \"@bcts/components\";\nimport { CborDate } from \"@bcts/dcbor\";\nimport { Envelope, Function as EnvelopeFunction } from \"@bcts/envelope\";\nimport { SealedRequest, SealedResponse } from \"@bcts/gstp\";\nimport { XIDDocument, XIDVerifySignature } from \"@bcts/xid\";\n\nimport { DkgProposedParticipant } from \"./proposed-participant.js\";\n\n/**\n * Result of a DKG invitation.\n *\n * Port of `enum DkgInvitationResult` from group_invite.rs lines 170-173.\n */\nexport type DkgInvitationResult = { type: \"accepted\" } | { type: \"declined\"; reason: string };\n\n/**\n * Helper to create an accepted result.\n */\nexport function accepted(): DkgInvitationResult {\n return { type: \"accepted\" };\n}\n\n/**\n * Helper to create a declined result.\n */\nexport function declined(reason: string): DkgInvitationResult {\n return { type: \"declined\", reason };\n}\n\n/**\n * DKG Invite - represents an invitation to participate in a DKG session.\n *\n * Port of `struct DkgInvite` from group_invite.rs lines 11-27.\n */\nexport class DkgInvite {\n private readonly _requestId: ARID;\n private readonly _sender: XIDDocument;\n private readonly _groupId: ARID;\n private readonly _date: Date;\n private readonly _validUntil: Date;\n private readonly _minSigners: number;\n private readonly _charter: string;\n private readonly _orderedParticipants: DkgProposedParticipant[];\n\n private constructor(\n requestId: ARID,\n sender: XIDDocument,\n groupId: ARID,\n date: Date,\n validUntil: Date,\n minSigners: number,\n charter: string,\n orderedParticipants: DkgProposedParticipant[],\n ) {\n this._requestId = requestId;\n this._sender = sender;\n this._groupId = groupId;\n this._date = date;\n this._validUntil = validUntil;\n this._minSigners = minSigners;\n this._charter = charter;\n this._orderedParticipants = orderedParticipants;\n }\n\n /**\n * Create a new DKG invite.\n *\n * Port of `DkgInvite::new()` from group_invite.rs lines 30-67.\n */\n static create(\n requestId: ARID,\n sender: XIDDocument,\n groupId: ARID,\n date: Date,\n validUntil: Date,\n minSigners: number,\n charter: string,\n participants: string[],\n responseArids: ARID[],\n ): DkgInvite {\n if (participants.length !== responseArids.length) {\n throw new Error(\n `Number of participants (${participants.length}) does not match number of response ARIDs (${responseArids.length})`,\n );\n }\n\n if (minSigners < 2) {\n throw new Error(\"min_signers must be at least 2\");\n }\n\n const orderedParticipants = participants.map((urString, i) =>\n DkgProposedParticipant.create(urString, responseArids[i]),\n );\n\n if (minSigners > orderedParticipants.length) {\n throw new Error(\"min_signers cannot exceed number of participants\");\n }\n\n // Sort by XID\n orderedParticipants.sort((a, b) => a.compareTo(b));\n\n return new DkgInvite(\n requestId,\n sender,\n groupId,\n date,\n validUntil,\n minSigners,\n charter,\n orderedParticipants,\n );\n }\n\n requestId(): ARID {\n return this._requestId;\n }\n\n sender(): XIDDocument {\n return this._sender;\n }\n\n groupId(): ARID {\n return this._groupId;\n }\n\n date(): Date {\n return this._date;\n }\n\n validUntil(): Date {\n return this._validUntil;\n }\n\n minSigners(): number {\n return this._minSigners;\n }\n\n charter(): string {\n return this._charter;\n }\n\n participants(): DkgProposedParticipant[] {\n return this._orderedParticipants;\n }\n\n /**\n * Create a GSTP sealed request from this invite.\n *\n * Port of `DkgInvite::to_request()` from group_invite.rs lines 87-121.\n */\n toRequest(): SealedRequest {\n let request = SealedRequest.new(\"dkgInvite\", this.requestId(), this.sender())\n .withParameter(\"group\", this.groupId())\n .withParameter(\"minSigners\", BigInt(this.minSigners()))\n .withParameter(\"charter\", this.charter())\n .withDate(this.date())\n .withParameter(\"validUntil\", CborDate.fromDatetime(this.validUntil()));\n\n for (const participant of this.participants()) {\n const xidDocumentEnvelope = participant.xidDocumentEnvelope();\n const responseArid = participant.responseArid();\n const encryptionKey = participant.xidDocument().encryptionKey();\n\n if (encryptionKey === undefined) {\n throw new Error(\"Participant XID document has no encryption key\");\n }\n\n const encryptedResponseArid = Envelope.new(responseArid).encryptToRecipients([encryptionKey]);\n\n const participantEnvelope = xidDocumentEnvelope\n .wrap()\n .addAssertion(\"response_arid\", encryptedResponseArid);\n\n request = request.withParameter(\"participant\", participantEnvelope);\n }\n\n return request;\n }\n\n /**\n * Creates a signed but unencrypted envelope for auditing/preview.\n *\n * Port of `DkgInvite::to_unsealed_envelope()` from group_invite.rs lines 124-139.\n */\n toUnsealedEnvelope(): Envelope {\n const request = this.toRequest();\n const sender = this.sender();\n const signerPrivateKeys = sender.inceptionPrivateKeys();\n\n if (signerPrivateKeys === undefined) {\n throw new Error(\"Sender XID document has no inception signing key\");\n }\n\n return request.toEnvelope(\n this.validUntil(),\n signerPrivateKeys,\n undefined, // No recipient = signed but not encrypted\n );\n }\n\n /**\n * Creates a sealed envelope encrypted to all participants.\n *\n * Port of `DkgInvite::to_envelope()` from group_invite.rs lines 142-166.\n */\n toEnvelope(): Envelope {\n const request = this.toRequest();\n const sender = this.sender();\n const signerPrivateKeys = sender.inceptionPrivateKeys();\n\n if (signerPrivateKeys === undefined) {\n throw new Error(\"Sender XID document has no inception signing key\");\n }\n\n const recipients = this.participants().map((p) => p.xidDocument());\n\n return request.toEnvelopeForRecipients(this.validUntil(), signerPrivateKeys, recipients);\n }\n}\n\n/**\n * DKG Invitation - represents a received invitation from a participant's perspective.\n *\n * Port of `struct DkgInvitation` from group_invite.rs lines 175-186.\n */\nexport class DkgInvitation {\n private readonly _responseArid: ARID;\n private readonly _validUntil: Date;\n private readonly _sender: XIDDocument;\n private readonly _requestId: ARID;\n private readonly _peerContinuation: Envelope | undefined;\n private readonly _minSigners: number;\n private readonly _charter: string;\n private readonly _groupId: ARID;\n\n private constructor(\n responseArid: ARID,\n validUntil: Date,\n sender: XIDDocument,\n requestId: ARID,\n peerContinuation: Envelope | undefined,\n minSigners: number,\n charter: string,\n groupId: ARID,\n ) {\n this._responseArid = responseArid;\n this._validUntil = validUntil;\n this._sender = sender;\n this._requestId = requestId;\n this._peerContinuation = peerContinuation;\n this._minSigners = minSigners;\n this._charter = charter;\n this._groupId = groupId;\n }\n\n responseArid(): ARID {\n return this._responseArid;\n }\n\n validUntil(): Date {\n return this._validUntil;\n }\n\n sender(): XIDDocument {\n return this._sender;\n }\n\n requestId(): ARID {\n return this._requestId;\n }\n\n peerContinuation(): Envelope | undefined {\n return this._peerContinuation;\n }\n\n minSigners(): number {\n return this._minSigners;\n }\n\n charter(): string {\n return this._charter;\n }\n\n groupId(): ARID {\n return this._groupId;\n }\n\n /**\n * Build a GSTP response for this invitation result.\n *\n * Port of `DkgInvitation::to_response()` from group_invite.rs lines 207-224.\n */\n toResponse(response: DkgInvitationResult, recipient: XIDDocument): SealedResponse {\n let base: SealedResponse;\n if (response.type === \"accepted\") {\n base = SealedResponse.newSuccess(this.requestId(), recipient);\n } else {\n base = SealedResponse.newFailure(this.requestId(), recipient).withError(response.reason);\n }\n\n return base.withPeerContinuation(this.peerContinuation());\n }\n\n /**\n * Create a signed/encrypted GSTP envelope containing the response for the coordinator.\n *\n * Port of `DkgInvitation::to_envelope()` from group_invite.rs lines 228-244.\n */\n toEnvelope(response: DkgInvitationResult, recipient: XIDDocument): Envelope {\n const responseObj = this.toResponse(response, recipient);\n const signerPrivateKeys = recipient.inceptionPrivateKeys();\n\n if (signerPrivateKeys === undefined) {\n throw new Error(\"Recipient XID document has no signing keys\");\n }\n\n const recipients = [this.sender()];\n\n return responseObj.toEnvelopeForRecipients(this.validUntil(), signerPrivateKeys, recipients);\n }\n\n /**\n * Parse a DKG invitation from an invite envelope.\n *\n * Port of `DkgInvitation::from_invite()` from group_invite.rs lines 255-344.\n */\n static fromInvite(\n invite: Envelope,\n now: Date,\n expectedSender: XIDDocument | undefined,\n recipient: XIDDocument,\n ): DkgInvitation {\n const recipientPrivateKeys = recipient.inceptionPrivateKeys();\n\n if (recipientPrivateKeys === undefined) {\n throw new Error(\"Recipient XID document has no inception private keys\");\n }\n\n const sealedRequest = SealedRequest.tryFromEnvelope(\n invite,\n undefined,\n now,\n recipientPrivateKeys,\n );\n\n // Rust `group_invite.rs:275-279` uses `!=` on `XID`, which is the\n // derived `PartialEq` (byte-wise compare on the 32-byte ARID). TS\n // `!==` is reference identity — two distinct XID instances with\n // the same bytes would fail. Compare via hex equality instead.\n if (\n expectedSender !== undefined &&\n !sealedRequest.sender().xid().equals(expectedSender.xid())\n ) {\n throw new Error(\"Invite sender does not match expected sender\");\n }\n\n if (!sealedRequest.request().function().equals(EnvelopeFunction.fromString(\"dkgInvite\"))) {\n throw new Error(\"Unexpected invite function\");\n }\n\n const validUntil = sealedRequest.extractObjectForParameter<Date>(\"validUntil\");\n\n if (validUntil <= now) {\n throw new Error(\"Invitation expired\");\n }\n\n const recipientXid = recipient.xid();\n const minSigners = sealedRequest.extractObjectForParameter<number>(\"minSigners\");\n const charter = sealedRequest.extractObjectForParameter<string>(\"charter\");\n const groupId = sealedRequest.extractObjectForParameter<ARID>(\"group\");\n const participantObjects = sealedRequest.objectsForParameter(\"participant\");\n\n if (minSigners < 2) {\n throw new Error(\"min_signers must be at least 2\");\n }\n\n if (minSigners > participantObjects.length) {\n throw new Error(\"min_signers exceeds participant count\");\n }\n\n for (const participant of participantObjects) {\n const xidDocumentEnvelope = participant.tryUnwrap();\n const xidDocument = XIDDocument.fromEnvelope(\n xidDocumentEnvelope,\n undefined,\n XIDVerifySignature.Inception,\n );\n\n // Rust `group_invite.rs` compares via `XID::PartialEq` (byte-wise).\n // TS reference identity would never match for two distinct\n // `XID` instances representing the same identity.\n if (!xidDocument.xid().equals(recipientXid)) {\n continue;\n }\n\n const encryptedResponseArid = participant.objectForPredicate(\"response_arid\");\n const responseAridEnvelope = encryptedResponseArid.decryptToRecipient(recipientPrivateKeys);\n const responseArid: ARID = responseAridEnvelope.extractSubject((cbor) =>\n ARID.fromTaggedCbor(cbor),\n );\n\n return new DkgInvitation(\n responseArid,\n validUntil,\n sealedRequest.sender(),\n sealedRequest.request().id(),\n sealedRequest.peerContinuation(),\n minSigners,\n charter,\n groupId,\n );\n }\n\n throw new Error(\"Recipient not found in invite\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,WAAgC;CAC9C,OAAO,EAAE,MAAM,WAAW;AAC5B;;;;AAKA,SAAgB,SAAS,QAAqC;CAC5D,OAAO;EAAE,MAAM;EAAY;CAAO;AACpC;;;;;;AAOA,IAAa,YAAb,MAAa,UAAU;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,WACA,QACA,SACA,MACA,YACA,YACA,SACA,qBACA;EACA,KAAK,aAAa;EAClB,KAAK,UAAU;EACf,KAAK,WAAW;EAChB,KAAK,QAAQ;EACb,KAAK,cAAc;EACnB,KAAK,cAAc;EACnB,KAAK,WAAW;EAChB,KAAK,uBAAuB;CAC9B;;;;;;CAOA,OAAO,OACL,WACA,QACA,SACA,MACA,YACA,YACA,SACA,cACA,eACW;EACX,IAAI,aAAa,WAAW,cAAc,QACxC,MAAM,IAAI,MACR,2BAA2B,aAAa,OAAO,6CAA6C,cAAc,OAAO,EACnH;EAGF,IAAI,aAAa,GACf,MAAM,IAAI,MAAM,gCAAgC;EAGlD,MAAM,sBAAsB,aAAa,KAAK,UAAU,MACtDA,6BAAAA,uBAAuB,OAAO,UAAU,cAAc,EAAE,CAC1D;EAEA,IAAI,aAAa,oBAAoB,QACnC,MAAM,IAAI,MAAM,kDAAkD;EAIpE,oBAAoB,MAAM,GAAG,MAAM,EAAE,UAAU,CAAC,CAAC;EAEjD,OAAO,IAAI,UACT,WACA,QACA,SACA,MACA,YACA,YACA,SACA,mBACF;CACF;CAEA,YAAkB;EAChB,OAAO,KAAK;CACd;CAEA,SAAsB;EACpB,OAAO,KAAK;CACd;CAEA,UAAgB;EACd,OAAO,KAAK;C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