@did-btcr2/method 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/browser.js +47859 -34821
  3. package/dist/browser.mjs +47858 -34820
  4. package/dist/cjs/index.js +405 -6065
  5. package/dist/esm/core/beacon/fee-estimator.js +6 -29
  6. package/dist/esm/core/beacon/fee-estimator.js.map +1 -1
  7. package/dist/esm/core/did-sender-resolver.js +26 -0
  8. package/dist/esm/core/did-sender-resolver.js.map +1 -0
  9. package/dist/esm/index.js +3 -17
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/types/core/beacon/fee-estimator.d.ts +4 -39
  12. package/dist/types/core/beacon/fee-estimator.d.ts.map +1 -1
  13. package/dist/types/core/did-sender-resolver.d.ts +14 -0
  14. package/dist/types/core/did-sender-resolver.d.ts.map +1 -0
  15. package/dist/types/index.d.ts +2 -16
  16. package/dist/types/index.d.ts.map +1 -1
  17. package/package.json +5 -4
  18. package/src/core/beacon/fee-estimator.ts +8 -51
  19. package/src/core/did-sender-resolver.ts +25 -0
  20. package/src/index.ts +3 -17
  21. package/dist/esm/core/aggregation/beacon-strategy.js +0 -76
  22. package/dist/esm/core/aggregation/beacon-strategy.js.map +0 -1
  23. package/dist/esm/core/aggregation/cohort.js +0 -316
  24. package/dist/esm/core/aggregation/cohort.js.map +0 -1
  25. package/dist/esm/core/aggregation/conditions.js +0 -102
  26. package/dist/esm/core/aggregation/conditions.js.map +0 -1
  27. package/dist/esm/core/aggregation/errors.js +0 -22
  28. package/dist/esm/core/aggregation/errors.js.map +0 -1
  29. package/dist/esm/core/aggregation/fallback-spend.js +0 -132
  30. package/dist/esm/core/aggregation/fallback-spend.js.map +0 -1
  31. package/dist/esm/core/aggregation/logger.js +0 -15
  32. package/dist/esm/core/aggregation/logger.js.map +0 -1
  33. package/dist/esm/core/aggregation/messages/base.js +0 -36
  34. package/dist/esm/core/aggregation/messages/base.js.map +0 -1
  35. package/dist/esm/core/aggregation/messages/bodies.js +0 -149
  36. package/dist/esm/core/aggregation/messages/bodies.js.map +0 -1
  37. package/dist/esm/core/aggregation/messages/constants.js +0 -37
  38. package/dist/esm/core/aggregation/messages/constants.js.map +0 -1
  39. package/dist/esm/core/aggregation/messages/factories.js +0 -139
  40. package/dist/esm/core/aggregation/messages/factories.js.map +0 -1
  41. package/dist/esm/core/aggregation/messages/guards.js +0 -40
  42. package/dist/esm/core/aggregation/messages/guards.js.map +0 -1
  43. package/dist/esm/core/aggregation/messages/index.js +0 -6
  44. package/dist/esm/core/aggregation/messages/index.js.map +0 -1
  45. package/dist/esm/core/aggregation/participant.js +0 -588
  46. package/dist/esm/core/aggregation/participant.js.map +0 -1
  47. package/dist/esm/core/aggregation/phases.js +0 -45
  48. package/dist/esm/core/aggregation/phases.js.map +0 -1
  49. package/dist/esm/core/aggregation/recovery-policy.js +0 -156
  50. package/dist/esm/core/aggregation/recovery-policy.js.map +0 -1
  51. package/dist/esm/core/aggregation/recovery-spend.js +0 -106
  52. package/dist/esm/core/aggregation/recovery-spend.js.map +0 -1
  53. package/dist/esm/core/aggregation/runner/aggregation-runner.js +0 -75
  54. package/dist/esm/core/aggregation/runner/aggregation-runner.js.map +0 -1
  55. package/dist/esm/core/aggregation/runner/events.js +0 -2
  56. package/dist/esm/core/aggregation/runner/events.js.map +0 -1
  57. package/dist/esm/core/aggregation/runner/index.js +0 -6
  58. package/dist/esm/core/aggregation/runner/index.js.map +0 -1
  59. package/dist/esm/core/aggregation/runner/participant-runner.js +0 -407
  60. package/dist/esm/core/aggregation/runner/participant-runner.js.map +0 -1
  61. package/dist/esm/core/aggregation/runner/service-runner.js +0 -699
  62. package/dist/esm/core/aggregation/runner/service-runner.js.map +0 -1
  63. package/dist/esm/core/aggregation/runner/typed-emitter.js +0 -80
  64. package/dist/esm/core/aggregation/runner/typed-emitter.js.map +0 -1
  65. package/dist/esm/core/aggregation/service.js +0 -774
  66. package/dist/esm/core/aggregation/service.js.map +0 -1
  67. package/dist/esm/core/aggregation/signer.js +0 -33
  68. package/dist/esm/core/aggregation/signer.js.map +0 -1
  69. package/dist/esm/core/aggregation/signing-session.js +0 -195
  70. package/dist/esm/core/aggregation/signing-session.js.map +0 -1
  71. package/dist/esm/core/aggregation/transport/didcomm.js +0 -41
  72. package/dist/esm/core/aggregation/transport/didcomm.js.map +0 -1
  73. package/dist/esm/core/aggregation/transport/error.js +0 -12
  74. package/dist/esm/core/aggregation/transport/error.js.map +0 -1
  75. package/dist/esm/core/aggregation/transport/factory.js +0 -29
  76. package/dist/esm/core/aggregation/transport/factory.js.map +0 -1
  77. package/dist/esm/core/aggregation/transport/http/client.js +0 -350
  78. package/dist/esm/core/aggregation/transport/http/client.js.map +0 -1
  79. package/dist/esm/core/aggregation/transport/http/envelope.js +0 -126
  80. package/dist/esm/core/aggregation/transport/http/envelope.js.map +0 -1
  81. package/dist/esm/core/aggregation/transport/http/errors.js +0 -11
  82. package/dist/esm/core/aggregation/transport/http/errors.js.map +0 -1
  83. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js +0 -45
  84. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js.map +0 -1
  85. package/dist/esm/core/aggregation/transport/http/index.js +0 -12
  86. package/dist/esm/core/aggregation/transport/http/index.js.map +0 -1
  87. package/dist/esm/core/aggregation/transport/http/nonce-cache.js +0 -38
  88. package/dist/esm/core/aggregation/transport/http/nonce-cache.js.map +0 -1
  89. package/dist/esm/core/aggregation/transport/http/protocol.js +0 -28
  90. package/dist/esm/core/aggregation/transport/http/protocol.js.map +0 -1
  91. package/dist/esm/core/aggregation/transport/http/rate-limiter.js +0 -45
  92. package/dist/esm/core/aggregation/transport/http/rate-limiter.js.map +0 -1
  93. package/dist/esm/core/aggregation/transport/http/request-auth.js +0 -100
  94. package/dist/esm/core/aggregation/transport/http/request-auth.js.map +0 -1
  95. package/dist/esm/core/aggregation/transport/http/server.js +0 -481
  96. package/dist/esm/core/aggregation/transport/http/server.js.map +0 -1
  97. package/dist/esm/core/aggregation/transport/http/sse-stream.js +0 -110
  98. package/dist/esm/core/aggregation/transport/http/sse-stream.js.map +0 -1
  99. package/dist/esm/core/aggregation/transport/http/sse-writer.js +0 -25
  100. package/dist/esm/core/aggregation/transport/http/sse-writer.js.map +0 -1
  101. package/dist/esm/core/aggregation/transport/in-memory.js +0 -149
  102. package/dist/esm/core/aggregation/transport/in-memory.js.map +0 -1
  103. package/dist/esm/core/aggregation/transport/index.js +0 -8
  104. package/dist/esm/core/aggregation/transport/index.js.map +0 -1
  105. package/dist/esm/core/aggregation/transport/nostr.js +0 -491
  106. package/dist/esm/core/aggregation/transport/nostr.js.map +0 -1
  107. package/dist/esm/core/aggregation/transport/transport.js +0 -2
  108. package/dist/esm/core/aggregation/transport/transport.js.map +0 -1
  109. package/dist/types/core/aggregation/beacon-strategy.d.ts +0 -56
  110. package/dist/types/core/aggregation/beacon-strategy.d.ts.map +0 -1
  111. package/dist/types/core/aggregation/cohort.d.ts +0 -182
  112. package/dist/types/core/aggregation/cohort.d.ts.map +0 -1
  113. package/dist/types/core/aggregation/conditions.d.ts +0 -86
  114. package/dist/types/core/aggregation/conditions.d.ts.map +0 -1
  115. package/dist/types/core/aggregation/errors.d.ts +0 -14
  116. package/dist/types/core/aggregation/errors.d.ts.map +0 -1
  117. package/dist/types/core/aggregation/fallback-spend.d.ts +0 -94
  118. package/dist/types/core/aggregation/fallback-spend.d.ts.map +0 -1
  119. package/dist/types/core/aggregation/logger.d.ts +0 -22
  120. package/dist/types/core/aggregation/logger.d.ts.map +0 -1
  121. package/dist/types/core/aggregation/messages/base.d.ts +0 -58
  122. package/dist/types/core/aggregation/messages/base.d.ts.map +0 -1
  123. package/dist/types/core/aggregation/messages/bodies.d.ts +0 -177
  124. package/dist/types/core/aggregation/messages/bodies.d.ts.map +0 -1
  125. package/dist/types/core/aggregation/messages/constants.d.ts +0 -31
  126. package/dist/types/core/aggregation/messages/constants.d.ts.map +0 -1
  127. package/dist/types/core/aggregation/messages/factories.d.ts +0 -217
  128. package/dist/types/core/aggregation/messages/factories.d.ts.map +0 -1
  129. package/dist/types/core/aggregation/messages/guards.d.ts +0 -11
  130. package/dist/types/core/aggregation/messages/guards.d.ts.map +0 -1
  131. package/dist/types/core/aggregation/messages/index.d.ts +0 -6
  132. package/dist/types/core/aggregation/messages/index.d.ts.map +0 -1
  133. package/dist/types/core/aggregation/participant.d.ts +0 -162
  134. package/dist/types/core/aggregation/participant.d.ts.map +0 -1
  135. package/dist/types/core/aggregation/phases.d.ts +0 -55
  136. package/dist/types/core/aggregation/phases.d.ts.map +0 -1
  137. package/dist/types/core/aggregation/recovery-policy.d.ts +0 -132
  138. package/dist/types/core/aggregation/recovery-policy.d.ts.map +0 -1
  139. package/dist/types/core/aggregation/recovery-spend.d.ts +0 -94
  140. package/dist/types/core/aggregation/recovery-spend.d.ts.map +0 -1
  141. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts +0 -72
  142. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts.map +0 -1
  143. package/dist/types/core/aggregation/runner/events.d.ts +0 -147
  144. package/dist/types/core/aggregation/runner/events.d.ts.map +0 -1
  145. package/dist/types/core/aggregation/runner/index.d.ts +0 -6
  146. package/dist/types/core/aggregation/runner/index.d.ts.map +0 -1
  147. package/dist/types/core/aggregation/runner/participant-runner.d.ts +0 -122
  148. package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +0 -1
  149. package/dist/types/core/aggregation/runner/service-runner.d.ts +0 -228
  150. package/dist/types/core/aggregation/runner/service-runner.d.ts.map +0 -1
  151. package/dist/types/core/aggregation/runner/typed-emitter.d.ts +0 -41
  152. package/dist/types/core/aggregation/runner/typed-emitter.d.ts.map +0 -1
  153. package/dist/types/core/aggregation/service.d.ts +0 -177
  154. package/dist/types/core/aggregation/service.d.ts.map +0 -1
  155. package/dist/types/core/aggregation/signer.d.ts +0 -50
  156. package/dist/types/core/aggregation/signer.d.ts.map +0 -1
  157. package/dist/types/core/aggregation/signing-session.d.ts +0 -81
  158. package/dist/types/core/aggregation/signing-session.d.ts.map +0 -1
  159. package/dist/types/core/aggregation/transport/didcomm.d.ts +0 -23
  160. package/dist/types/core/aggregation/transport/didcomm.d.ts.map +0 -1
  161. package/dist/types/core/aggregation/transport/error.d.ts +0 -8
  162. package/dist/types/core/aggregation/transport/error.d.ts.map +0 -1
  163. package/dist/types/core/aggregation/transport/factory.d.ts +0 -28
  164. package/dist/types/core/aggregation/transport/factory.d.ts.map +0 -1
  165. package/dist/types/core/aggregation/transport/http/client.d.ts +0 -48
  166. package/dist/types/core/aggregation/transport/http/client.d.ts.map +0 -1
  167. package/dist/types/core/aggregation/transport/http/envelope.d.ts +0 -64
  168. package/dist/types/core/aggregation/transport/http/envelope.d.ts.map +0 -1
  169. package/dist/types/core/aggregation/transport/http/errors.d.ts +0 -9
  170. package/dist/types/core/aggregation/transport/http/errors.d.ts.map +0 -1
  171. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts +0 -32
  172. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts.map +0 -1
  173. package/dist/types/core/aggregation/transport/http/index.d.ts +0 -12
  174. package/dist/types/core/aggregation/transport/http/index.d.ts.map +0 -1
  175. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts +0 -26
  176. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts.map +0 -1
  177. package/dist/types/core/aggregation/transport/http/protocol.d.ts +0 -53
  178. package/dist/types/core/aggregation/transport/http/protocol.d.ts.map +0 -1
  179. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts +0 -41
  180. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts.map +0 -1
  181. package/dist/types/core/aggregation/transport/http/request-auth.d.ts +0 -50
  182. package/dist/types/core/aggregation/transport/http/request-auth.d.ts.map +0 -1
  183. package/dist/types/core/aggregation/transport/http/server.d.ts +0 -110
  184. package/dist/types/core/aggregation/transport/http/server.d.ts.map +0 -1
  185. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts +0 -34
  186. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts.map +0 -1
  187. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts +0 -12
  188. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts.map +0 -1
  189. package/dist/types/core/aggregation/transport/in-memory.d.ts +0 -64
  190. package/dist/types/core/aggregation/transport/in-memory.d.ts.map +0 -1
  191. package/dist/types/core/aggregation/transport/index.d.ts +0 -8
  192. package/dist/types/core/aggregation/transport/index.d.ts.map +0 -1
  193. package/dist/types/core/aggregation/transport/nostr.d.ts +0 -153
  194. package/dist/types/core/aggregation/transport/nostr.d.ts.map +0 -1
  195. package/dist/types/core/aggregation/transport/transport.d.ts +0 -62
  196. package/dist/types/core/aggregation/transport/transport.d.ts.map +0 -1
  197. package/src/core/aggregation/beacon-strategy.ts +0 -142
  198. package/src/core/aggregation/cohort.ts +0 -415
  199. package/src/core/aggregation/conditions.ts +0 -172
  200. package/src/core/aggregation/errors.ts +0 -25
  201. package/src/core/aggregation/fallback-spend.ts +0 -223
  202. package/src/core/aggregation/logger.ts +0 -33
  203. package/src/core/aggregation/messages/base.ts +0 -80
  204. package/src/core/aggregation/messages/bodies.ts +0 -328
  205. package/src/core/aggregation/messages/constants.ts +0 -40
  206. package/src/core/aggregation/messages/factories.ts +0 -297
  207. package/src/core/aggregation/messages/guards.ts +0 -61
  208. package/src/core/aggregation/messages/index.ts +0 -5
  209. package/src/core/aggregation/participant.ts +0 -779
  210. package/src/core/aggregation/phases.ts +0 -91
  211. package/src/core/aggregation/recovery-policy.ts +0 -237
  212. package/src/core/aggregation/recovery-spend.ts +0 -192
  213. package/src/core/aggregation/runner/aggregation-runner.ts +0 -125
  214. package/src/core/aggregation/runner/events.ts +0 -129
  215. package/src/core/aggregation/runner/index.ts +0 -5
  216. package/src/core/aggregation/runner/participant-runner.ts +0 -488
  217. package/src/core/aggregation/runner/service-runner.ts +0 -888
  218. package/src/core/aggregation/runner/typed-emitter.ts +0 -87
  219. package/src/core/aggregation/service.ts +0 -1000
  220. package/src/core/aggregation/signer.ts +0 -67
  221. package/src/core/aggregation/signing-session.ts +0 -290
  222. package/src/core/aggregation/transport/didcomm.ts +0 -59
  223. package/src/core/aggregation/transport/error.ts +0 -13
  224. package/src/core/aggregation/transport/factory.ts +0 -65
  225. package/src/core/aggregation/transport/http/client.ts +0 -409
  226. package/src/core/aggregation/transport/http/envelope.ts +0 -204
  227. package/src/core/aggregation/transport/http/errors.ts +0 -11
  228. package/src/core/aggregation/transport/http/inbox-buffer.ts +0 -53
  229. package/src/core/aggregation/transport/http/index.ts +0 -11
  230. package/src/core/aggregation/transport/http/nonce-cache.ts +0 -43
  231. package/src/core/aggregation/transport/http/protocol.ts +0 -57
  232. package/src/core/aggregation/transport/http/rate-limiter.ts +0 -75
  233. package/src/core/aggregation/transport/http/request-auth.ts +0 -164
  234. package/src/core/aggregation/transport/http/server.ts +0 -615
  235. package/src/core/aggregation/transport/http/sse-stream.ts +0 -121
  236. package/src/core/aggregation/transport/http/sse-writer.ts +0 -23
  237. package/src/core/aggregation/transport/in-memory.ts +0 -178
  238. package/src/core/aggregation/transport/index.ts +0 -7
  239. package/src/core/aggregation/transport/nostr.ts +0 -576
  240. package/src/core/aggregation/transport/transport.ts +0 -79
