@bitgo/wasm-mps 1.10.0 → 1.11.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.
@@ -1,15 +1,176 @@
1
1
  /* @ts-self-types="./wasm_mps.d.ts" */
2
2
 
3
- class MsgShare {
3
+ class MsgDerivation {
4
+ static __wrap(ptr) {
5
+ const obj = Object.create(MsgDerivation.prototype);
6
+ obj.__wbg_ptr = ptr;
7
+ MsgDerivationFinalization.register(obj, obj.__wbg_ptr, obj);
8
+ return obj;
9
+ }
10
+ __destroy_into_raw() {
11
+ const ptr = this.__wbg_ptr;
12
+ this.__wbg_ptr = 0;
13
+ MsgDerivationFinalization.unregister(this);
14
+ return ptr;
15
+ }
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_msgderivation_free(ptr, 0);
19
+ }
20
+ /**
21
+ * @returns {Uint8Array | undefined}
22
+ */
23
+ get ask() {
24
+ try {
25
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
26
+ wasm.msgderivation_ask(retptr, this.__wbg_ptr);
27
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
28
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
29
+ let v1;
30
+ if (r0 !== 0) {
31
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
32
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
33
+ }
34
+ return v1;
35
+ } finally {
36
+ wasm.__wbindgen_add_to_stack_pointer(16);
37
+ }
38
+ }
39
+ /**
40
+ * @returns {boolean}
41
+ */
42
+ get done() {
43
+ const ret = wasm.msgderivation_done(this.__wbg_ptr);
44
+ return ret !== 0;
45
+ }
46
+ /**
47
+ * @returns {Uint8Array | undefined}
48
+ */
49
+ get external_ivk() {
50
+ try {
51
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
52
+ wasm.msgderivation_external_ivk(retptr, this.__wbg_ptr);
53
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
54
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
55
+ let v1;
56
+ if (r0 !== 0) {
57
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
58
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
59
+ }
60
+ return v1;
61
+ } finally {
62
+ wasm.__wbindgen_add_to_stack_pointer(16);
63
+ }
64
+ }
65
+ /**
66
+ * @returns {Uint8Array | undefined}
67
+ */
68
+ get internal_ivk() {
69
+ try {
70
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
71
+ wasm.msgderivation_internal_ivk(retptr, this.__wbg_ptr);
72
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
73
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
74
+ let v1;
75
+ if (r0 !== 0) {
76
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
77
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
78
+ }
79
+ return v1;
80
+ } finally {
81
+ wasm.__wbindgen_add_to_stack_pointer(16);
82
+ }
83
+ }
84
+ /**
85
+ * @returns {Uint8Array}
86
+ */
87
+ get msg() {
88
+ try {
89
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
90
+ wasm.msgderivation_msg(retptr, this.__wbg_ptr);
91
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
92
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
93
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
94
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
95
+ return v1;
96
+ } finally {
97
+ wasm.__wbindgen_add_to_stack_pointer(16);
98
+ }
99
+ }
100
+ /**
101
+ * @returns {Uint8Array | undefined}
102
+ */
103
+ get nk() {
104
+ try {
105
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
106
+ wasm.msgderivation_nk(retptr, this.__wbg_ptr);
107
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
108
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
109
+ let v1;
110
+ if (r0 !== 0) {
111
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
112
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
113
+ }
114
+ return v1;
115
+ } finally {
116
+ wasm.__wbindgen_add_to_stack_pointer(16);
117
+ }
118
+ }
119
+ /**
120
+ * @returns {Uint8Array | undefined}
121
+ */
122
+ get rivk() {
123
+ try {
124
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
125
+ wasm.msgderivation_rivk(retptr, this.__wbg_ptr);
126
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
127
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
128
+ let v1;
129
+ if (r0 !== 0) {
130
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
131
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
132
+ }
133
+ return v1;
134
+ } finally {
135
+ wasm.__wbindgen_add_to_stack_pointer(16);
136
+ }
137
+ }
138
+ /**
139
+ * @returns {Uint8Array}
140
+ */
141
+ get state() {
142
+ try {
143
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
144
+ wasm.msgderivation_state(retptr, this.__wbg_ptr);
145
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
146
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
147
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
148
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
149
+ return v1;
150
+ } finally {
151
+ wasm.__wbindgen_add_to_stack_pointer(16);
152
+ }
153
+ }
154
+ }
155
+ if (Symbol.dispose) MsgDerivation.prototype[Symbol.dispose] = MsgDerivation.prototype.free;
156
+ exports.MsgDerivation = MsgDerivation;
157
+
158
+ class MsgDerivationInit {
159
+ static __wrap(ptr) {
160
+ const obj = Object.create(MsgDerivationInit.prototype);
161
+ obj.__wbg_ptr = ptr;
162
+ MsgDerivationInitFinalization.register(obj, obj.__wbg_ptr, obj);
163
+ return obj;
164
+ }
4
165
  __destroy_into_raw() {
5
166
  const ptr = this.__wbg_ptr;
6
167
  this.__wbg_ptr = 0;
7
- MsgShareFinalization.unregister(this);
168
+ MsgDerivationInitFinalization.unregister(this);
8
169
  return ptr;
9
170
  }
10
171
  free() {
11
172
  const ptr = this.__destroy_into_raw();
12
- wasm.__wbg_msgshare_free(ptr, 0);
173
+ wasm.__wbg_msgderivationinit_free(ptr, 0);
13
174
  }
14
175
  /**
15
176
  * @returns {Uint8Array}
@@ -17,7 +178,23 @@ class MsgShare {
17
178
  get msg() {
18
179
  try {
19
180
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
20
- wasm.msgshare_msg(retptr, this.__wbg_ptr);
181
+ wasm.msgderivationinit_msg(retptr, this.__wbg_ptr);
182
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
183
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
184
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
185
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
186
+ return v1;
187
+ } finally {
188
+ wasm.__wbindgen_add_to_stack_pointer(16);
189
+ }
190
+ }
191
+ /**
192
+ * @returns {Uint8Array}
193
+ */
194
+ get pk() {
195
+ try {
196
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
197
+ wasm.msgderivationinit_pk(retptr, this.__wbg_ptr);
21
198
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
22
199
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
23
200
  var v1 = getArrayU8FromWasm0(r0, r1).slice();
@@ -28,19 +205,43 @@ class MsgShare {
28
205
  }
29
206
  }
30
207
  /**
31
- * @returns {Share}
208
+ * @returns {Uint8Array}
32
209
  */
33
210
  get share() {
34
- const ret = wasm.msgshare_share(this.__wbg_ptr);
35
- return Share.__wrap(ret);
211
+ try {
212
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
213
+ wasm.msgderivationinit_share(retptr, this.__wbg_ptr);
214
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
215
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
216
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
217
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
218
+ return v1;
219
+ } finally {
220
+ wasm.__wbindgen_add_to_stack_pointer(16);
221
+ }
222
+ }
223
+ /**
224
+ * @returns {Uint8Array}
225
+ */
226
+ get state() {
227
+ try {
228
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
229
+ wasm.msgderivationinit_state(retptr, this.__wbg_ptr);
230
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
231
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
232
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
233
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
234
+ return v1;
235
+ } finally {
236
+ wasm.__wbindgen_add_to_stack_pointer(16);
237
+ }
36
238
  }
37
239
  }
38
- if (Symbol.dispose) MsgShare.prototype[Symbol.dispose] = MsgShare.prototype.free;
39
- exports.MsgShare = MsgShare;
240
+ if (Symbol.dispose) MsgDerivationInit.prototype[Symbol.dispose] = MsgDerivationInit.prototype.free;
241
+ exports.MsgDerivationInit = MsgDerivationInit;
40
242
 
41
243
  class MsgState {
42
244
  static __wrap(ptr) {
43
- ptr = ptr >>> 0;
44
245
  const obj = Object.create(MsgState.prototype);
45
246
  obj.__wbg_ptr = ptr;
46
247
  MsgStateFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -92,9 +293,130 @@ class MsgState {
92
293
  if (Symbol.dispose) MsgState.prototype[Symbol.dispose] = MsgState.prototype.free;
93
294
  exports.MsgState = MsgState;
94
295
 
296
+ class RedPallasIvks {
297
+ static __wrap(ptr) {
298
+ const obj = Object.create(RedPallasIvks.prototype);
299
+ obj.__wbg_ptr = ptr;
300
+ RedPallasIvksFinalization.register(obj, obj.__wbg_ptr, obj);
301
+ return obj;
302
+ }
303
+ __destroy_into_raw() {
304
+ const ptr = this.__wbg_ptr;
305
+ this.__wbg_ptr = 0;
306
+ RedPallasIvksFinalization.unregister(this);
307
+ return ptr;
308
+ }
309
+ free() {
310
+ const ptr = this.__destroy_into_raw();
311
+ wasm.__wbg_redpallasivks_free(ptr, 0);
312
+ }
313
+ /**
314
+ * @returns {Uint8Array}
315
+ */
316
+ get external_ivk() {
317
+ try {
318
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
319
+ wasm.redpallasivks_external_ivk(retptr, this.__wbg_ptr);
320
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
321
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
322
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
323
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
324
+ return v1;
325
+ } finally {
326
+ wasm.__wbindgen_add_to_stack_pointer(16);
327
+ }
328
+ }
329
+ /**
330
+ * @returns {Uint8Array}
331
+ */
332
+ get internal_ivk() {
333
+ try {
334
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
+ wasm.redpallasivks_internal_ivk(retptr, this.__wbg_ptr);
336
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
337
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
338
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
339
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
340
+ return v1;
341
+ } finally {
342
+ wasm.__wbindgen_add_to_stack_pointer(16);
343
+ }
344
+ }
345
+ }
346
+ if (Symbol.dispose) RedPallasIvks.prototype[Symbol.dispose] = RedPallasIvks.prototype.free;
347
+ exports.RedPallasIvks = RedPallasIvks;
348
+
349
+ class RedPallasSignature {
350
+ static __wrap(ptr) {
351
+ const obj = Object.create(RedPallasSignature.prototype);
352
+ obj.__wbg_ptr = ptr;
353
+ RedPallasSignatureFinalization.register(obj, obj.__wbg_ptr, obj);
354
+ return obj;
355
+ }
356
+ __destroy_into_raw() {
357
+ const ptr = this.__wbg_ptr;
358
+ this.__wbg_ptr = 0;
359
+ RedPallasSignatureFinalization.unregister(this);
360
+ return ptr;
361
+ }
362
+ free() {
363
+ const ptr = this.__destroy_into_raw();
364
+ wasm.__wbg_redpallassignature_free(ptr, 0);
365
+ }
366
+ /**
367
+ * @returns {Uint8Array}
368
+ */
369
+ get alpha() {
370
+ try {
371
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
372
+ wasm.redpallassignature_alpha(retptr, this.__wbg_ptr);
373
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
374
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
375
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
376
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
377
+ return v1;
378
+ } finally {
379
+ wasm.__wbindgen_add_to_stack_pointer(16);
380
+ }
381
+ }
382
+ /**
383
+ * @returns {Uint8Array}
384
+ */
385
+ get rk() {
386
+ try {
387
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
388
+ wasm.redpallassignature_rk(retptr, this.__wbg_ptr);
389
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
390
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
391
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
392
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
393
+ return v1;
394
+ } finally {
395
+ wasm.__wbindgen_add_to_stack_pointer(16);
396
+ }
397
+ }
398
+ /**
399
+ * @returns {Uint8Array}
400
+ */
401
+ get signature() {
402
+ try {
403
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
404
+ wasm.redpallassignature_signature(retptr, this.__wbg_ptr);
405
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
406
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
407
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
408
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
409
+ return v1;
410
+ } finally {
411
+ wasm.__wbindgen_add_to_stack_pointer(16);
412
+ }
413
+ }
414
+ }
415
+ if (Symbol.dispose) RedPallasSignature.prototype[Symbol.dispose] = RedPallasSignature.prototype.free;
416
+ exports.RedPallasSignature = RedPallasSignature;
417
+
95
418
  class Share {
96
419
  static __wrap(ptr) {
97
- ptr = ptr >>> 0;
98
420
  const obj = Object.create(Share.prototype);
99
421
  obj.__wbg_ptr = ptr;
100
422
  ShareFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -320,14 +642,14 @@ function ed25519_dsg_round2_process(round2_message, state) {
320
642
  exports.ed25519_dsg_round2_process = ed25519_dsg_round2_process;
321
643
 
322
644
  /**
323
- * @param {Uint8Array} round2_message
645
+ * @param {Uint8Array} round3_message
324
646
  * @param {Uint8Array} state
325
647
  * @returns {Uint8Array}
326
648
  */
327
- function ed25519_dsg_round3_process(round2_message, state) {
649
+ function ed25519_dsg_round3_process(round3_message, state) {
328
650
  try {
329
651
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
330
- const ptr0 = passArray8ToWasm0(round2_message, wasm.__wbindgen_export2);
652
+ const ptr0 = passArray8ToWasm0(round3_message, wasm.__wbindgen_export2);
331
653
  const len0 = WASM_VECTOR_LEN;
332
654
  const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
333
655
  const len1 = WASM_VECTOR_LEN;
@@ -348,103 +670,375 @@ function ed25519_dsg_round3_process(round2_message, state) {
348
670
  }
349
671
  exports.ed25519_dsg_round3_process = ed25519_dsg_round3_process;
350
672
 
673
+ /**
674
+ * @param {Uint8Array} messages
675
+ * @param {Uint8Array} state
676
+ * @returns {MsgDerivation}
677
+ */
678
+ function redpallas_derivation_process(messages, state) {
679
+ try {
680
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
681
+ const ptr0 = passArray8ToWasm0(messages, wasm.__wbindgen_export2);
682
+ const len0 = WASM_VECTOR_LEN;
683
+ const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
684
+ const len1 = WASM_VECTOR_LEN;
685
+ wasm.redpallas_derivation_process(retptr, ptr0, len0, ptr1, len1);
686
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
687
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
688
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
689
+ if (r2) {
690
+ throw takeObject(r1);
691
+ }
692
+ return MsgDerivation.__wrap(r0);
693
+ } finally {
694
+ wasm.__wbindgen_add_to_stack_pointer(16);
695
+ }
696
+ }
697
+ exports.redpallas_derivation_process = redpallas_derivation_process;
698
+
699
+ /**
700
+ * @param {number} party_id
701
+ * @param {Uint8Array} decryption_key
702
+ * @param {Array<any>} encryption_keys
703
+ * @param {Uint8Array} seed
704
+ * @returns {MsgState}
705
+ */
706
+ function redpallas_dkg_round0_process(party_id, decryption_key, encryption_keys, seed) {
707
+ try {
708
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
709
+ const ptr0 = passArray8ToWasm0(decryption_key, wasm.__wbindgen_export2);
710
+ const len0 = WASM_VECTOR_LEN;
711
+ const ptr1 = passArray8ToWasm0(seed, wasm.__wbindgen_export2);
712
+ const len1 = WASM_VECTOR_LEN;
713
+ wasm.redpallas_dkg_round0_process(retptr, party_id, ptr0, len0, addHeapObject(encryption_keys), ptr1, len1);
714
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
715
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
716
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
717
+ if (r2) {
718
+ throw takeObject(r1);
719
+ }
720
+ return MsgState.__wrap(r0);
721
+ } finally {
722
+ wasm.__wbindgen_add_to_stack_pointer(16);
723
+ }
724
+ }
725
+ exports.redpallas_dkg_round0_process = redpallas_dkg_round0_process;
726
+
727
+ /**
728
+ * @param {Array<any>} round1_messages
729
+ * @param {Uint8Array} state
730
+ * @returns {MsgState}
731
+ */
732
+ function redpallas_dkg_round1_process(round1_messages, state) {
733
+ try {
734
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
735
+ const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
736
+ const len0 = WASM_VECTOR_LEN;
737
+ wasm.redpallas_dkg_round1_process(retptr, addHeapObject(round1_messages), ptr0, len0);
738
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
739
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
740
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
741
+ if (r2) {
742
+ throw takeObject(r1);
743
+ }
744
+ return MsgState.__wrap(r0);
745
+ } finally {
746
+ wasm.__wbindgen_add_to_stack_pointer(16);
747
+ }
748
+ }
749
+ exports.redpallas_dkg_round1_process = redpallas_dkg_round1_process;
750
+
751
+ /**
752
+ * @param {Array<any>} round2_messages
753
+ * @param {Uint8Array} state
754
+ * @param {Uint8Array} derivation_seed
755
+ * @returns {MsgDerivationInit}
756
+ */
757
+ function redpallas_dkg_round2_process(round2_messages, state, derivation_seed) {
758
+ try {
759
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
760
+ const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
761
+ const len0 = WASM_VECTOR_LEN;
762
+ const ptr1 = passArray8ToWasm0(derivation_seed, wasm.__wbindgen_export2);
763
+ const len1 = WASM_VECTOR_LEN;
764
+ wasm.redpallas_dkg_round2_process(retptr, addHeapObject(round2_messages), ptr0, len0, ptr1, len1);
765
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
766
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
767
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
768
+ if (r2) {
769
+ throw takeObject(r1);
770
+ }
771
+ return MsgDerivationInit.__wrap(r0);
772
+ } finally {
773
+ wasm.__wbindgen_add_to_stack_pointer(16);
774
+ }
775
+ }
776
+ exports.redpallas_dkg_round2_process = redpallas_dkg_round2_process;
777
+
778
+ /**
779
+ * @param {Uint8Array} share
780
+ * @param {Uint8Array} message
781
+ * @returns {MsgState}
782
+ */
783
+ function redpallas_dsg_round0_process(share, message) {
784
+ try {
785
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
786
+ const ptr0 = passArray8ToWasm0(share, wasm.__wbindgen_export2);
787
+ const len0 = WASM_VECTOR_LEN;
788
+ const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_export2);
789
+ const len1 = WASM_VECTOR_LEN;
790
+ wasm.redpallas_dsg_round0_process(retptr, ptr0, len0, ptr1, len1);
791
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
792
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
793
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
794
+ if (r2) {
795
+ throw takeObject(r1);
796
+ }
797
+ return MsgState.__wrap(r0);
798
+ } finally {
799
+ wasm.__wbindgen_add_to_stack_pointer(16);
800
+ }
801
+ }
802
+ exports.redpallas_dsg_round0_process = redpallas_dsg_round0_process;
803
+
804
+ /**
805
+ * @param {Uint8Array} round1_message
806
+ * @param {Uint8Array} state
807
+ * @returns {MsgState}
808
+ */
809
+ function redpallas_dsg_round1_process(round1_message, state) {
810
+ try {
811
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
812
+ const ptr0 = passArray8ToWasm0(round1_message, wasm.__wbindgen_export2);
813
+ const len0 = WASM_VECTOR_LEN;
814
+ const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
815
+ const len1 = WASM_VECTOR_LEN;
816
+ wasm.redpallas_dsg_round1_process(retptr, ptr0, len0, ptr1, len1);
817
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
818
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
819
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
820
+ if (r2) {
821
+ throw takeObject(r1);
822
+ }
823
+ return MsgState.__wrap(r0);
824
+ } finally {
825
+ wasm.__wbindgen_add_to_stack_pointer(16);
826
+ }
827
+ }
828
+ exports.redpallas_dsg_round1_process = redpallas_dsg_round1_process;
829
+
830
+ /**
831
+ * @param {Uint8Array} round2_message
832
+ * @param {Uint8Array} state
833
+ * @returns {MsgState}
834
+ */
835
+ function redpallas_dsg_round2_process(round2_message, state) {
836
+ try {
837
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
838
+ const ptr0 = passArray8ToWasm0(round2_message, wasm.__wbindgen_export2);
839
+ const len0 = WASM_VECTOR_LEN;
840
+ const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
841
+ const len1 = WASM_VECTOR_LEN;
842
+ wasm.redpallas_dsg_round2_process(retptr, ptr0, len0, ptr1, len1);
843
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
844
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
845
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
846
+ if (r2) {
847
+ throw takeObject(r1);
848
+ }
849
+ return MsgState.__wrap(r0);
850
+ } finally {
851
+ wasm.__wbindgen_add_to_stack_pointer(16);
852
+ }
853
+ }
854
+ exports.redpallas_dsg_round2_process = redpallas_dsg_round2_process;
855
+
856
+ /**
857
+ * @param {Uint8Array} round3_message
858
+ * @param {Uint8Array} state
859
+ * @returns {RedPallasSignature}
860
+ */
861
+ function redpallas_dsg_round3_process(round3_message, state) {
862
+ try {
863
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
864
+ const ptr0 = passArray8ToWasm0(round3_message, wasm.__wbindgen_export2);
865
+ const len0 = WASM_VECTOR_LEN;
866
+ const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
867
+ const len1 = WASM_VECTOR_LEN;
868
+ wasm.redpallas_dsg_round3_process(retptr, ptr0, len0, ptr1, len1);
869
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
870
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
871
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
872
+ if (r2) {
873
+ throw takeObject(r1);
874
+ }
875
+ return RedPallasSignature.__wrap(r0);
876
+ } finally {
877
+ wasm.__wbindgen_add_to_stack_pointer(16);
878
+ }
879
+ }
880
+ exports.redpallas_dsg_round3_process = redpallas_dsg_round3_process;
881
+
882
+ /**
883
+ * @param {Uint8Array} ask
884
+ * @param {Uint8Array} nk
885
+ * @param {Uint8Array} rivk
886
+ * @returns {RedPallasIvks}
887
+ */
888
+ function redpallas_fvk_to_ivks(ask, nk, rivk) {
889
+ try {
890
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
891
+ const ptr0 = passArray8ToWasm0(ask, wasm.__wbindgen_export2);
892
+ const len0 = WASM_VECTOR_LEN;
893
+ const ptr1 = passArray8ToWasm0(nk, wasm.__wbindgen_export2);
894
+ const len1 = WASM_VECTOR_LEN;
895
+ const ptr2 = passArray8ToWasm0(rivk, wasm.__wbindgen_export2);
896
+ const len2 = WASM_VECTOR_LEN;
897
+ wasm.redpallas_fvk_to_ivks(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
898
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
899
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
900
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
901
+ if (r2) {
902
+ throw takeObject(r1);
903
+ }
904
+ return RedPallasIvks.__wrap(r0);
905
+ } finally {
906
+ wasm.__wbindgen_add_to_stack_pointer(16);
907
+ }
908
+ }
909
+ exports.redpallas_fvk_to_ivks = redpallas_fvk_to_ivks;
910
+
911
+ /**
912
+ * @param {Uint8Array} pk
913
+ * @param {Uint8Array} sig
914
+ * @param {Uint8Array} msg
915
+ * @returns {boolean}
916
+ */
917
+ function redpallas_verify(pk, sig, msg) {
918
+ try {
919
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
920
+ const ptr0 = passArray8ToWasm0(pk, wasm.__wbindgen_export2);
921
+ const len0 = WASM_VECTOR_LEN;
922
+ const ptr1 = passArray8ToWasm0(sig, wasm.__wbindgen_export2);
923
+ const len1 = WASM_VECTOR_LEN;
924
+ const ptr2 = passArray8ToWasm0(msg, wasm.__wbindgen_export2);
925
+ const len2 = WASM_VECTOR_LEN;
926
+ wasm.redpallas_verify(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
927
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
928
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
929
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
930
+ if (r2) {
931
+ throw takeObject(r1);
932
+ }
933
+ return r0 !== 0;
934
+ } finally {
935
+ wasm.__wbindgen_add_to_stack_pointer(16);
936
+ }
937
+ }
938
+ exports.redpallas_verify = redpallas_verify;
351
939
  function __wbg_get_imports() {
352
940
  const import0 = {
353
941
  __proto__: null,
354
- __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
942
+ __wbg___wbindgen_is_function_acc5528be2b923f2: function(arg0) {
355
943
  const ret = typeof(getObject(arg0)) === 'function';
356
944
  return ret;
357
945
  },
358
- __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
946
+ __wbg___wbindgen_is_object_0beba4a1980d3eea: function(arg0) {
359
947
  const val = getObject(arg0);
360
948
  const ret = typeof(val) === 'object' && val !== null;
361
949
  return ret;
362
950
  },
363
- __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
951
+ __wbg___wbindgen_is_string_1fca8072260dd261: function(arg0) {
364
952
  const ret = typeof(getObject(arg0)) === 'string';
365
953
  return ret;
366
954
  },
367
- __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
955
+ __wbg___wbindgen_is_undefined_721f8decd50c87a3: function(arg0) {
368
956
  const ret = getObject(arg0) === undefined;
369
957
  return ret;
370
958
  },
371
- __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
959
+ __wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
372
960
  throw new Error(getStringFromWasm0(arg0, arg1));
373
961
  },
374
- __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
375
- const ret = getObject(arg0).call(getObject(arg1));
376
- return addHeapObject(ret);
377
- }, arguments); },
378
- __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
962
+ __wbg_call_5575218572ead796: function() { return handleError(function (arg0, arg1, arg2) {
379
963
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
380
964
  return addHeapObject(ret);
381
965
  }, arguments); },
382
- __wbg_crypto_86f2631e91b51511: function(arg0) {
966
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
383
967
  const ret = getObject(arg0).crypto;
384
968
  return addHeapObject(ret);
385
969
  },
386
- __wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
970
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
387
971
  getObject(arg0).getRandomValues(getObject(arg1));
388
972
  }, arguments); },
389
- __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
973
+ __wbg_get_197a3fe98f169e38: function(arg0, arg1) {
390
974
  const ret = getObject(arg0)[arg1 >>> 0];
391
975
  return addHeapObject(ret);
392
976
  },
393
- __wbg_length_32ed9a279acd054c: function(arg0) {
977
+ __wbg_instanceof_Uint8Array_f080092dc70f5d58: function(arg0) {
978
+ let result;
979
+ try {
980
+ result = getObject(arg0) instanceof Uint8Array;
981
+ } catch (_) {
982
+ result = false;
983
+ }
984
+ const ret = result;
985
+ return ret;
986
+ },
987
+ __wbg_length_589238bdcf171f0e: function(arg0) {
394
988
  const ret = getObject(arg0).length;
395
989
  return ret;
396
990
  },
397
- __wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
398
- const ret = getObject(arg0).msCrypto;
399
- return addHeapObject(ret);
991
+ __wbg_length_c6054974c0a6cdb9: function(arg0) {
992
+ const ret = getObject(arg0).length;
993
+ return ret;
400
994
  },
401
- __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
402
- const ret = new Function(getStringFromWasm0(arg0, arg1));
995
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
996
+ const ret = getObject(arg0).msCrypto;
403
997
  return addHeapObject(ret);
404
998
  },
405
- __wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
999
+ __wbg_new_with_length_9b650f44b5c44a4e: function(arg0) {
406
1000
  const ret = new Uint8Array(arg0 >>> 0);
407
1001
  return addHeapObject(ret);
408
1002
  },
409
- __wbg_node_e1f24f89a7336c2e: function(arg0) {
1003
+ __wbg_node_84ea875411254db1: function(arg0) {
410
1004
  const ret = getObject(arg0).node;
411
1005
  return addHeapObject(ret);
412
1006
  },
413
- __wbg_process_3975fd6c72f520aa: function(arg0) {
1007
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
414
1008
  const ret = getObject(arg0).process;
415
1009
  return addHeapObject(ret);
416
1010
  },
417
- __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
1011
+ __wbg_prototypesetcall_d721637c7ca66eb8: function(arg0, arg1, arg2) {
418
1012
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
419
1013
  },
420
- __wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
1014
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
421
1015
  getObject(arg0).randomFillSync(takeObject(arg1));
422
1016
  }, arguments); },
423
- __wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
1017
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
424
1018
  const ret = module.require;
425
1019
  return addHeapObject(ret);
426
1020
  }, arguments); },
427
- __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
428
- const ret = typeof global === 'undefined' ? null : global;
1021
+ __wbg_static_accessor_GLOBAL_THIS_2fee5048bcca5938: function() {
1022
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
429
1023
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
430
1024
  },
431
- __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
432
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1025
+ __wbg_static_accessor_GLOBAL_ce44e66a4935da8c: function() {
1026
+ const ret = typeof global === 'undefined' ? null : global;
433
1027
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
434
1028
  },
435
- __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
1029
+ __wbg_static_accessor_SELF_44f6e0cb5e67cdad: function() {
436
1030
  const ret = typeof self === 'undefined' ? null : self;
437
1031
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
438
1032
  },
439
- __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
1033
+ __wbg_static_accessor_WINDOW_168f178805d978fe: function() {
440
1034
  const ret = typeof window === 'undefined' ? null : window;
441
1035
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
442
1036
  },
443
- __wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
1037
+ __wbg_subarray_b0e8ac4ed313fea8: function(arg0, arg1, arg2) {
444
1038
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
445
1039
  return addHeapObject(ret);
446
1040
  },
447
- __wbg_versions_4e31226f5e8dc909: function(arg0) {
1041
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
448
1042
  const ret = getObject(arg0).versions;
449
1043
  return addHeapObject(ret);
450
1044
  },
@@ -472,15 +1066,24 @@ function __wbg_get_imports() {
472
1066
  };
473
1067
  }
