wire-mesh-core 1.58.3 → 1.58.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wire-mesh-core",
3
- "version": "1.58.3",
3
+ "version": "1.58.4",
4
4
  "dependencies": {
5
5
  "cbor2": "2.3.0",
6
6
  "cddl.js": "1.0.1",
@@ -235,6 +235,7 @@
235
235
  "generate": "turbo run _generate",
236
236
  "lint": "turbo run _lint",
237
237
  "mutation": "turbo run _mutation",
238
+ "prepack": "node scripts/assert-wasm-dist.ts",
238
239
  "test": "turbo run _test",
239
240
  "typecheck": "turbo run _typecheck"
240
241
  },
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,204 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class DkgRound1Output {
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ readonly package: Uint8Array;
9
+ readonly secretPackage: Uint8Array;
10
+ }
11
+
12
+ export class DkgRound2Output {
13
+ private constructor();
14
+ free(): void;
15
+ [Symbol.dispose](): void;
16
+ readonly packages: Array<any>;
17
+ readonly recipientIds: Array<any>;
18
+ readonly secretPackage: Uint8Array;
19
+ }
20
+
21
+ export class DkgRound3Output {
22
+ private constructor();
23
+ free(): void;
24
+ [Symbol.dispose](): void;
25
+ readonly groupVerifyingKey: Uint8Array;
26
+ readonly keyPackage: Uint8Array;
27
+ readonly publicKeyPackage: Uint8Array;
28
+ }
29
+
30
+ export class ReshareDerivePublicKeyPackageOutput {
31
+ private constructor();
32
+ free(): void;
33
+ [Symbol.dispose](): void;
34
+ readonly groupVerifyingKey: Uint8Array;
35
+ readonly publicKeyPackage: Uint8Array;
36
+ }
37
+
38
+ export class ReshareRound1Output {
39
+ private constructor();
40
+ free(): void;
41
+ [Symbol.dispose](): void;
42
+ readonly commitment: Uint8Array;
43
+ readonly recipientIds: Array<any>;
44
+ readonly shares: Array<any>;
45
+ }
46
+
47
+ export class SigningRound1Output {
48
+ private constructor();
49
+ free(): void;
50
+ [Symbol.dispose](): void;
51
+ readonly commitments: Uint8Array;
52
+ readonly nonces: Uint8Array;
53
+ }
54
+
55
+ export class SplitCommitmentsOutput {
56
+ private constructor();
57
+ free(): void;
58
+ [Symbol.dispose](): void;
59
+ readonly binding: Uint8Array;
60
+ readonly hiding: Uint8Array;
61
+ }
62
+
63
+ export class SplitRound1PackageOutput {
64
+ private constructor();
65
+ free(): void;
66
+ [Symbol.dispose](): void;
67
+ readonly commitment: Array<any>;
68
+ readonly proofOfKnowledge: Uint8Array;
69
+ }
70
+
71
+ /**
72
+ * Reconstructs a serialized `SigningCommitments` (the same combined-blob
73
+ * shape [`signing_build_package`] and [`signing_round2_sign`] expect) from
74
+ * the two independently-serialized halves `threshold-commitment` carries
75
+ * on the wire. The inverse of [`split_commitments`].
76
+ */
77
+ export function combine_commitments(hiding: Uint8Array, binding: Uint8Array): Uint8Array;
78
+
79
+ /**
80
+ * Reconstructs a serialized DKG round-1 `Package` (the same combined-blob
81
+ * shape `dkg_round2`/`dkg_round3`/`dkg_transcript_digest` expect) from the
82
+ * two independently-serialized wire fields `threshold-keygen-round1`
83
+ * carries. The inverse of [`split_round1_package`].
84
+ */
85
+ export function combine_round1_package(commitment: Array<any>, proof_of_knowledge: Uint8Array): Uint8Array;
86
+
87
+ export function dkg_confirm_matches(own_digest: Uint8Array, own_group_key: Uint8Array, peer_digest: Uint8Array, peer_group_key: Uint8Array): boolean;
88
+
89
+ export function dkg_round1(own_device_id: Uint8Array, max_signers: number, min_signers: number): DkgRound1Output;
90
+
91
+ export function dkg_round2(own_secret_package: Uint8Array, round1_ids: Array<any>, round1_packages: Array<any>): DkgRound2Output;
92
+
93
+ export function dkg_round3(own_secret_package: Uint8Array, round1_ids: Array<any>, round1_packages: Array<any>, round2_ids: Array<any>, round2_packages: Array<any>): DkgRound3Output;
94
+
95
+ export function dkg_transcript_digest(all_round1_ids: Array<any>, all_round1_packages: Array<any>, group_verifying_key: Uint8Array): Uint8Array;
96
+
97
+ /**
98
+ * Extracts a `KeyPackage`'s own `signing_share` bytes -- what
99
+ * `reshare_round1` actually needs as `own_old_signing_share`, since a
100
+ * survivor reshares its share, not its whole key package (which also
101
+ * carries this device's OWN `verifying_share`/the group's `verifying_key`,
102
+ * neither of which the resharing computation itself uses as input).
103
+ */
104
+ export function key_package_signing_share(key_package: Uint8Array): Uint8Array;
105
+
106
+ /**
107
+ * Reconstructs a survivor's serialized broadcast commitment (the same
108
+ * whole-blob shape [`reshare_combine_commitments`] expects each entry of
109
+ * its own `commitments` array to be) from the wire's own per-coefficient
110
+ * array. The inverse of [`reshare_split_commitment`].
111
+ */
112
+ export function reshare_combine_commitment_parts(parts: Array<any>): Uint8Array;
113
+
114
+ export function reshare_combine_commitments(commitments: Array<any>): Uint8Array;
115
+
116
+ export function reshare_combine_received_shares(own_device_id: Uint8Array, received_shares: Array<any>, public_key_package: Uint8Array, new_min_signers: number): Uint8Array;
117
+
118
+ /**
119
+ * `groupVerifyingKey` is what `threshold-keygen-confirm`'s own `group-key`
120
+ * field carries and what a reshare's own verifier obligation checks
121
+ * against `existing-group-key` -- exposed alongside the whole
122
+ * `PublicKeyPackage` blob (mirroring `DkgRound3Output`'s identical shape
123
+ * for fresh DKG) rather than requiring a second call to extract it.
124
+ */
125
+ export function reshare_derive_public_key_package(combined_commitment: Uint8Array, new_participant_device_ids: Array<any>): ReshareDerivePublicKeyPackageOutput;
126
+
127
+ /**
128
+ * Survivor side: re-shares this device's own Lagrange-weighted sub-share
129
+ * of the group secret across a new (possibly different) participant set.
130
+ * See `wire_mesh_threshold::reshare`'s own module doc comment for the full
131
+ * design rationale -- this is NOT built on `frost_ed25519::keys::refresh`.
132
+ */
133
+ export function reshare_round1(own_device_id: Uint8Array, own_old_signing_share: Uint8Array, survivor_device_ids: Array<any>, new_participant_device_ids: Array<any>, new_min_signers: number): ReshareRound1Output;
134
+
135
+ /**
136
+ * Splits a survivor's serialized broadcast commitment (`reshare_round1`'s
137
+ * own `commitment` output, a whole-blob serialization) into
138
+ * `threshold-keygen-round1`'s own wire shape: an array of independently-
139
+ * serialized coefficients (`commitment: [* bstr]`). The inverse of
140
+ * [`reshare_combine_commitment_parts`].
141
+ */
142
+ export function reshare_split_commitment(commitment: Uint8Array): Array<any>;
143
+
144
+ /**
145
+ * The echo-broadcast transcript digest a member of the new participant set
146
+ * sends on `threshold-keygen-confirm` for a reshare -- the reshare analogue
147
+ * of `dkg_transcript_digest`, structurally distinct because a reshare's own
148
+ * survivor commitment (`survivor_commitments`' own entries, each the same
149
+ * whole-blob shape `reshare_round1`'s own `commitment` output is) carries
150
+ * no proof-of-knowledge component: deserializing one AS a DKG round-1
151
+ * `Package` fails outright, since the two are different wire shapes
152
+ * entirely.
153
+ */
154
+ export function reshare_transcript_digest(survivor_ids: Array<any>, survivor_commitments: Array<any>, group_verifying_key: Uint8Array): Uint8Array;
155
+
156
+ /**
157
+ * Coordinator-side: sums and verifies the collected shares into the final
158
+ * aggregate signature -- an ordinary 64-byte Ed25519 signature. See
159
+ * `wire_mesh_threshold::signing::aggregate`'s own doc comment for why a
160
+ * caller MUST treat any error here as "publish nothing".
161
+ */
162
+ export function signing_aggregate(signing_package: Uint8Array, ids: Array<any>, shares: Array<any>, public_key_package: Uint8Array): Uint8Array;
163
+
164
+ /**
165
+ * Coordinator-side: builds the `SigningPackage` bytes every participant's
166
+ * round 2 is computed against.
167
+ */
168
+ export function signing_build_package(ids: Array<any>, commitments: Array<any>, message: Uint8Array): Uint8Array;
169
+
170
+ /**
171
+ * The pure-crypto half of round 1: generates a fresh nonce pair and its
172
+ * commitments. Persisting `nonces` durably before the caller's own
173
+ * round-1 response leaves the device is the CALLER's own obligation (see
174
+ * this module's own doc comment) -- this function has no storage
175
+ * dependency and cannot enforce it.
176
+ */
177
+ export function signing_round1_commit(own_key_package: Uint8Array): SigningRound1Output;
178
+
179
+ /**
180
+ * Round 2: releases this participant's signature share. The CALLER MUST
181
+ * have already taken (one-shot, never re-readable) `nonces` from its own
182
+ * durable nonce store before calling this -- exactly as
183
+ * `wire_mesh_threshold::signing::round2_sign` requires on the Rust side.
184
+ */
185
+ export function signing_round2_sign(nonces: Uint8Array, signing_package: Uint8Array, own_key_package: Uint8Array): Uint8Array;
186
+
187
+ /**
188
+ * Splits a serialized `SigningCommitments` (`signing_round1_commit`'s own
189
+ * `commitments` output) into the two independently-serialized halves
190
+ * `threshold-commitment`'s wire shape carries (`hiding: bstr, binding:
191
+ * bstr`) -- unlike frost-core's own combined-blob serialization, which is
192
+ * opaque and not spec-shaped. The inverse of [`combine_commitments`].
193
+ */
194
+ export function split_commitments(commitments: Uint8Array): SplitCommitmentsOutput;
195
+
196
+ /**
197
+ * Splits a serialized DKG round-1 `Package` (`dkg_round1`'s own `package`
198
+ * output) into `threshold-keygen-round1`'s own wire shape: the Feldman
199
+ * commitment as an array of independently-serialized coefficients
200
+ * (`commitment: [* bstr]`) and the Schnorr proof of knowledge as a
201
+ * separate byte string -- unlike frost-core's own combined-blob
202
+ * serialization. The inverse of [`combine_round1_package`].
203
+ */
204
+ export function split_round1_package(_package: Uint8Array): SplitRound1PackageOutput;
@@ -0,0 +1,1010 @@
1
+ /* @ts-self-types="./wire_mesh_threshold_wasm.d.ts" */
2
+
3
+ class DkgRound1Output {
4
+ static __wrap(ptr) {
5
+ const obj = Object.create(DkgRound1Output.prototype);
6
+ obj.__wbg_ptr = ptr;
7
+ DkgRound1OutputFinalization.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
+ DkgRound1OutputFinalization.unregister(this);
14
+ return ptr;
15
+ }
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_dkground1output_free(ptr, 0);
19
+ }
20
+ /**
21
+ * @returns {Uint8Array}
22
+ */
23
+ get package() {
24
+ const ret = wasm.dkground1output_package(this.__wbg_ptr);
25
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
26
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
27
+ return v1;
28
+ }
29
+ /**
30
+ * @returns {Uint8Array}
31
+ */
32
+ get secretPackage() {
33
+ const ret = wasm.dkground1output_secretPackage(this.__wbg_ptr);
34
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
35
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
36
+ return v1;
37
+ }
38
+ }
39
+ if (Symbol.dispose) DkgRound1Output.prototype[Symbol.dispose] = DkgRound1Output.prototype.free;
40
+ exports.DkgRound1Output = DkgRound1Output;
41
+
42
+ class DkgRound2Output {
43
+ static __wrap(ptr) {
44
+ const obj = Object.create(DkgRound2Output.prototype);
45
+ obj.__wbg_ptr = ptr;
46
+ DkgRound2OutputFinalization.register(obj, obj.__wbg_ptr, obj);
47
+ return obj;
48
+ }
49
+ __destroy_into_raw() {
50
+ const ptr = this.__wbg_ptr;
51
+ this.__wbg_ptr = 0;
52
+ DkgRound2OutputFinalization.unregister(this);
53
+ return ptr;
54
+ }
55
+ free() {
56
+ const ptr = this.__destroy_into_raw();
57
+ wasm.__wbg_dkground2output_free(ptr, 0);
58
+ }
59
+ /**
60
+ * @returns {Array<any>}
61
+ */
62
+ get packages() {
63
+ const ret = wasm.dkground2output_packages(this.__wbg_ptr);
64
+ return ret;
65
+ }
66
+ /**
67
+ * @returns {Array<any>}
68
+ */
69
+ get recipientIds() {
70
+ const ret = wasm.dkground2output_recipientIds(this.__wbg_ptr);
71
+ return ret;
72
+ }
73
+ /**
74
+ * @returns {Uint8Array}
75
+ */
76
+ get secretPackage() {
77
+ const ret = wasm.dkground2output_secretPackage(this.__wbg_ptr);
78
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
79
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
80
+ return v1;
81
+ }
82
+ }
83
+ if (Symbol.dispose) DkgRound2Output.prototype[Symbol.dispose] = DkgRound2Output.prototype.free;
84
+ exports.DkgRound2Output = DkgRound2Output;
85
+
86
+ class DkgRound3Output {
87
+ static __wrap(ptr) {
88
+ const obj = Object.create(DkgRound3Output.prototype);
89
+ obj.__wbg_ptr = ptr;
90
+ DkgRound3OutputFinalization.register(obj, obj.__wbg_ptr, obj);
91
+ return obj;
92
+ }
93
+ __destroy_into_raw() {
94
+ const ptr = this.__wbg_ptr;
95
+ this.__wbg_ptr = 0;
96
+ DkgRound3OutputFinalization.unregister(this);
97
+ return ptr;
98
+ }
99
+ free() {
100
+ const ptr = this.__destroy_into_raw();
101
+ wasm.__wbg_dkground3output_free(ptr, 0);
102
+ }
103
+ /**
104
+ * @returns {Uint8Array}
105
+ */
106
+ get groupVerifyingKey() {
107
+ const ret = wasm.dkground3output_groupVerifyingKey(this.__wbg_ptr);
108
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
109
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
110
+ return v1;
111
+ }
112
+ /**
113
+ * @returns {Uint8Array}
114
+ */
115
+ get keyPackage() {
116
+ const ret = wasm.dkground3output_keyPackage(this.__wbg_ptr);
117
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
118
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
119
+ return v1;
120
+ }
121
+ /**
122
+ * @returns {Uint8Array}
123
+ */
124
+ get publicKeyPackage() {
125
+ const ret = wasm.dkground3output_publicKeyPackage(this.__wbg_ptr);
126
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
127
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
128
+ return v1;
129
+ }
130
+ }
131
+ if (Symbol.dispose) DkgRound3Output.prototype[Symbol.dispose] = DkgRound3Output.prototype.free;
132
+ exports.DkgRound3Output = DkgRound3Output;
133
+
134
+ class ReshareDerivePublicKeyPackageOutput {
135
+ static __wrap(ptr) {
136
+ const obj = Object.create(ReshareDerivePublicKeyPackageOutput.prototype);
137
+ obj.__wbg_ptr = ptr;
138
+ ReshareDerivePublicKeyPackageOutputFinalization.register(obj, obj.__wbg_ptr, obj);
139
+ return obj;
140
+ }
141
+ __destroy_into_raw() {
142
+ const ptr = this.__wbg_ptr;
143
+ this.__wbg_ptr = 0;
144
+ ReshareDerivePublicKeyPackageOutputFinalization.unregister(this);
145
+ return ptr;
146
+ }
147
+ free() {
148
+ const ptr = this.__destroy_into_raw();
149
+ wasm.__wbg_resharederivepublickeypackageoutput_free(ptr, 0);
150
+ }
151
+ /**
152
+ * @returns {Uint8Array}
153
+ */
154
+ get groupVerifyingKey() {
155
+ const ret = wasm.resharederivepublickeypackageoutput_groupVerifyingKey(this.__wbg_ptr);
156
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
157
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
158
+ return v1;
159
+ }
160
+ /**
161
+ * @returns {Uint8Array}
162
+ */
163
+ get publicKeyPackage() {
164
+ const ret = wasm.resharederivepublickeypackageoutput_publicKeyPackage(this.__wbg_ptr);
165
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
166
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
167
+ return v1;
168
+ }
169
+ }
170
+ if (Symbol.dispose) ReshareDerivePublicKeyPackageOutput.prototype[Symbol.dispose] = ReshareDerivePublicKeyPackageOutput.prototype.free;
171
+ exports.ReshareDerivePublicKeyPackageOutput = ReshareDerivePublicKeyPackageOutput;
172
+
173
+ class ReshareRound1Output {
174
+ static __wrap(ptr) {
175
+ const obj = Object.create(ReshareRound1Output.prototype);
176
+ obj.__wbg_ptr = ptr;
177
+ ReshareRound1OutputFinalization.register(obj, obj.__wbg_ptr, obj);
178
+ return obj;
179
+ }
180
+ __destroy_into_raw() {
181
+ const ptr = this.__wbg_ptr;
182
+ this.__wbg_ptr = 0;
183
+ ReshareRound1OutputFinalization.unregister(this);
184
+ return ptr;
185
+ }
186
+ free() {
187
+ const ptr = this.__destroy_into_raw();
188
+ wasm.__wbg_reshareround1output_free(ptr, 0);
189
+ }
190
+ /**
191
+ * @returns {Uint8Array}
192
+ */
193
+ get commitment() {
194
+ const ret = wasm.reshareround1output_commitment(this.__wbg_ptr);
195
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
196
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
197
+ return v1;
198
+ }
199
+ /**
200
+ * @returns {Array<any>}
201
+ */
202
+ get recipientIds() {
203
+ const ret = wasm.reshareround1output_recipientIds(this.__wbg_ptr);
204
+ return ret;
205
+ }
206
+ /**
207
+ * @returns {Array<any>}
208
+ */
209
+ get shares() {
210
+ const ret = wasm.reshareround1output_shares(this.__wbg_ptr);
211
+ return ret;
212
+ }
213
+ }
214
+ if (Symbol.dispose) ReshareRound1Output.prototype[Symbol.dispose] = ReshareRound1Output.prototype.free;
215
+ exports.ReshareRound1Output = ReshareRound1Output;
216
+
217
+ class SigningRound1Output {
218
+ static __wrap(ptr) {
219
+ const obj = Object.create(SigningRound1Output.prototype);
220
+ obj.__wbg_ptr = ptr;
221
+ SigningRound1OutputFinalization.register(obj, obj.__wbg_ptr, obj);
222
+ return obj;
223
+ }
224
+ __destroy_into_raw() {
225
+ const ptr = this.__wbg_ptr;
226
+ this.__wbg_ptr = 0;
227
+ SigningRound1OutputFinalization.unregister(this);
228
+ return ptr;
229
+ }
230
+ free() {
231
+ const ptr = this.__destroy_into_raw();
232
+ wasm.__wbg_signinground1output_free(ptr, 0);
233
+ }
234
+ /**
235
+ * @returns {Uint8Array}
236
+ */
237
+ get commitments() {
238
+ const ret = wasm.signinground1output_commitments(this.__wbg_ptr);
239
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
240
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
241
+ return v1;
242
+ }
243
+ /**
244
+ * @returns {Uint8Array}
245
+ */
246
+ get nonces() {
247
+ const ret = wasm.signinground1output_nonces(this.__wbg_ptr);
248
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
249
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
250
+ return v1;
251
+ }
252
+ }
253
+ if (Symbol.dispose) SigningRound1Output.prototype[Symbol.dispose] = SigningRound1Output.prototype.free;
254
+ exports.SigningRound1Output = SigningRound1Output;
255
+
256
+ class SplitCommitmentsOutput {
257
+ static __wrap(ptr) {
258
+ const obj = Object.create(SplitCommitmentsOutput.prototype);
259
+ obj.__wbg_ptr = ptr;
260
+ SplitCommitmentsOutputFinalization.register(obj, obj.__wbg_ptr, obj);
261
+ return obj;
262
+ }
263
+ __destroy_into_raw() {
264
+ const ptr = this.__wbg_ptr;
265
+ this.__wbg_ptr = 0;
266
+ SplitCommitmentsOutputFinalization.unregister(this);
267
+ return ptr;
268
+ }
269
+ free() {
270
+ const ptr = this.__destroy_into_raw();
271
+ wasm.__wbg_splitcommitmentsoutput_free(ptr, 0);
272
+ }
273
+ /**
274
+ * @returns {Uint8Array}
275
+ */
276
+ get binding() {
277
+ const ret = wasm.splitcommitmentsoutput_binding(this.__wbg_ptr);
278
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
279
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
280
+ return v1;
281
+ }
282
+ /**
283
+ * @returns {Uint8Array}
284
+ */
285
+ get hiding() {
286
+ const ret = wasm.splitcommitmentsoutput_hiding(this.__wbg_ptr);
287
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
288
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
289
+ return v1;
290
+ }
291
+ }
292
+ if (Symbol.dispose) SplitCommitmentsOutput.prototype[Symbol.dispose] = SplitCommitmentsOutput.prototype.free;
293
+ exports.SplitCommitmentsOutput = SplitCommitmentsOutput;
294
+
295
+ class SplitRound1PackageOutput {
296
+ static __wrap(ptr) {
297
+ const obj = Object.create(SplitRound1PackageOutput.prototype);
298
+ obj.__wbg_ptr = ptr;
299
+ SplitRound1PackageOutputFinalization.register(obj, obj.__wbg_ptr, obj);
300
+ return obj;
301
+ }
302
+ __destroy_into_raw() {
303
+ const ptr = this.__wbg_ptr;
304
+ this.__wbg_ptr = 0;
305
+ SplitRound1PackageOutputFinalization.unregister(this);
306
+ return ptr;
307
+ }
308
+ free() {
309
+ const ptr = this.__destroy_into_raw();
310
+ wasm.__wbg_splitround1packageoutput_free(ptr, 0);
311
+ }
312
+ /**
313
+ * @returns {Array<any>}
314
+ */
315
+ get commitment() {
316
+ const ret = wasm.splitround1packageoutput_commitment(this.__wbg_ptr);
317
+ return ret;
318
+ }
319
+ /**
320
+ * @returns {Uint8Array}
321
+ */
322
+ get proofOfKnowledge() {
323
+ const ret = wasm.splitround1packageoutput_proofOfKnowledge(this.__wbg_ptr);
324
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
325
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
326
+ return v1;
327
+ }
328
+ }
329
+ if (Symbol.dispose) SplitRound1PackageOutput.prototype[Symbol.dispose] = SplitRound1PackageOutput.prototype.free;
330
+ exports.SplitRound1PackageOutput = SplitRound1PackageOutput;
331
+
332
+ /**
333
+ * Reconstructs a serialized `SigningCommitments` (the same combined-blob
334
+ * shape [`signing_build_package`] and [`signing_round2_sign`] expect) from
335
+ * the two independently-serialized halves `threshold-commitment` carries
336
+ * on the wire. The inverse of [`split_commitments`].
337
+ * @param {Uint8Array} hiding
338
+ * @param {Uint8Array} binding
339
+ * @returns {Uint8Array}
340
+ */
341
+ function combine_commitments(hiding, binding) {
342
+ const ptr0 = passArray8ToWasm0(hiding, wasm.__wbindgen_malloc);
343
+ const len0 = WASM_VECTOR_LEN;
344
+ const ptr1 = passArray8ToWasm0(binding, wasm.__wbindgen_malloc);
345
+ const len1 = WASM_VECTOR_LEN;
346
+ const ret = wasm.combine_commitments(ptr0, len0, ptr1, len1);
347
+ if (ret[3]) {
348
+ throw takeFromExternrefTable0(ret[2]);
349
+ }
350
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
351
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
352
+ return v3;
353
+ }
354
+ exports.combine_commitments = combine_commitments;
355
+
356
+ /**
357
+ * Reconstructs a serialized DKG round-1 `Package` (the same combined-blob
358
+ * shape `dkg_round2`/`dkg_round3`/`dkg_transcript_digest` expect) from the
359
+ * two independently-serialized wire fields `threshold-keygen-round1`
360
+ * carries. The inverse of [`split_round1_package`].
361
+ * @param {Array<any>} commitment
362
+ * @param {Uint8Array} proof_of_knowledge
363
+ * @returns {Uint8Array}
364
+ */
365
+ function combine_round1_package(commitment, proof_of_knowledge) {
366
+ const ptr0 = passArray8ToWasm0(proof_of_knowledge, wasm.__wbindgen_malloc);
367
+ const len0 = WASM_VECTOR_LEN;
368
+ const ret = wasm.combine_round1_package(commitment, ptr0, len0);
369
+ if (ret[3]) {
370
+ throw takeFromExternrefTable0(ret[2]);
371
+ }
372
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
373
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
374
+ return v2;
375
+ }
376
+ exports.combine_round1_package = combine_round1_package;
377
+
378
+ /**
379
+ * @param {Uint8Array} own_digest
380
+ * @param {Uint8Array} own_group_key
381
+ * @param {Uint8Array} peer_digest
382
+ * @param {Uint8Array} peer_group_key
383
+ * @returns {boolean}
384
+ */
385
+ function dkg_confirm_matches(own_digest, own_group_key, peer_digest, peer_group_key) {
386
+ const ptr0 = passArray8ToWasm0(own_digest, wasm.__wbindgen_malloc);
387
+ const len0 = WASM_VECTOR_LEN;
388
+ const ptr1 = passArray8ToWasm0(own_group_key, wasm.__wbindgen_malloc);
389
+ const len1 = WASM_VECTOR_LEN;
390
+ const ptr2 = passArray8ToWasm0(peer_digest, wasm.__wbindgen_malloc);
391
+ const len2 = WASM_VECTOR_LEN;
392
+ const ptr3 = passArray8ToWasm0(peer_group_key, wasm.__wbindgen_malloc);
393
+ const len3 = WASM_VECTOR_LEN;
394
+ const ret = wasm.dkg_confirm_matches(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
395
+ if (ret[2]) {
396
+ throw takeFromExternrefTable0(ret[1]);
397
+ }
398
+ return ret[0] !== 0;
399
+ }
400
+ exports.dkg_confirm_matches = dkg_confirm_matches;
401
+
402
+ /**
403
+ * @param {Uint8Array} own_device_id
404
+ * @param {number} max_signers
405
+ * @param {number} min_signers
406
+ * @returns {DkgRound1Output}
407
+ */
408
+ function dkg_round1(own_device_id, max_signers, min_signers) {
409
+ const ptr0 = passArray8ToWasm0(own_device_id, wasm.__wbindgen_malloc);
410
+ const len0 = WASM_VECTOR_LEN;
411
+ const ret = wasm.dkg_round1(ptr0, len0, max_signers, min_signers);
412
+ if (ret[2]) {
413
+ throw takeFromExternrefTable0(ret[1]);
414
+ }
415
+ return DkgRound1Output.__wrap(ret[0]);
416
+ }
417
+ exports.dkg_round1 = dkg_round1;
418
+
419
+ /**
420
+ * @param {Uint8Array} own_secret_package
421
+ * @param {Array<any>} round1_ids
422
+ * @param {Array<any>} round1_packages
423
+ * @returns {DkgRound2Output}
424
+ */
425
+ function dkg_round2(own_secret_package, round1_ids, round1_packages) {
426
+ const ptr0 = passArray8ToWasm0(own_secret_package, wasm.__wbindgen_malloc);
427
+ const len0 = WASM_VECTOR_LEN;
428
+ const ret = wasm.dkg_round2(ptr0, len0, round1_ids, round1_packages);
429
+ if (ret[2]) {
430
+ throw takeFromExternrefTable0(ret[1]);
431
+ }
432
+ return DkgRound2Output.__wrap(ret[0]);
433
+ }
434
+ exports.dkg_round2 = dkg_round2;
435
+
436
+ /**
437
+ * @param {Uint8Array} own_secret_package
438
+ * @param {Array<any>} round1_ids
439
+ * @param {Array<any>} round1_packages
440
+ * @param {Array<any>} round2_ids
441
+ * @param {Array<any>} round2_packages
442
+ * @returns {DkgRound3Output}
443
+ */
444
+ function dkg_round3(own_secret_package, round1_ids, round1_packages, round2_ids, round2_packages) {
445
+ const ptr0 = passArray8ToWasm0(own_secret_package, wasm.__wbindgen_malloc);
446
+ const len0 = WASM_VECTOR_LEN;
447
+ const ret = wasm.dkg_round3(ptr0, len0, round1_ids, round1_packages, round2_ids, round2_packages);
448
+ if (ret[2]) {
449
+ throw takeFromExternrefTable0(ret[1]);
450
+ }
451
+ return DkgRound3Output.__wrap(ret[0]);
452
+ }
453
+ exports.dkg_round3 = dkg_round3;
454
+
455
+ /**
456
+ * @param {Array<any>} all_round1_ids
457
+ * @param {Array<any>} all_round1_packages
458
+ * @param {Uint8Array} group_verifying_key
459
+ * @returns {Uint8Array}
460
+ */
461
+ function dkg_transcript_digest(all_round1_ids, all_round1_packages, group_verifying_key) {
462
+ const ptr0 = passArray8ToWasm0(group_verifying_key, wasm.__wbindgen_malloc);
463
+ const len0 = WASM_VECTOR_LEN;
464
+ const ret = wasm.dkg_transcript_digest(all_round1_ids, all_round1_packages, ptr0, len0);
465
+ if (ret[3]) {
466
+ throw takeFromExternrefTable0(ret[2]);
467
+ }
468
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
469
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
470
+ return v2;
471
+ }
472
+ exports.dkg_transcript_digest = dkg_transcript_digest;
473
+
474
+ /**
475
+ * Extracts a `KeyPackage`'s own `signing_share` bytes -- what
476
+ * `reshare_round1` actually needs as `own_old_signing_share`, since a
477
+ * survivor reshares its share, not its whole key package (which also
478
+ * carries this device's OWN `verifying_share`/the group's `verifying_key`,
479
+ * neither of which the resharing computation itself uses as input).
480
+ * @param {Uint8Array} key_package
481
+ * @returns {Uint8Array}
482
+ */
483
+ function key_package_signing_share(key_package) {
484
+ const ptr0 = passArray8ToWasm0(key_package, wasm.__wbindgen_malloc);
485
+ const len0 = WASM_VECTOR_LEN;
486
+ const ret = wasm.key_package_signing_share(ptr0, len0);
487
+ if (ret[3]) {
488
+ throw takeFromExternrefTable0(ret[2]);
489
+ }
490
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
491
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
492
+ return v2;
493
+ }
494
+ exports.key_package_signing_share = key_package_signing_share;
495
+
496
+ /**
497
+ * Reconstructs a survivor's serialized broadcast commitment (the same
498
+ * whole-blob shape [`reshare_combine_commitments`] expects each entry of
499
+ * its own `commitments` array to be) from the wire's own per-coefficient
500
+ * array. The inverse of [`reshare_split_commitment`].
501
+ * @param {Array<any>} parts
502
+ * @returns {Uint8Array}
503
+ */
504
+ function reshare_combine_commitment_parts(parts) {
505
+ const ret = wasm.reshare_combine_commitment_parts(parts);
506
+ if (ret[3]) {
507
+ throw takeFromExternrefTable0(ret[2]);
508
+ }
509
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
510
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
511
+ return v1;
512
+ }
513
+ exports.reshare_combine_commitment_parts = reshare_combine_commitment_parts;
514
+
515
+ /**
516
+ * @param {Array<any>} commitments
517
+ * @returns {Uint8Array}
518
+ */
519
+ function reshare_combine_commitments(commitments) {
520
+ const ret = wasm.reshare_combine_commitments(commitments);
521
+ if (ret[3]) {
522
+ throw takeFromExternrefTable0(ret[2]);
523
+ }
524
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
525
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
526
+ return v1;
527
+ }
528
+ exports.reshare_combine_commitments = reshare_combine_commitments;
529
+
530
+ /**
531
+ * @param {Uint8Array} own_device_id
532
+ * @param {Array<any>} received_shares
533
+ * @param {Uint8Array} public_key_package
534
+ * @param {number} new_min_signers
535
+ * @returns {Uint8Array}
536
+ */
537
+ function reshare_combine_received_shares(own_device_id, received_shares, public_key_package, new_min_signers) {
538
+ const ptr0 = passArray8ToWasm0(own_device_id, wasm.__wbindgen_malloc);
539
+ const len0 = WASM_VECTOR_LEN;
540
+ const ptr1 = passArray8ToWasm0(public_key_package, wasm.__wbindgen_malloc);
541
+ const len1 = WASM_VECTOR_LEN;
542
+ const ret = wasm.reshare_combine_received_shares(ptr0, len0, received_shares, ptr1, len1, new_min_signers);
543
+ if (ret[3]) {
544
+ throw takeFromExternrefTable0(ret[2]);
545
+ }
546
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
547
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
548
+ return v3;
549
+ }
550
+ exports.reshare_combine_received_shares = reshare_combine_received_shares;
551
+
552
+ /**
553
+ * `groupVerifyingKey` is what `threshold-keygen-confirm`'s own `group-key`
554
+ * field carries and what a reshare's own verifier obligation checks
555
+ * against `existing-group-key` -- exposed alongside the whole
556
+ * `PublicKeyPackage` blob (mirroring `DkgRound3Output`'s identical shape
557
+ * for fresh DKG) rather than requiring a second call to extract it.
558
+ * @param {Uint8Array} combined_commitment
559
+ * @param {Array<any>} new_participant_device_ids
560
+ * @returns {ReshareDerivePublicKeyPackageOutput}
561
+ */
562
+ function reshare_derive_public_key_package(combined_commitment, new_participant_device_ids) {
563
+ const ptr0 = passArray8ToWasm0(combined_commitment, wasm.__wbindgen_malloc);
564
+ const len0 = WASM_VECTOR_LEN;
565
+ const ret = wasm.reshare_derive_public_key_package(ptr0, len0, new_participant_device_ids);
566
+ if (ret[2]) {
567
+ throw takeFromExternrefTable0(ret[1]);
568
+ }
569
+ return ReshareDerivePublicKeyPackageOutput.__wrap(ret[0]);
570
+ }
571
+ exports.reshare_derive_public_key_package = reshare_derive_public_key_package;
572
+
573
+ /**
574
+ * Survivor side: re-shares this device's own Lagrange-weighted sub-share
575
+ * of the group secret across a new (possibly different) participant set.
576
+ * See `wire_mesh_threshold::reshare`'s own module doc comment for the full
577
+ * design rationale -- this is NOT built on `frost_ed25519::keys::refresh`.
578
+ * @param {Uint8Array} own_device_id
579
+ * @param {Uint8Array} own_old_signing_share
580
+ * @param {Array<any>} survivor_device_ids
581
+ * @param {Array<any>} new_participant_device_ids
582
+ * @param {number} new_min_signers
583
+ * @returns {ReshareRound1Output}
584
+ */
585
+ function reshare_round1(own_device_id, own_old_signing_share, survivor_device_ids, new_participant_device_ids, new_min_signers) {
586
+ const ptr0 = passArray8ToWasm0(own_device_id, wasm.__wbindgen_malloc);
587
+ const len0 = WASM_VECTOR_LEN;
588
+ const ptr1 = passArray8ToWasm0(own_old_signing_share, wasm.__wbindgen_malloc);
589
+ const len1 = WASM_VECTOR_LEN;
590
+ const ret = wasm.reshare_round1(ptr0, len0, ptr1, len1, survivor_device_ids, new_participant_device_ids, new_min_signers);
591
+ if (ret[2]) {
592
+ throw takeFromExternrefTable0(ret[1]);
593
+ }
594
+ return ReshareRound1Output.__wrap(ret[0]);
595
+ }
596
+ exports.reshare_round1 = reshare_round1;
597
+
598
+ /**
599
+ * Splits a survivor's serialized broadcast commitment (`reshare_round1`'s
600
+ * own `commitment` output, a whole-blob serialization) into
601
+ * `threshold-keygen-round1`'s own wire shape: an array of independently-
602
+ * serialized coefficients (`commitment: [* bstr]`). The inverse of
603
+ * [`reshare_combine_commitment_parts`].
604
+ * @param {Uint8Array} commitment
605
+ * @returns {Array<any>}
606
+ */
607
+ function reshare_split_commitment(commitment) {
608
+ const ptr0 = passArray8ToWasm0(commitment, wasm.__wbindgen_malloc);
609
+ const len0 = WASM_VECTOR_LEN;
610
+ const ret = wasm.reshare_split_commitment(ptr0, len0);
611
+ if (ret[2]) {
612
+ throw takeFromExternrefTable0(ret[1]);
613
+ }
614
+ return takeFromExternrefTable0(ret[0]);
615
+ }
616
+ exports.reshare_split_commitment = reshare_split_commitment;
617
+
618
+ /**
619
+ * The echo-broadcast transcript digest a member of the new participant set
620
+ * sends on `threshold-keygen-confirm` for a reshare -- the reshare analogue
621
+ * of `dkg_transcript_digest`, structurally distinct because a reshare's own
622
+ * survivor commitment (`survivor_commitments`' own entries, each the same
623
+ * whole-blob shape `reshare_round1`'s own `commitment` output is) carries
624
+ * no proof-of-knowledge component: deserializing one AS a DKG round-1
625
+ * `Package` fails outright, since the two are different wire shapes
626
+ * entirely.
627
+ * @param {Array<any>} survivor_ids
628
+ * @param {Array<any>} survivor_commitments
629
+ * @param {Uint8Array} group_verifying_key
630
+ * @returns {Uint8Array}
631
+ */
632
+ function reshare_transcript_digest(survivor_ids, survivor_commitments, group_verifying_key) {
633
+ const ptr0 = passArray8ToWasm0(group_verifying_key, wasm.__wbindgen_malloc);
634
+ const len0 = WASM_VECTOR_LEN;
635
+ const ret = wasm.reshare_transcript_digest(survivor_ids, survivor_commitments, ptr0, len0);
636
+ if (ret[3]) {
637
+ throw takeFromExternrefTable0(ret[2]);
638
+ }
639
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
640
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
641
+ return v2;
642
+ }
643
+ exports.reshare_transcript_digest = reshare_transcript_digest;
644
+
645
+ /**
646
+ * Coordinator-side: sums and verifies the collected shares into the final
647
+ * aggregate signature -- an ordinary 64-byte Ed25519 signature. See
648
+ * `wire_mesh_threshold::signing::aggregate`'s own doc comment for why a
649
+ * caller MUST treat any error here as "publish nothing".
650
+ * @param {Uint8Array} signing_package
651
+ * @param {Array<any>} ids
652
+ * @param {Array<any>} shares
653
+ * @param {Uint8Array} public_key_package
654
+ * @returns {Uint8Array}
655
+ */
656
+ function signing_aggregate(signing_package, ids, shares, public_key_package) {
657
+ const ptr0 = passArray8ToWasm0(signing_package, wasm.__wbindgen_malloc);
658
+ const len0 = WASM_VECTOR_LEN;
659
+ const ptr1 = passArray8ToWasm0(public_key_package, wasm.__wbindgen_malloc);
660
+ const len1 = WASM_VECTOR_LEN;
661
+ const ret = wasm.signing_aggregate(ptr0, len0, ids, shares, ptr1, len1);
662
+ if (ret[3]) {
663
+ throw takeFromExternrefTable0(ret[2]);
664
+ }
665
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
666
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
667
+ return v3;
668
+ }
669
+ exports.signing_aggregate = signing_aggregate;
670
+
671
+ /**
672
+ * Coordinator-side: builds the `SigningPackage` bytes every participant's
673
+ * round 2 is computed against.
674
+ * @param {Array<any>} ids
675
+ * @param {Array<any>} commitments
676
+ * @param {Uint8Array} message
677
+ * @returns {Uint8Array}
678
+ */
679
+ function signing_build_package(ids, commitments, message) {
680
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
681
+ const len0 = WASM_VECTOR_LEN;
682
+ const ret = wasm.signing_build_package(ids, commitments, ptr0, len0);
683
+ if (ret[3]) {
684
+ throw takeFromExternrefTable0(ret[2]);
685
+ }
686
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
687
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
688
+ return v2;
689
+ }
690
+ exports.signing_build_package = signing_build_package;
691
+
692
+ /**
693
+ * The pure-crypto half of round 1: generates a fresh nonce pair and its
694
+ * commitments. Persisting `nonces` durably before the caller's own
695
+ * round-1 response leaves the device is the CALLER's own obligation (see
696
+ * this module's own doc comment) -- this function has no storage
697
+ * dependency and cannot enforce it.
698
+ * @param {Uint8Array} own_key_package
699
+ * @returns {SigningRound1Output}
700
+ */
701
+ function signing_round1_commit(own_key_package) {
702
+ const ptr0 = passArray8ToWasm0(own_key_package, wasm.__wbindgen_malloc);
703
+ const len0 = WASM_VECTOR_LEN;
704
+ const ret = wasm.signing_round1_commit(ptr0, len0);
705
+ if (ret[2]) {
706
+ throw takeFromExternrefTable0(ret[1]);
707
+ }
708
+ return SigningRound1Output.__wrap(ret[0]);
709
+ }
710
+ exports.signing_round1_commit = signing_round1_commit;
711
+
712
+ /**
713
+ * Round 2: releases this participant's signature share. The CALLER MUST
714
+ * have already taken (one-shot, never re-readable) `nonces` from its own
715
+ * durable nonce store before calling this -- exactly as
716
+ * `wire_mesh_threshold::signing::round2_sign` requires on the Rust side.
717
+ * @param {Uint8Array} nonces
718
+ * @param {Uint8Array} signing_package
719
+ * @param {Uint8Array} own_key_package
720
+ * @returns {Uint8Array}
721
+ */
722
+ function signing_round2_sign(nonces, signing_package, own_key_package) {
723
+ const ptr0 = passArray8ToWasm0(nonces, wasm.__wbindgen_malloc);
724
+ const len0 = WASM_VECTOR_LEN;
725
+ const ptr1 = passArray8ToWasm0(signing_package, wasm.__wbindgen_malloc);
726
+ const len1 = WASM_VECTOR_LEN;
727
+ const ptr2 = passArray8ToWasm0(own_key_package, wasm.__wbindgen_malloc);
728
+ const len2 = WASM_VECTOR_LEN;
729
+ const ret = wasm.signing_round2_sign(ptr0, len0, ptr1, len1, ptr2, len2);
730
+ if (ret[3]) {
731
+ throw takeFromExternrefTable0(ret[2]);
732
+ }
733
+ var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
734
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
735
+ return v4;
736
+ }
737
+ exports.signing_round2_sign = signing_round2_sign;
738
+
739
+ /**
740
+ * Splits a serialized `SigningCommitments` (`signing_round1_commit`'s own
741
+ * `commitments` output) into the two independently-serialized halves
742
+ * `threshold-commitment`'s wire shape carries (`hiding: bstr, binding:
743
+ * bstr`) -- unlike frost-core's own combined-blob serialization, which is
744
+ * opaque and not spec-shaped. The inverse of [`combine_commitments`].
745
+ * @param {Uint8Array} commitments
746
+ * @returns {SplitCommitmentsOutput}
747
+ */
748
+ function split_commitments(commitments) {
749
+ const ptr0 = passArray8ToWasm0(commitments, wasm.__wbindgen_malloc);
750
+ const len0 = WASM_VECTOR_LEN;
751
+ const ret = wasm.split_commitments(ptr0, len0);
752
+ if (ret[2]) {
753
+ throw takeFromExternrefTable0(ret[1]);
754
+ }
755
+ return SplitCommitmentsOutput.__wrap(ret[0]);
756
+ }
757
+ exports.split_commitments = split_commitments;
758
+
759
+ /**
760
+ * Splits a serialized DKG round-1 `Package` (`dkg_round1`'s own `package`
761
+ * output) into `threshold-keygen-round1`'s own wire shape: the Feldman
762
+ * commitment as an array of independently-serialized coefficients
763
+ * (`commitment: [* bstr]`) and the Schnorr proof of knowledge as a
764
+ * separate byte string -- unlike frost-core's own combined-blob
765
+ * serialization. The inverse of [`combine_round1_package`].
766
+ * @param {Uint8Array} _package
767
+ * @returns {SplitRound1PackageOutput}
768
+ */
769
+ function split_round1_package(_package) {
770
+ const ptr0 = passArray8ToWasm0(_package, wasm.__wbindgen_malloc);
771
+ const len0 = WASM_VECTOR_LEN;
772
+ const ret = wasm.split_round1_package(ptr0, len0);
773
+ if (ret[2]) {
774
+ throw takeFromExternrefTable0(ret[1]);
775
+ }
776
+ return SplitRound1PackageOutput.__wrap(ret[0]);
777
+ }
778
+ exports.split_round1_package = split_round1_package;
779
+ function __wbg_get_imports() {
780
+ const import0 = {
781
+ __proto__: null,
782
+ __wbg___wbindgen_is_function_fcda5e3902d732fe: function(arg0) {
783
+ const ret = typeof(arg0) === 'function';
784
+ return ret;
785
+ },
786
+ __wbg___wbindgen_is_object_edb6b15aa3afe12e: function(arg0) {
787
+ const val = arg0;
788
+ const ret = typeof(val) === 'object' && val !== null;
789
+ return ret;
790
+ },
791
+ __wbg___wbindgen_is_string_c4f7cb494a2a21f1: function(arg0) {
792
+ const ret = typeof(arg0) === 'string';
793
+ return ret;
794
+ },
795
+ __wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
796
+ const ret = arg0 === undefined;
797
+ return ret;
798
+ },
799
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
800
+ throw new Error(getStringFromWasm0(arg0, arg1));
801
+ },
802
+ __wbg_call_6bcf8d3e20937e46: function() { return handleError(function (arg0, arg1, arg2) {
803
+ const ret = arg0.call(arg1, arg2);
804
+ return ret;
805
+ }, arguments); },
806
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
807
+ const ret = arg0.crypto;
808
+ return ret;
809
+ },
810
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
811
+ arg0.getRandomValues(arg1);
812
+ }, arguments); },
813
+ __wbg_get_unchecked_363572bdd397d473: function(arg0, arg1) {
814
+ const ret = arg0[arg1 >>> 0];
815
+ return ret;
816
+ },
817
+ __wbg_instanceof_Uint8Array_598adc0fef426aa8: function(arg0) {
818
+ let result;
819
+ try {
820
+ result = arg0 instanceof Uint8Array;
821
+ } catch (_) {
822
+ result = false;
823
+ }
824
+ const ret = result;
825
+ return ret;
826
+ },
827
+ __wbg_length_31bdaf014f5fbde2: function(arg0) {
828
+ const ret = arg0.length;
829
+ return ret;
830
+ },
831
+ __wbg_length_4e1adc0d42e23620: function(arg0) {
832
+ const ret = arg0.length;
833
+ return ret;
834
+ },
835
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
836
+ const ret = arg0.msCrypto;
837
+ return ret;
838
+ },
839
+ __wbg_new_ffa92086ea89f79c: function() {
840
+ const ret = new Array();
841
+ return ret;
842
+ },
843
+ __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
844
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
845
+ return ret;
846
+ },
847
+ __wbg_new_with_length_5ffeddb9d9fbb96f: function(arg0) {
848
+ const ret = new Uint8Array(arg0 >>> 0);
849
+ return ret;
850
+ },
851
+ __wbg_node_84ea875411254db1: function(arg0) {
852
+ const ret = arg0.node;
853
+ return ret;
854
+ },
855
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
856
+ const ret = arg0.process;
857
+ return ret;
858
+ },
859
+ __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
860
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
861
+ },
862
+ __wbg_push_bfdf956ba476f65b: function(arg0, arg1) {
863
+ const ret = arg0.push(arg1);
864
+ return ret;
865
+ },
866
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
867
+ arg0.randomFillSync(arg1);
868
+ }, arguments); },
869
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
870
+ const ret = module.require;
871
+ return ret;
872
+ }, arguments); },
873
+ __wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
874
+ const ret = typeof global === 'undefined' ? null : global;
875
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
876
+ },
877
+ __wbg_static_accessor_GLOBAL_THIS_1e7044f654e934db: function() {
878
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
879
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
880
+ },
881
+ __wbg_static_accessor_SELF_d8b50611246a6d92: function() {
882
+ const ret = typeof self === 'undefined' ? null : self;
883
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
884
+ },
885
+ __wbg_static_accessor_WINDOW_fd0bc376bf0f8b42: function() {
886
+ const ret = typeof window === 'undefined' ? null : window;
887
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
888
+ },
889
+ __wbg_subarray_1daff70dde20c145: function(arg0, arg1, arg2) {
890
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
891
+ return ret;
892
+ },
893
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
894
+ const ret = arg0.versions;
895
+ return ret;
896
+ },
897
+ __wbindgen_generic_0000000000000001: function(arg0, arg1) {
898
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
899
+ const ret = getArrayU8FromWasm0(arg0, arg1);
900
+ return ret;
901
+ },
902
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
903
+ // Cast intrinsic for `Ref(String) -> Externref`.
904
+ const ret = getStringFromWasm0(arg0, arg1);
905
+ return ret;
906
+ },
907
+ __wbindgen_init_externref_table: function() {
908
+ const table = wasm.__wbindgen_externrefs;
909
+ const offset = table.grow(4);
910
+ table.set(0, undefined);
911
+ table.set(offset + 0, undefined);
912
+ table.set(offset + 1, null);
913
+ table.set(offset + 2, true);
914
+ table.set(offset + 3, false);
915
+ },
916
+ };
917
+ return {
918
+ __proto__: null,
919
+ "./wire_mesh_threshold_wasm_bg.js": import0,
920
+ };
921
+ }
922
+
923
+ const DkgRound1OutputFinalization = (typeof FinalizationRegistry === 'undefined')
924
+ ? { register: () => {}, unregister: () => {} }
925
+ : new FinalizationRegistry(ptr => wasm.__wbg_dkground1output_free(ptr, 1));
926
+ const DkgRound2OutputFinalization = (typeof FinalizationRegistry === 'undefined')
927
+ ? { register: () => {}, unregister: () => {} }
928
+ : new FinalizationRegistry(ptr => wasm.__wbg_dkground2output_free(ptr, 1));
929
+ const DkgRound3OutputFinalization = (typeof FinalizationRegistry === 'undefined')
930
+ ? { register: () => {}, unregister: () => {} }
931
+ : new FinalizationRegistry(ptr => wasm.__wbg_dkground3output_free(ptr, 1));
932
+ const ReshareDerivePublicKeyPackageOutputFinalization = (typeof FinalizationRegistry === 'undefined')
933
+ ? { register: () => {}, unregister: () => {} }
934
+ : new FinalizationRegistry(ptr => wasm.__wbg_resharederivepublickeypackageoutput_free(ptr, 1));
935
+ const ReshareRound1OutputFinalization = (typeof FinalizationRegistry === 'undefined')
936
+ ? { register: () => {}, unregister: () => {} }
937
+ : new FinalizationRegistry(ptr => wasm.__wbg_reshareround1output_free(ptr, 1));
938
+ const SigningRound1OutputFinalization = (typeof FinalizationRegistry === 'undefined')
939
+ ? { register: () => {}, unregister: () => {} }
940
+ : new FinalizationRegistry(ptr => wasm.__wbg_signinground1output_free(ptr, 1));
941
+ const SplitCommitmentsOutputFinalization = (typeof FinalizationRegistry === 'undefined')
942
+ ? { register: () => {}, unregister: () => {} }
943
+ : new FinalizationRegistry(ptr => wasm.__wbg_splitcommitmentsoutput_free(ptr, 1));
944
+ const SplitRound1PackageOutputFinalization = (typeof FinalizationRegistry === 'undefined')
945
+ ? { register: () => {}, unregister: () => {} }
946
+ : new FinalizationRegistry(ptr => wasm.__wbg_splitround1packageoutput_free(ptr, 1));
947
+
948
+ function addToExternrefTable0(obj) {
949
+ const idx = wasm.__externref_table_alloc();
950
+ wasm.__wbindgen_externrefs.set(idx, obj);
951
+ return idx;
952
+ }
953
+
954
+ function getArrayU8FromWasm0(ptr, len) {
955
+ ptr = ptr >>> 0;
956
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
957
+ }
958
+
959
+ function getStringFromWasm0(ptr, len) {
960
+ return decodeText(ptr >>> 0, len);
961
+ }
962
+
963
+ let cachedUint8ArrayMemory0 = null;
964
+ function getUint8ArrayMemory0() {
965
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
966
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
967
+ }
968
+ return cachedUint8ArrayMemory0;
969
+ }
970
+
971
+ function handleError(f, args) {
972
+ try {
973
+ return f.apply(this, args);
974
+ } catch (e) {
975
+ const idx = addToExternrefTable0(e);
976
+ wasm.__wbindgen_exn_store(idx);
977
+ }
978
+ }
979
+
980
+ function isLikeNone(x) {
981
+ return x === undefined || x === null;
982
+ }
983
+
984
+ function passArray8ToWasm0(arg, malloc) {
985
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
986
+ getUint8ArrayMemory0().set(arg, ptr / 1);
987
+ WASM_VECTOR_LEN = arg.length;
988
+ return ptr;
989
+ }
990
+
991
+ function takeFromExternrefTable0(idx) {
992
+ const value = wasm.__wbindgen_externrefs.get(idx);
993
+ wasm.__externref_table_dealloc(idx);
994
+ return value;
995
+ }
996
+
997
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
998
+ cachedTextDecoder.decode();
999
+ function decodeText(ptr, len) {
1000
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1001
+ }
1002
+
1003
+ let WASM_VECTOR_LEN = 0;
1004
+
1005
+ const wasmPath = `${__dirname}/wire_mesh_threshold_wasm_bg.wasm`;
1006
+ const wasmBytes = require('fs').readFileSync(wasmPath);
1007
+ const wasmModule = new WebAssembly.Module(wasmBytes);
1008
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
1009
+ let wasm = wasmInstance.exports;
1010
+ wasm.__wbindgen_start();
@@ -0,0 +1,58 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_dkground1output_free: (a: number, b: number) => void;
5
+ export const __wbg_dkground2output_free: (a: number, b: number) => void;
6
+ export const __wbg_dkground3output_free: (a: number, b: number) => void;
7
+ export const __wbg_resharederivepublickeypackageoutput_free: (a: number, b: number) => void;
8
+ export const __wbg_reshareround1output_free: (a: number, b: number) => void;
9
+ export const __wbg_signinground1output_free: (a: number, b: number) => void;
10
+ export const __wbg_splitcommitmentsoutput_free: (a: number, b: number) => void;
11
+ export const __wbg_splitround1packageoutput_free: (a: number, b: number) => void;
12
+ export const combine_commitments: (a: number, b: number, c: number, d: number) => [number, number, number, number];
13
+ export const combine_round1_package: (a: any, b: number, c: number) => [number, number, number, number];
14
+ export const dkg_confirm_matches: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
15
+ export const dkg_round1: (a: number, b: number, c: number, d: number) => [number, number, number];
16
+ export const dkg_round2: (a: number, b: number, c: any, d: any) => [number, number, number];
17
+ export const dkg_round3: (a: number, b: number, c: any, d: any, e: any, f: any) => [number, number, number];
18
+ export const dkg_transcript_digest: (a: any, b: any, c: number, d: number) => [number, number, number, number];
19
+ export const dkground1output_package: (a: number) => [number, number];
20
+ export const dkground1output_secretPackage: (a: number) => [number, number];
21
+ export const dkground2output_packages: (a: number) => any;
22
+ export const dkground2output_recipientIds: (a: number) => any;
23
+ export const dkground2output_secretPackage: (a: number) => [number, number];
24
+ export const dkground3output_groupVerifyingKey: (a: number) => [number, number];
25
+ export const dkground3output_keyPackage: (a: number) => [number, number];
26
+ export const dkground3output_publicKeyPackage: (a: number) => [number, number];
27
+ export const key_package_signing_share: (a: number, b: number) => [number, number, number, number];
28
+ export const reshare_combine_commitment_parts: (a: any) => [number, number, number, number];
29
+ export const reshare_combine_commitments: (a: any) => [number, number, number, number];
30
+ export const reshare_combine_received_shares: (a: number, b: number, c: any, d: number, e: number, f: number) => [number, number, number, number];
31
+ export const reshare_derive_public_key_package: (a: number, b: number, c: any) => [number, number, number];
32
+ export const reshare_round1: (a: number, b: number, c: number, d: number, e: any, f: any, g: number) => [number, number, number];
33
+ export const reshare_split_commitment: (a: number, b: number) => [number, number, number];
34
+ export const reshare_transcript_digest: (a: any, b: any, c: number, d: number) => [number, number, number, number];
35
+ export const resharederivepublickeypackageoutput_groupVerifyingKey: (a: number) => [number, number];
36
+ export const resharederivepublickeypackageoutput_publicKeyPackage: (a: number) => [number, number];
37
+ export const reshareround1output_commitment: (a: number) => [number, number];
38
+ export const reshareround1output_recipientIds: (a: number) => any;
39
+ export const reshareround1output_shares: (a: number) => any;
40
+ export const signing_aggregate: (a: number, b: number, c: any, d: any, e: number, f: number) => [number, number, number, number];
41
+ export const signing_build_package: (a: any, b: any, c: number, d: number) => [number, number, number, number];
42
+ export const signing_round1_commit: (a: number, b: number) => [number, number, number];
43
+ export const signing_round2_sign: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
44
+ export const signinground1output_commitments: (a: number) => [number, number];
45
+ export const signinground1output_nonces: (a: number) => [number, number];
46
+ export const split_commitments: (a: number, b: number) => [number, number, number];
47
+ export const split_round1_package: (a: number, b: number) => [number, number, number];
48
+ export const splitcommitmentsoutput_binding: (a: number) => [number, number];
49
+ export const splitcommitmentsoutput_hiding: (a: number) => [number, number];
50
+ export const splitround1packageoutput_commitment: (a: number) => any;
51
+ export const splitround1packageoutput_proofOfKnowledge: (a: number) => [number, number];
52
+ export const __wbindgen_exn_store: (a: number) => void;
53
+ export const __externref_table_alloc: () => number;
54
+ export const __wbindgen_externrefs: WebAssembly.Table;
55
+ export const __wbindgen_malloc: (a: number, b: number) => number;
56
+ export const __externref_table_dealloc: (a: number) => void;
57
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
58
+ export const __wbindgen_start: () => void;