@@ -1,36 +0,0 @@
1
- /**
2
- * Current on-the-wire protocol version.
3
- *
4
- * Receivers reject messages with an unknown (mismatched) version. Bumping this
5
- * requires coordinated updates across all participants and any intermediate
6
- * relays that inspect message content.
7
- */
8
- export const AGGREGATION_WIRE_VERSION = 1;
9
- export class BaseMessage {
10
- type;
11
- version;
12
- to;
13
- from;
14
- body;
15
- constructor({ type, version, to, from, body }) {
16
- this.type = type;
17
- this.version = version ?? AGGREGATION_WIRE_VERSION;
18
- this.to = to;
19
- this.from = from;
20
- this.body = body;
21
- }
22
- /**
23
- * Converts a BaseMessage to a JSON object.
24
- * @returns {Base} The JSON representation of the BaseMessage.
25
- */
26
- toJSON() {
27
- return {
28
- type: this.type,
29
- version: this.version,
30
- to: this.to,
31
- from: this.from,
32
- body: this.body
33
- };
34
- }
35
- }
36
- //# sourceMappingURL=base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/base.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AA0C1C,MAAM,OAAO,WAAW;IACf,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,EAAE,CAAU;IACZ,IAAI,CAAS;IACb,IAAI,CAAY;IAEvB,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAQ;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,wBAAwB,CAAC;QACnD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,MAAM;QACX,OAAO;YACL,IAAI,EAAM,IAAI,CAAC,IAAI;YACnB,OAAO,EAAG,IAAI,CAAC,OAAO;YACtB,EAAE,EAAQ,IAAI,CAAC,EAAE;YACjB,IAAI,EAAM,IAAI,CAAC,IAAI;YACnB,IAAI,EAAM,IAAI,CAAC,IAAI;SACpB,CAAC;IACJ,CAAC;CACF"}
@@ -1,149 +0,0 @@
1
- /**
2
- * Per-message-type body interfaces and a discriminated {@link AggregationMessage}
3
- * union.
4
- *
5
- * {@link BaseBody} remains the superset-of-all-fields body type used by the
6
- * raw {@link BaseMessage} class (see `base.ts`). The narrow interfaces here
7
- * describe what each specific message type is *required* to carry and are
8
- * exposed alongside type guards for consumers who want compile-time narrowing.
9
- *
10
- * Guards validate both `type` and the presence of required body fields so they
11
- * are safe to use on messages that have round-tripped through JSON / a relay.
12
- */
13
- import { KNOWN_FUNDING_MODELS } from '../conditions.js';
14
- import { MAX_RECOVERY_SEQUENCE } from '../recovery-policy.js';
15
- import { AGGREGATED_NONCE, AUTHORIZATION_REQUEST, COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY, DISTRIBUTE_AGGREGATED_DATA, FALLBACK_AUTHORIZATION_REQUEST, FALLBACK_SIGNATURE, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_NONINCLUDED, SUBMIT_UPDATE, VALIDATION_ACK, } from './constants.js';
16
- // ── Type guards ───────────────────────────────────────────────────────────
17
- // Each guard validates `type` plus required body fields so it's safe to use
18
- // on messages that have round-tripped through JSON / a relay.
19
- const hasStr = (b, k) => !!b && typeof b[k] === 'string';
20
- /** Present, an integer, and >= min. */
21
- const hasIntMin = (b, k, min) => {
22
- const v = b ? b[k] : undefined;
23
- return typeof v === 'number' && Number.isInteger(v) && v >= min;
24
- };
25
- /** Absent, or present as an integer >= min. */
26
- const optIntMin = (b, k, min) => {
27
- const v = b ? b[k] : undefined;
28
- return v === undefined || (typeof v === 'number' && Number.isInteger(v) && v >= min);
29
- };
30
- /** Present, an integer, and within [min, max] inclusive. */
31
- const intInRange = (b, k, min, max) => {
32
- const v = b ? b[k] : undefined;
33
- return typeof v === 'number' && Number.isInteger(v) && v >= min && v <= max;
34
- };
35
- /** Absent, or present as a string in the allowed set. */
36
- const optStrOneOf = (b, k, allowed) => {
37
- const v = b ? b[k] : undefined;
38
- return v === undefined || (typeof v === 'string' && allowed.includes(v));
39
- };
40
- const hasBool = (b, k) => !!b && typeof b[k] === 'boolean';
41
- const hasBytes = (b, k) => !!b && b[k] instanceof Uint8Array;
42
- const hasBytesArray = (b, k) => {
43
- const v = b ? b[k] : undefined;
44
- return Array.isArray(v) && v.every(x => x instanceof Uint8Array);
45
- };
46
- export function isCohortAdvertMessage(m) {
47
- // Range-check the participant bounds so a malformed advert (missing or
48
- // zero/negative minParticipants) is rejected rather than silently accepted as
49
- // a zero-floor cohort. The service does the full cross-field validation at
50
- // createCohort (see validateCohortConditions); here we guard the wire shape.
51
- return m.type === COHORT_ADVERT
52
- && hasStr(m.body, 'cohortId')
53
- && hasIntMin(m.body, 'minParticipants', 1)
54
- && optIntMin(m.body, 'maxParticipants', 1)
55
- && hasStr(m.body, 'beaconType')
56
- && hasStr(m.body, 'network')
57
- // Recovery params are mandatory: a participant must see the recovery terms
58
- // (key + timelock) before funding the beacon UTXO (ADR 042). recoverySequence
59
- // is range-checked here because the participant funds based on the advert and
60
- // does not separately run validateCohortConditions: an out-of-range value
61
- // (e.g. one with the BIP-68 disable bit set) must be rejected before funding.
62
- && hasStr(m.body, 'recoveryKey')
63
- && intInRange(m.body, 'recoverySequence', 1, MAX_RECOVERY_SEQUENCE)
64
- // fundingModel is optional on the wire (absent means the operator-funded
65
- // default), but when present it must name a known model.
66
- && optStrOneOf(m.body, 'fundingModel', KNOWN_FUNDING_MODELS)
67
- // fallbackThreshold is optional (absent means n-1 at keygen); when present it
68
- // must be a positive integer. The upper bound against the cohort size is
69
- // checked when the participant recomputes the beacon address.
70
- && optIntMin(m.body, 'fallbackThreshold', 1)
71
- && hasBytes(m.body, 'communicationPk');
72
- }
73
- export function isCohortOptInMessage(m) {
74
- return m.type === COHORT_OPT_IN
75
- && hasStr(m.body, 'cohortId')
76
- && hasBytes(m.body, 'participantPk')
77
- && hasBytes(m.body, 'communicationPk');
78
- }
79
- export function isCohortOptInAcceptMessage(m) {
80
- return m.type === COHORT_OPT_IN_ACCEPT && hasStr(m.body, 'cohortId');
81
- }
82
- export function isCohortReadyMessage(m) {
83
- return m.type === COHORT_READY
84
- && hasStr(m.body, 'cohortId')
85
- && hasStr(m.body, 'beaconAddress')
86
- && hasBytesArray(m.body, 'cohortKeys');
87
- }
88
- export function isSubmitUpdateMessage(m) {
89
- return m.type === SUBMIT_UPDATE
90
- && hasStr(m.body, 'cohortId')
91
- && !!m.body && typeof m.body.signedUpdate === 'object';
92
- }
93
- export function isSubmitNonIncludedMessage(m) {
94
- return m.type === SUBMIT_NONINCLUDED && hasStr(m.body, 'cohortId');
95
- }
96
- export function isDistributeAggregatedDataMessage(m) {
97
- return m.type === DISTRIBUTE_AGGREGATED_DATA
98
- && hasStr(m.body, 'cohortId')
99
- && hasStr(m.body, 'beaconType')
100
- && hasStr(m.body, 'signalBytesHex');
101
- }
102
- export function isValidationAckMessage(m) {
103
- return m.type === VALIDATION_ACK
104
- && hasStr(m.body, 'cohortId')
105
- && hasBool(m.body, 'approved');
106
- }
107
- export function isAuthorizationRequestMessage(m) {
108
- return m.type === AUTHORIZATION_REQUEST
109
- && hasStr(m.body, 'cohortId')
110
- && hasStr(m.body, 'sessionId')
111
- && hasStr(m.body, 'pendingTx')
112
- && hasStr(m.body, 'prevOutScriptHex')
113
- && hasStr(m.body, 'prevOutValue');
114
- }
115
- export function isNonceContributionMessage(m) {
116
- return m.type === NONCE_CONTRIBUTION
117
- && hasStr(m.body, 'cohortId')
118
- && hasStr(m.body, 'sessionId')
119
- && hasBytes(m.body, 'nonceContribution');
120
- }
121
- export function isAggregatedNonceMessage(m) {
122
- return m.type === AGGREGATED_NONCE
123
- && hasStr(m.body, 'cohortId')
124
- && hasStr(m.body, 'sessionId')
125
- && hasBytes(m.body, 'aggregatedNonce');
126
- }
127
- export function isSignatureAuthorizationMessage(m) {
128
- return m.type === SIGNATURE_AUTHORIZATION
129
- && hasStr(m.body, 'cohortId')
130
- && hasStr(m.body, 'sessionId')
131
- && hasBytes(m.body, 'partialSignature');
132
- }
133
- export function isFallbackAuthorizationRequestMessage(m) {
134
- return m.type === FALLBACK_AUTHORIZATION_REQUEST
135
- && hasStr(m.body, 'cohortId')
136
- && hasStr(m.body, 'sessionId')
137
- && hasStr(m.body, 'pendingTx')
138
- && hasStr(m.body, 'prevOutScriptHex')
139
- && hasStr(m.body, 'prevOutValue')
140
- && hasStr(m.body, 'fallbackLeafScriptHex');
141
- }
142
- export function isFallbackSignatureMessage(m) {
143
- return m.type === FALLBACK_SIGNATURE
144
- && hasStr(m.body, 'cohortId')
145
- && hasStr(m.body, 'sessionId')
146
- && hasBytes(m.body, 'signerPk')
147
- && hasBytes(m.body, 'fallbackSignature');
148
- }
149
- //# sourceMappingURL=bodies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bodies.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/bodies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,EAC1B,8BAA8B,EAC9B,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,gBAAgB,CAAC;AAgJxB,6EAA6E;AAC7E,4EAA4E;AAC5E,8DAA8D;AAE9D,MAAM,MAAM,GAAG,CAAC,CAAU,EAAE,CAAS,EAAW,EAAE,CAChD,CAAC,CAAC,CAAC,IAAI,OAAQ,CAA6B,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;AAC/D,uCAAuC;AACvC,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,CAAS,EAAE,GAAW,EAAW,EAAE;IAChE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;AAClE,CAAC,CAAC;AACF,+CAA+C;AAC/C,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,CAAS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ons/aggregate-beacons.html):
5
- * - Step 1 (Cohort Formation): COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY
6
- * - Step 2 (Update Submission): SUBMIT_UPDATE
7
- * - Step 3 (Aggregate & Validate): DISTRIBUTE_AGGREGATED_DATA, VALIDATION_ACK
8
- * - Step 4 (Sign & Broadcast): AUTHORIZATION_REQUEST, NONCE_CONTRIBUTION,
9
- * AGGREGATED_NONCE, SIGNATURE_AUTHORIZATION
10
- * - Step 4 fallback (k-of-n script path, ADR 042): FALLBACK_AUTHORIZATION_REQUEST,
11
- * FALLBACK_SIGNATURE
12
- */
13
- export const AGGREGATION_MESSAGE_PREFIX = 'https://btcr2.dev/aggregation';
14
- // Step 1: Cohort Formation
15
- export const COHORT_ADVERT = `${AGGREGATION_MESSAGE_PREFIX}/keygen/cohort_advert`;
16
- export const COHORT_OPT_IN = `${AGGREGATION_MESSAGE_PREFIX}/keygen/cohort_opt_in`;
17
- export const COHORT_OPT_IN_ACCEPT = `${AGGREGATION_MESSAGE_PREFIX}/keygen/cohort_opt_in_accept`;
18
- export const COHORT_READY = `${AGGREGATION_MESSAGE_PREFIX}/keygen/cohort_ready`;
19
- // Step 2 + 3: Update Submission, Aggregation, Validation
20
- export const SUBMIT_UPDATE = `${AGGREGATION_MESSAGE_PREFIX}/update/submit_update`;
21
- /** A member with no update this round declines explicitly (cooperative non-inclusion). */
22
- export const SUBMIT_NONINCLUDED = `${AGGREGATION_MESSAGE_PREFIX}/update/submit_nonincluded`;
23
- export const DISTRIBUTE_AGGREGATED_DATA = `${AGGREGATION_MESSAGE_PREFIX}/update/distribute_aggregated_data`;
24
- export const VALIDATION_ACK = `${AGGREGATION_MESSAGE_PREFIX}/update/validation_ack`;
25
- // Step 4: Signing
26
- export const AUTHORIZATION_REQUEST = `${AGGREGATION_MESSAGE_PREFIX}/sign/authorization_request`;
27
- export const NONCE_CONTRIBUTION = `${AGGREGATION_MESSAGE_PREFIX}/sign/nonce_contribution`;
28
- export const AGGREGATED_NONCE = `${AGGREGATION_MESSAGE_PREFIX}/sign/aggregated_nonce`;
29
- export const SIGNATURE_AUTHORIZATION = `${AGGREGATION_MESSAGE_PREFIX}/sign/signature_authorization`;
30
- // Step 4 fallback: k-of-n script-path signing when the optimistic n-of-n key
31
- // path stalls (graceful liveness, ADR 042). A single standalone BIP-340
32
- // signature per member, no nonce round.
33
- /** Service asks members to sign the fallback (k-of-n) script path of the beacon tx. */
34
- export const FALLBACK_AUTHORIZATION_REQUEST = `${AGGREGATION_MESSAGE_PREFIX}/sign/fallback_authorization_request`;
35
- /** A member returns a standalone BIP-340 signature over the fallback script-path sighash. */
36
- export const FALLBACK_SIGNATURE = `${AGGREGATION_MESSAGE_PREFIX}/sign/fallback_signature`;
37
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,+BAA+B,CAAC;AAE1E,2BAA2B;AAC3B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,0BAA0B,uBAAuB,CAAC;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,0BAA0B,uBAAuB,CAAC;AAClF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,0BAA0B,8BAA8B,CAAC;AAChG,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,0BAA0B,sBAAsB,CAAC;AAEhF,yDAAyD;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,0BAA0B,uBAAuB,CAAC;AAClF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,0BAA0B,4BAA4B,CAAC;AAC5F,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,0BAA0B,oCAAoC,CAAC;AAC5G,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,0BAA0B,wBAAwB,CAAC;AAEpF,kBAAkB;AAClB,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,0BAA0B,6BAA6B,CAAC;AAChG,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,0BAA0B,0BAA0B,CAAC;AAC1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,0BAA0B,wBAAwB,CAAC;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,0BAA0B,+BAA+B,CAAC;AAEpG,6EAA6E;AAC7E,wEAAwE;AACxE,wCAAwC;AACxC,uFAAuF;AACvF,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,0BAA0B,sCAAsC,CAAC;AAClH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,0BAA0B,0BAA0B,CAAC"}
@@ -1,139 +0,0 @@
1
- import { BaseMessage } from './base.js';
2
- import { AGGREGATED_NONCE, AUTHORIZATION_REQUEST, COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY, DISTRIBUTE_AGGREGATED_DATA, FALLBACK_AUTHORIZATION_REQUEST, FALLBACK_SIGNATURE, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_NONINCLUDED, SUBMIT_UPDATE, VALIDATION_ACK, } from './constants.js';
3
- /**
4
- * Factory function for creating a Cohort Advert message, which is used to announce the formation of
5
- * a new cohort and invite participants to join.
6
- * @param {CohortAdvertMessage} fields - The fields required to create a Cohort Advert message.
7
- * @returns {BaseMessage} The created Cohort Advert message.
8
- */
9
- export function createCohortAdvertMessage(fields) {
10
- const { from, ...body } = fields;
11
- return new BaseMessage({ type: COHORT_ADVERT, from, body });
12
- }
13
- /**
14
- * Factory function for creating a Cohort Opt-In message, which is sent by a participant to express
15
- * interest in joining a cohort.
16
- * @param {CohortOptInMessage} fields - The fields required to create a Cohort Opt-In message, which
17
- * is sent by a participant to express interest in joining a cohort.
18
- * @returns {BaseMessage} The created Cohort Opt-In message.
19
- */
20
- export function createCohortOptInMessage(fields) {
21
- const { from, to, ...body } = fields;
22
- return new BaseMessage({ type: COHORT_OPT_IN, from, to, body });
23
- }
24
- export function createCohortOptInAcceptMessage(fields) {
25
- const { from, to, ...body } = fields;
26
- return new BaseMessage({ type: COHORT_OPT_IN_ACCEPT, from, to, body });
27
- }
28
- export function createCohortReadyMessage(fields) {
29
- const { from, to, ...body } = fields;
30
- return new BaseMessage({ type: COHORT_READY, from, to, body });
31
- }
32
- /**
33
- * Factory function for creating a Submit Update message, which is sent by a participant to submit
34
- * their signed update for aggregation.
35
- * @param {SubmitUpdateMessage} fields - The fields required to create a Submit Update message,
36
- * which is sent by a participant to submit their signed update for aggregation.
37
- * @returns {BaseMessage} The created Submit Update message.
38
- */
39
- export function createSubmitUpdateMessage(fields) {
40
- const { from, to, ...body } = fields;
41
- return new BaseMessage({ type: SUBMIT_UPDATE, from, to, body });
42
- }
43
- /**
44
- * Factory for a Submit Non-Included message: a member declares it has no update
45
- * this round (cooperative non-inclusion). Membership is proven by the signed
46
- * envelope, so the body carries only the cohortId.
47
- */
48
- export function createSubmitNonIncludedMessage(fields) {
49
- const { from, to, ...body } = fields;
50
- return new BaseMessage({ type: SUBMIT_NONINCLUDED, from, to, body });
51
- }
52
- /**
53
- * Factory function for creating a Distribute Aggregated Data message, which is sent by the
54
- * aggregator to distribute the aggregated data to participants for validation.
55
- * @param {DistributeAggregatedDataMessage} fields - The fields required to create a Distribute
56
- * Aggregated Data message, which is sent by the aggregator to distribute the aggregated data to
57
- * participants for validation.
58
- * @returns {BaseMessage} The created Distribute Aggregated Data message.
59
- */
60
- export function createDistributeAggregatedDataMessage(fields) {
61
- const { from, to, ...body } = fields;
62
- return new BaseMessage({ type: DISTRIBUTE_AGGREGATED_DATA, from, to, body });
63
- }
64
- /**
65
- * Factory function for creating a Validation Acknowledgment message, which is sent by a participant
66
- * to acknowledge.
67
- * @param {ValidationAckMessage} fields - The fields required to create a Validation Acknowledgment
68
- * message, which is sent by a participant to acknowledge the validation of the aggregated data.
69
- * @returns {BaseMessage} The created Validation Acknowledgment message.
70
- */
71
- export function createValidationAckMessage(fields) {
72
- const { from, to, ...body } = fields;
73
- return new BaseMessage({ type: VALIDATION_ACK, from, to, body });
74
- }
75
- /**
76
- * Factory function for creating an Authorization Request message, which is sent by a participant to
77
- * request authorization for their signature.
78
- * @param {AuthorizationRequestMessage} fields - The fields required to create an Authorization
79
- * Request message, which is sent by a participant to request authorization for their signature.
80
- * @returns {BaseMessage} The created Authorization Request message.
81
- */
82
- export function createAuthorizationRequestMessage(fields) {
83
- const { from, to, ...body } = fields;
84
- return new BaseMessage({ type: AUTHORIZATION_REQUEST, from, to, body });
85
- }
86
- /**
87
- * Factory function for creating a Nonce Contribution message, which is sent by a participant to
88
- * contribute their nonce for the signature aggregation process.
89
- * @param {NonceContributionMessage} fields - The fields required to create a Nonce Contribution
90
- * message, which is sent by a participant to contribute their nonce for the signature aggregation
91
- * process.
92
- * @returns {BaseMessage} The created Nonce Contribution message.
93
- */
94
- export function createNonceContributionMessage(fields) {
95
- const { from, to, ...body } = fields;
96
- return new BaseMessage({ type: NONCE_CONTRIBUTION, from, to, body });
97
- }
98
- /**
99
- * Factory function for creating an Aggregated Nonce message, which is sent by the aggregator to
100
- * distribute the aggregated nonce to participants for the signature aggregation process.
101
- * @param {AggregatedNonceMessage} fields - The fields required to create an Aggregated Nonce
102
- * message, which is sent by the aggregator to distribute the aggregated nonce to participants for
103
- * the signature aggregation process.
104
- * @returns {BaseMessage} The created Aggregated Nonce message.
105
- */
106
- export function createAggregatedNonceMessage(fields) {
107
- const { from, to, ...body } = fields;
108
- return new BaseMessage({ type: AGGREGATED_NONCE, from, to, body });
109
- }
110
- /**
111
- * Factory function for creating a Signature Authorization message, which is sent by a participant
112
- * to authorize their partial signature for the signature aggregation process.
113
- * @param {SignatureAuthorizationMessage} fields - The fields required to create a Signature
114
- * Authorization message, which is sent by a participant to authorize their partial signature for
115
- * the signature aggregation process.
116
- * @returns {BaseMessage} The created Signature Authorization message.
117
- */
118
- export function createSignatureAuthorizationMessage(fields) {
119
- const { from, to, ...body } = fields;
120
- return new BaseMessage({ type: SIGNATURE_AUTHORIZATION, from, to, body });
121
- }
122
- /**
123
- * Factory for a Fallback Authorization Request: the service asks members to
124
- * authorize the k-of-n script-path spend of the beacon transaction when the
125
- * optimistic n-of-n key path stalls (ADR 042).
126
- */
127
- export function createFallbackAuthorizationRequestMessage(fields) {
128
- const { from, to, ...body } = fields;
129
- return new BaseMessage({ type: FALLBACK_AUTHORIZATION_REQUEST, from, to, body });
130
- }
131
- /**
132
- * Factory for a Fallback Signature: a member's standalone BIP-340 signature over
133
- * the fallback script-path sighash (no nonce round).
134
- */
135
- export function createFallbackSignatureMessage(fields) {
136
- const { from, to, ...body } = fields;
137
- return new BaseMessage({ type: FALLBACK_SIGNATURE, from, to, body });
138
- }
139
- //# sourceMappingURL=factories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factories.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/factories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,EAC1B,8BAA8B,EAC9B,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,gBAAgB,CAAC;AAiCxB;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAA2B;IACnE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACjC,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB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EAAE,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mCAAmC,CAAC,MAAqC;IACvF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACrC,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5E,CAAC;AAqBD;;;;GAIG;AACH,MAAM,UAAU,yCAAyC,CAAC,MAA2C;IACnG,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACrC,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,8BAA8B,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAgC;IAC7E,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACrC,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,CAAC"}
@@ -1,40 +0,0 @@
1
- import { AGGREGATED_NONCE, AUTHORIZATION_REQUEST, COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY, DISTRIBUTE_AGGREGATED_DATA, FALLBACK_AUTHORIZATION_REQUEST, FALLBACK_SIGNATURE, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_NONINCLUDED, SUBMIT_UPDATE, VALIDATION_ACK, } from './constants.js';
2
- const KEYGEN_VALUES = new Set([
3
- COHORT_ADVERT,
4
- COHORT_OPT_IN,
5
- COHORT_OPT_IN_ACCEPT,
6
- COHORT_READY,
7
- ]);
8
- const UPDATE_VALUES = new Set([
9
- SUBMIT_UPDATE,
10
- SUBMIT_NONINCLUDED,
11
- DISTRIBUTE_AGGREGATED_DATA,
12
- VALIDATION_ACK,
13
- ]);
14
- const SIGN_VALUES = new Set([
15
- AUTHORIZATION_REQUEST,
16
- NONCE_CONTRIBUTION,
17
- AGGREGATED_NONCE,
18
- SIGNATURE_AUTHORIZATION,
19
- FALLBACK_AUTHORIZATION_REQUEST,
20
- FALLBACK_SIGNATURE,
21
- ]);
22
- /**
23
- * Checks if the provided type is a valid aggregation message type.
24
- */
25
- export function isAggregationMessageType(type) {
26
- return KEYGEN_VALUES.has(type) || UPDATE_VALUES.has(type) || SIGN_VALUES.has(type);
27
- }
28
- /** Checks if the message type belongs to the keygen phase. */
29
- export function isKeygenMessageType(type) {
30
- return KEYGEN_VALUES.has(type);
31
- }
32
- /** Checks if the message type belongs to the update phase. */
33
- export function isUpdateMessageType(type) {
34
- return UPDATE_VALUES.has(type);
35
- }
36
- /** Checks if the message type belongs to the signing phase. */
37
- export function isSignMessageType(type) {
38
- return SIGN_VALUES.has(type);
39
- }
40
- //# sourceMappingURL=guards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,EAC1B,8BAA8B,EAC9B,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,MAAM,aAAa,GAAgB,IAAI,GAAG,CAAC;IACzC,aAAa;IACb,aAAa;IACb,oBAAoB;IACpB,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,aAAa,GAAgB,IAAI,GAAG,CAAC;IACzC,aAAa;IACb,kBAAkB;IAClB,0BAA0B;IAC1B,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,WAAW,GAAgB,IAAI,GAAG,CAAC;IACvC,qBAAqB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,uBAAuB;IACvB,8BAA8B;IAC9B,kBAAkB;CACnB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrF,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from './base.js';
2
- export * from './bodies.js';
3
- export * from './constants.js';
4
- export * from './factories.js';
5
- export * from './guards.js';
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}