474
1068
 
475
- const MsgShareFinalization = (typeof FinalizationRegistry === 'undefined')
1069
+ const MsgDerivationFinalization = (typeof FinalizationRegistry === 'undefined')
1070
+ ? { register: () => {}, unregister: () => {} }
1071
+ : new FinalizationRegistry(ptr => wasm.__wbg_msgderivation_free(ptr, 1));
1072
+ const MsgDerivationInitFinalization = (typeof FinalizationRegistry === 'undefined')
476
1073
  ? { register: () => {}, unregister: () => {} }
477
- : new FinalizationRegistry(ptr => wasm.__wbg_msgshare_free(ptr >>> 0, 1));
1074
+ : new FinalizationRegistry(ptr => wasm.__wbg_msgderivationinit_free(ptr, 1));
478
1075
  const MsgStateFinalization = (typeof FinalizationRegistry === 'undefined')
479
1076
  ? { register: () => {}, unregister: () => {} }
480
- : new FinalizationRegistry(ptr => wasm.__wbg_msgstate_free(ptr >>> 0, 1));
1077
+ : new FinalizationRegistry(ptr => wasm.__wbg_msgstate_free(ptr, 1));
1078
+ const RedPallasIvksFinalization = (typeof FinalizationRegistry === 'undefined')
1079
+ ? { register: () => {}, unregister: () => {} }
1080
+ : new FinalizationRegistry(ptr => wasm.__wbg_redpallasivks_free(ptr, 1));
1081
+ const RedPallasSignatureFinalization = (typeof FinalizationRegistry === 'undefined')
1082
+ ? { register: () => {}, unregister: () => {} }
1083
+ : new FinalizationRegistry(ptr => wasm.__wbg_redpallassignature_free(ptr, 1));
481
1084
  const ShareFinalization = (typeof FinalizationRegistry === 'undefined')
482
1085
  ? { register: () => {}, unregister: () => {} }
483
- : new FinalizationRegistry(ptr => wasm.__wbg_share_free(ptr >>> 0, 1));
1086
+ : new FinalizationRegistry(ptr => wasm.__wbg_share_free(ptr, 1));
484
1087
 
485
1088
  function addHeapObject(obj) {
486
1089
  if (heap_next === heap.length) heap.push(heap.length + 1);
@@ -492,7 +1095,7 @@ function addHeapObject(obj) {
492
1095
  }
493
1096
 
494
1097
  function dropObject(idx) {
495
- if (idx < 132) return;
1098
+ if (idx < 1028) return;
496
1099
  heap[idx] = heap_next;
497
1100
  heap_next = idx;
498
1101
  }
@@ -511,8 +1114,7 @@ function getDataViewMemory0() {
511
1114
  }
512
1115
 
513
1116
  function getStringFromWasm0(ptr, len) {
514
- ptr = ptr >>> 0;
515
- return decodeText(ptr, len);
1117
+ return decodeText(ptr >>> 0, len);
516
1118
  }
517
1119
 
518
1120
  let cachedUint8ArrayMemory0 = null;
@@ -533,7 +1135,7 @@ function handleError(f, args) {
533
1135
  }
534
1136
  }
535
1137
 
536
- let heap = new Array(128).fill(undefined);
1138
+ let heap = new Array(1024).fill(undefined);
537
1139
  heap.push(undefined, null, true, false);
538
1140
 
539
1141
  let heap_next = heap.length;
@@ -616,4 +1218,5 @@ let WASM_VECTOR_LEN = 0;
616
1218
  const wasmPath = `${__dirname}/wasm_mps_bg.wasm`;
617
1219
  const wasmBytes = require('fs').readFileSync(wasmPath);
618
1220
  const wasmModule = new WebAssembly.Module(wasmBytes);
619
- const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1221
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
1222
+ let wasm = wasmInstance.exports;