@bitgo/wasm-mps 1.6.0 → 1.8.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.
- package/dist/cjs/js/wasm/wasm_mps.d.ts +1 -0
- package/dist/cjs/js/wasm/wasm_mps.js +18 -2
- package/dist/cjs/js/wasm/wasm_mps_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_mps_bg.wasm.d.ts +2 -1
- package/dist/esm/js/wasm/wasm_mps.d.ts +1 -0
- package/dist/esm/js/wasm/wasm_mps_bg.js +18 -2
- package/dist/esm/js/wasm/wasm_mps_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_mps_bg.wasm.d.ts +2 -1
- package/dist/web/js/wasm/wasm_mps.d.ts +91 -0
- package/dist/web/js/wasm/wasm_mps.js +704 -0
- package/dist/web/js/wasm/wasm_mps_bg.wasm +0 -0
- package/dist/web/js/wasm/wasm_mps_bg.wasm.d.ts +25 -0
- package/package.json +8 -3
|
@@ -110,13 +110,29 @@ class Share {
|
|
|
110
110
|
const ptr = this.__destroy_into_raw();
|
|
111
111
|
wasm.__wbg_share_free(ptr, 0);
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* @returns {Uint8Array}
|
|
115
|
+
*/
|
|
116
|
+
get chaincode() {
|
|
117
|
+
try {
|
|
118
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
119
|
+
wasm.share_chaincode(retptr, this.__wbg_ptr);
|
|
120
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
121
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
122
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
123
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
124
|
+
return v1;
|
|
125
|
+
} finally {
|
|
126
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
113
129
|
/**
|
|
114
130
|
* @returns {Uint8Array}
|
|
115
131
|
*/
|
|
116
132
|
get pk() {
|
|
117
133
|
try {
|
|
118
134
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
119
|
-
wasm.
|
|
135
|
+
wasm.share_pk(retptr, this.__wbg_ptr);
|
|
120
136
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
121
137
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
122
138
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
@@ -132,7 +148,7 @@ class Share {
|
|
|
132
148
|
get share() {
|
|
133
149
|
try {
|
|
134
150
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
135
|
-
wasm.
|
|
151
|
+
wasm.share_share(retptr, this.__wbg_ptr);
|
|
136
152
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
137
153
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
138
154
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
Binary file
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_msgshare_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_msgstate_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_share_free: (a: number, b: number) => void;
|
|
6
7
|
export const ed25519_dkg_round0_process: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
7
8
|
export const ed25519_dkg_round1_process: (a: number, b: number, c: number, d: number) => void;
|
|
8
9
|
export const ed25519_dkg_round2_process: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -14,7 +15,7 @@ export const msgshare_msg: (a: number, b: number) => void;
|
|
|
14
15
|
export const msgshare_share: (a: number) => number;
|
|
15
16
|
export const msgstate_msg: (a: number, b: number) => void;
|
|
16
17
|
export const msgstate_state: (a: number, b: number) => void;
|
|
17
|
-
export const
|
|
18
|
+
export const share_chaincode: (a: number, b: number) => void;
|
|
18
19
|
export const share_pk: (a: number, b: number) => void;
|
|
19
20
|
export const share_share: (a: number, b: number) => void;
|
|
20
21
|
export const __wbindgen_export: (a: number) => void;
|
|
@@ -106,13 +106,29 @@ export class Share {
|
|
|
106
106
|
const ptr = this.__destroy_into_raw();
|
|
107
107
|
wasm.__wbg_share_free(ptr, 0);
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* @returns {Uint8Array}
|
|
111
|
+
*/
|
|
112
|
+
get chaincode() {
|
|
113
|
+
try {
|
|
114
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
115
|
+
wasm.share_chaincode(retptr, this.__wbg_ptr);
|
|
116
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
117
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
118
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
119
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
120
|
+
return v1;
|
|
121
|
+
} finally {
|
|
122
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
109
125
|
/**
|
|
110
126
|
* @returns {Uint8Array}
|
|
111
127
|
*/
|
|
112
128
|
get pk() {
|
|
113
129
|
try {
|
|
114
130
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
115
|
-
wasm.
|
|
131
|
+
wasm.share_pk(retptr, this.__wbg_ptr);
|
|
116
132
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
117
133
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
118
134
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
@@ -128,7 +144,7 @@ export class Share {
|
|
|
128
144
|
get share() {
|
|
129
145
|
try {
|
|
130
146
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
131
|
-
wasm.
|
|
147
|
+
wasm.share_share(retptr, this.__wbg_ptr);
|
|
132
148
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
133
149
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
134
150
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
Binary file
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_msgshare_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_msgstate_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_share_free: (a: number, b: number) => void;
|
|
6
7
|
export const ed25519_dkg_round0_process: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
7
8
|
export const ed25519_dkg_round1_process: (a: number, b: number, c: number, d: number) => void;
|
|
8
9
|
export const ed25519_dkg_round2_process: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -14,7 +15,7 @@ export const msgshare_msg: (a: number, b: number) => void;
|
|
|
14
15
|
export const msgshare_share: (a: number) => number;
|
|
15
16
|
export const msgstate_msg: (a: number, b: number) => void;
|
|
16
17
|
export const msgstate_state: (a: number, b: number) => void;
|
|
17
|
-
export const
|
|
18
|
+
export const share_chaincode: (a: number, b: number) => void;
|
|
18
19
|
export const share_pk: (a: number, b: number) => void;
|
|
19
20
|
export const share_share: (a: number, b: number) => void;
|
|
20
21
|
export const __wbindgen_export: (a: number) => void;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class MsgShare {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
readonly msg: Uint8Array;
|
|
9
|
+
readonly share: Share;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class MsgState {
|
|
13
|
+
private constructor();
|
|
14
|
+
free(): void;
|
|
15
|
+
[Symbol.dispose](): void;
|
|
16
|
+
readonly msg: Uint8Array;
|
|
17
|
+
readonly state: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class Share {
|
|
21
|
+
private constructor();
|
|
22
|
+
free(): void;
|
|
23
|
+
[Symbol.dispose](): void;
|
|
24
|
+
readonly chaincode: Uint8Array;
|
|
25
|
+
readonly pk: Uint8Array;
|
|
26
|
+
readonly share: Uint8Array;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function ed25519_dkg_round0_process(party_id: number, decryption_key: Uint8Array, encryption_keys: Array<any>, seed: Uint8Array): MsgState;
|
|
30
|
+
|
|
31
|
+
export function ed25519_dkg_round1_process(round1_messages: Array<any>, state: Uint8Array): MsgState;
|
|
32
|
+
|
|
33
|
+
export function ed25519_dkg_round2_process(round2_messages: Array<any>, state: Uint8Array): Share;
|
|
34
|
+
|
|
35
|
+
export function ed25519_dsg_round0_process(share: Uint8Array, derivation_path: string, message: Uint8Array): MsgState;
|
|
36
|
+
|
|
37
|
+
export function ed25519_dsg_round1_process(round1_message: Uint8Array, state: Uint8Array): MsgState;
|
|
38
|
+
|
|
39
|
+
export function ed25519_dsg_round2_process(round2_message: Uint8Array, state: Uint8Array): MsgState;
|
|
40
|
+
|
|
41
|
+
export function ed25519_dsg_round3_process(round2_message: Uint8Array, state: Uint8Array): Uint8Array;
|
|
42
|
+
|
|
43
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
44
|
+
|
|
45
|
+
export interface InitOutput {
|
|
46
|
+
readonly memory: WebAssembly.Memory;
|
|
47
|
+
readonly __wbg_msgshare_free: (a: number, b: number) => void;
|
|
48
|
+
readonly __wbg_msgstate_free: (a: number, b: number) => void;
|
|
49
|
+
readonly __wbg_share_free: (a: number, b: number) => void;
|
|
50
|
+
readonly ed25519_dkg_round0_process: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
51
|
+
readonly ed25519_dkg_round1_process: (a: number, b: number, c: number, d: number) => void;
|
|
52
|
+
readonly ed25519_dkg_round2_process: (a: number, b: number, c: number, d: number) => void;
|
|
53
|
+
readonly ed25519_dsg_round0_process: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
54
|
+
readonly ed25519_dsg_round1_process: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
55
|
+
readonly ed25519_dsg_round2_process: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
56
|
+
readonly ed25519_dsg_round3_process: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
57
|
+
readonly msgshare_msg: (a: number, b: number) => void;
|
|
58
|
+
readonly msgshare_share: (a: number) => number;
|
|
59
|
+
readonly msgstate_msg: (a: number, b: number) => void;
|
|
60
|
+
readonly msgstate_state: (a: number, b: number) => void;
|
|
61
|
+
readonly share_chaincode: (a: number, b: number) => void;
|
|
62
|
+
readonly share_pk: (a: number, b: number) => void;
|
|
63
|
+
readonly share_share: (a: number, b: number) => void;
|
|
64
|
+
readonly __wbindgen_export: (a: number) => void;
|
|
65
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
66
|
+
readonly __wbindgen_export2: (a: number, b: number) => number;
|
|
67
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
68
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
75
|
+
* a precompiled `WebAssembly.Module`.
|
|
76
|
+
*
|
|
77
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
78
|
+
*
|
|
79
|
+
* @returns {InitOutput}
|
|
80
|
+
*/
|
|
81
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
85
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
86
|
+
*
|
|
87
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
88
|
+
*
|
|
89
|
+
* @returns {Promise<InitOutput>}
|
|
90
|
+
*/
|
|
91
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
/* @ts-self-types="./wasm_mps.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class MsgShare {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
MsgShareFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_msgshare_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Uint8Array}
|
|
16
|
+
*/
|
|
17
|
+
get msg() {
|
|
18
|
+
try {
|
|
19
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
20
|
+
wasm.msgshare_msg(retptr, this.__wbg_ptr);
|
|
21
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
22
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
23
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
24
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
25
|
+
return v1;
|
|
26
|
+
} finally {
|
|
27
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @returns {Share}
|
|
32
|
+
*/
|
|
33
|
+
get share() {
|
|
34
|
+
const ret = wasm.msgshare_share(this.__wbg_ptr);
|
|
35
|
+
return Share.__wrap(ret);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (Symbol.dispose) MsgShare.prototype[Symbol.dispose] = MsgShare.prototype.free;
|
|
39
|
+
|
|
40
|
+
export class MsgState {
|
|
41
|
+
static __wrap(ptr) {
|
|
42
|
+
ptr = ptr >>> 0;
|
|
43
|
+
const obj = Object.create(MsgState.prototype);
|
|
44
|
+
obj.__wbg_ptr = ptr;
|
|
45
|
+
MsgStateFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
__destroy_into_raw() {
|
|
49
|
+
const ptr = this.__wbg_ptr;
|
|
50
|
+
this.__wbg_ptr = 0;
|
|
51
|
+
MsgStateFinalization.unregister(this);
|
|
52
|
+
return ptr;
|
|
53
|
+
}
|
|
54
|
+
free() {
|
|
55
|
+
const ptr = this.__destroy_into_raw();
|
|
56
|
+
wasm.__wbg_msgstate_free(ptr, 0);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @returns {Uint8Array}
|
|
60
|
+
*/
|
|
61
|
+
get msg() {
|
|
62
|
+
try {
|
|
63
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
64
|
+
wasm.msgstate_msg(retptr, this.__wbg_ptr);
|
|
65
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
66
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
67
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
68
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
69
|
+
return v1;
|
|
70
|
+
} finally {
|
|
71
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @returns {Uint8Array}
|
|
76
|
+
*/
|
|
77
|
+
get state() {
|
|
78
|
+
try {
|
|
79
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
80
|
+
wasm.msgstate_state(retptr, this.__wbg_ptr);
|
|
81
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
82
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
83
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
84
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
85
|
+
return v1;
|
|
86
|
+
} finally {
|
|
87
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (Symbol.dispose) MsgState.prototype[Symbol.dispose] = MsgState.prototype.free;
|
|
92
|
+
|
|
93
|
+
export class Share {
|
|
94
|
+
static __wrap(ptr) {
|
|
95
|
+
ptr = ptr >>> 0;
|
|
96
|
+
const obj = Object.create(Share.prototype);
|
|
97
|
+
obj.__wbg_ptr = ptr;
|
|
98
|
+
ShareFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
99
|
+
return obj;
|
|
100
|
+
}
|
|
101
|
+
__destroy_into_raw() {
|
|
102
|
+
const ptr = this.__wbg_ptr;
|
|
103
|
+
this.__wbg_ptr = 0;
|
|
104
|
+
ShareFinalization.unregister(this);
|
|
105
|
+
return ptr;
|
|
106
|
+
}
|
|
107
|
+
free() {
|
|
108
|
+
const ptr = this.__destroy_into_raw();
|
|
109
|
+
wasm.__wbg_share_free(ptr, 0);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @returns {Uint8Array}
|
|
113
|
+
*/
|
|
114
|
+
get chaincode() {
|
|
115
|
+
try {
|
|
116
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
117
|
+
wasm.share_chaincode(retptr, this.__wbg_ptr);
|
|
118
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
119
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
120
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
121
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
122
|
+
return v1;
|
|
123
|
+
} finally {
|
|
124
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @returns {Uint8Array}
|
|
129
|
+
*/
|
|
130
|
+
get pk() {
|
|
131
|
+
try {
|
|
132
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
133
|
+
wasm.share_pk(retptr, this.__wbg_ptr);
|
|
134
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
135
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
136
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
137
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
138
|
+
return v1;
|
|
139
|
+
} finally {
|
|
140
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @returns {Uint8Array}
|
|
145
|
+
*/
|
|
146
|
+
get share() {
|
|
147
|
+
try {
|
|
148
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
149
|
+
wasm.share_share(retptr, this.__wbg_ptr);
|
|
150
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
151
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
152
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
153
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
154
|
+
return v1;
|
|
155
|
+
} finally {
|
|
156
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (Symbol.dispose) Share.prototype[Symbol.dispose] = Share.prototype.free;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @param {number} party_id
|
|
164
|
+
* @param {Uint8Array} decryption_key
|
|
165
|
+
* @param {Array<any>} encryption_keys
|
|
166
|
+
* @param {Uint8Array} seed
|
|
167
|
+
* @returns {MsgState}
|
|
168
|
+
*/
|
|
169
|
+
export function ed25519_dkg_round0_process(party_id, decryption_key, encryption_keys, seed) {
|
|
170
|
+
try {
|
|
171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
172
|
+
const ptr0 = passArray8ToWasm0(decryption_key, wasm.__wbindgen_export2);
|
|
173
|
+
const len0 = WASM_VECTOR_LEN;
|
|
174
|
+
const ptr1 = passArray8ToWasm0(seed, wasm.__wbindgen_export2);
|
|
175
|
+
const len1 = WASM_VECTOR_LEN;
|
|
176
|
+
wasm.ed25519_dkg_round0_process(retptr, party_id, ptr0, len0, addHeapObject(encryption_keys), ptr1, len1);
|
|
177
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
178
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
179
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
180
|
+
if (r2) {
|
|
181
|
+
throw takeObject(r1);
|
|
182
|
+
}
|
|
183
|
+
return MsgState.__wrap(r0);
|
|
184
|
+
} finally {
|
|
185
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @param {Array<any>} round1_messages
|
|
191
|
+
* @param {Uint8Array} state
|
|
192
|
+
* @returns {MsgState}
|
|
193
|
+
*/
|
|
194
|
+
export function ed25519_dkg_round1_process(round1_messages, state) {
|
|
195
|
+
try {
|
|
196
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
197
|
+
const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
|
|
198
|
+
const len0 = WASM_VECTOR_LEN;
|
|
199
|
+
wasm.ed25519_dkg_round1_process(retptr, addHeapObject(round1_messages), ptr0, len0);
|
|
200
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
201
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
202
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
203
|
+
if (r2) {
|
|
204
|
+
throw takeObject(r1);
|
|
205
|
+
}
|
|
206
|
+
return MsgState.__wrap(r0);
|
|
207
|
+
} finally {
|
|
208
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @param {Array<any>} round2_messages
|
|
214
|
+
* @param {Uint8Array} state
|
|
215
|
+
* @returns {Share}
|
|
216
|
+
*/
|
|
217
|
+
export function ed25519_dkg_round2_process(round2_messages, state) {
|
|
218
|
+
try {
|
|
219
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
220
|
+
const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
|
|
221
|
+
const len0 = WASM_VECTOR_LEN;
|
|
222
|
+
wasm.ed25519_dkg_round2_process(retptr, addHeapObject(round2_messages), ptr0, len0);
|
|
223
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
224
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
225
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
226
|
+
if (r2) {
|
|
227
|
+
throw takeObject(r1);
|
|
228
|
+
}
|
|
229
|
+
return Share.__wrap(r0);
|
|
230
|
+
} finally {
|
|
231
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @param {Uint8Array} share
|
|
237
|
+
* @param {string} derivation_path
|
|
238
|
+
* @param {Uint8Array} message
|
|
239
|
+
* @returns {MsgState}
|
|
240
|
+
*/
|
|
241
|
+
export function ed25519_dsg_round0_process(share, derivation_path, message) {
|
|
242
|
+
try {
|
|
243
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
244
|
+
const ptr0 = passArray8ToWasm0(share, wasm.__wbindgen_export2);
|
|
245
|
+
const len0 = WASM_VECTOR_LEN;
|
|
246
|
+
const ptr1 = passStringToWasm0(derivation_path, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
247
|
+
const len1 = WASM_VECTOR_LEN;
|
|
248
|
+
const ptr2 = passArray8ToWasm0(message, wasm.__wbindgen_export2);
|
|
249
|
+
const len2 = WASM_VECTOR_LEN;
|
|
250
|
+
wasm.ed25519_dsg_round0_process(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
251
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
252
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
253
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
254
|
+
if (r2) {
|
|
255
|
+
throw takeObject(r1);
|
|
256
|
+
}
|
|
257
|
+
return MsgState.__wrap(r0);
|
|
258
|
+
} finally {
|
|
259
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @param {Uint8Array} round1_message
|
|
265
|
+
* @param {Uint8Array} state
|
|
266
|
+
* @returns {MsgState}
|
|
267
|
+
*/
|
|
268
|
+
export function ed25519_dsg_round1_process(round1_message, state) {
|
|
269
|
+
try {
|
|
270
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
271
|
+
const ptr0 = passArray8ToWasm0(round1_message, wasm.__wbindgen_export2);
|
|
272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
273
|
+
const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
|
|
274
|
+
const len1 = WASM_VECTOR_LEN;
|
|
275
|
+
wasm.ed25519_dsg_round1_process(retptr, ptr0, len0, ptr1, len1);
|
|
276
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
277
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
278
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
279
|
+
if (r2) {
|
|
280
|
+
throw takeObject(r1);
|
|
281
|
+
}
|
|
282
|
+
return MsgState.__wrap(r0);
|
|
283
|
+
} finally {
|
|
284
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @param {Uint8Array} round2_message
|
|
290
|
+
* @param {Uint8Array} state
|
|
291
|
+
* @returns {MsgState}
|
|
292
|
+
*/
|
|
293
|
+
export function ed25519_dsg_round2_process(round2_message, state) {
|
|
294
|
+
try {
|
|
295
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
296
|
+
const ptr0 = passArray8ToWasm0(round2_message, wasm.__wbindgen_export2);
|
|
297
|
+
const len0 = WASM_VECTOR_LEN;
|
|
298
|
+
const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
|
|
299
|
+
const len1 = WASM_VECTOR_LEN;
|
|
300
|
+
wasm.ed25519_dsg_round2_process(retptr, ptr0, len0, ptr1, len1);
|
|
301
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
302
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
303
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
304
|
+
if (r2) {
|
|
305
|
+
throw takeObject(r1);
|
|
306
|
+
}
|
|
307
|
+
return MsgState.__wrap(r0);
|
|
308
|
+
} finally {
|
|
309
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @param {Uint8Array} round2_message
|
|
315
|
+
* @param {Uint8Array} state
|
|
316
|
+
* @returns {Uint8Array}
|
|
317
|
+
*/
|
|
318
|
+
export function ed25519_dsg_round3_process(round2_message, state) {
|
|
319
|
+
try {
|
|
320
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
321
|
+
const ptr0 = passArray8ToWasm0(round2_message, wasm.__wbindgen_export2);
|
|
322
|
+
const len0 = WASM_VECTOR_LEN;
|
|
323
|
+
const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_export2);
|
|
324
|
+
const len1 = WASM_VECTOR_LEN;
|
|
325
|
+
wasm.ed25519_dsg_round3_process(retptr, ptr0, len0, ptr1, len1);
|
|
326
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
327
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
328
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
329
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
330
|
+
if (r3) {
|
|
331
|
+
throw takeObject(r2);
|
|
332
|
+
}
|
|
333
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
334
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
335
|
+
return v3;
|
|
336
|
+
} finally {
|
|
337
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function __wbg_get_imports() {
|
|
342
|
+
const import0 = {
|
|
343
|
+
__proto__: null,
|
|
344
|
+
__wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
|
|
345
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
346
|
+
return ret;
|
|
347
|
+
},
|
|
348
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
349
|
+
const val = getObject(arg0);
|
|
350
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
351
|
+
return ret;
|
|
352
|
+
},
|
|
353
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
354
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
355
|
+
return ret;
|
|
356
|
+
},
|
|
357
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
358
|
+
const ret = getObject(arg0) === undefined;
|
|
359
|
+
return ret;
|
|
360
|
+
},
|
|
361
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
362
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
363
|
+
},
|
|
364
|
+
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
365
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
366
|
+
return addHeapObject(ret);
|
|
367
|
+
}, arguments); },
|
|
368
|
+
__wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
|
|
369
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
370
|
+
return addHeapObject(ret);
|
|
371
|
+
}, arguments); },
|
|
372
|
+
__wbg_crypto_86f2631e91b51511: function(arg0) {
|
|
373
|
+
const ret = getObject(arg0).crypto;
|
|
374
|
+
return addHeapObject(ret);
|
|
375
|
+
},
|
|
376
|
+
__wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
|
|
377
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
378
|
+
}, arguments); },
|
|
379
|
+
__wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
|
|
380
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
381
|
+
return addHeapObject(ret);
|
|
382
|
+
},
|
|
383
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
384
|
+
const ret = getObject(arg0).length;
|
|
385
|
+
return ret;
|
|
386
|
+
},
|
|
387
|
+
__wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
|
|
388
|
+
const ret = getObject(arg0).msCrypto;
|
|
389
|
+
return addHeapObject(ret);
|
|
390
|
+
},
|
|
391
|
+
__wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
|
|
392
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
393
|
+
return addHeapObject(ret);
|
|
394
|
+
},
|
|
395
|
+
__wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
|
|
396
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
397
|
+
return addHeapObject(ret);
|
|
398
|
+
},
|
|
399
|
+
__wbg_node_e1f24f89a7336c2e: function(arg0) {
|
|
400
|
+
const ret = getObject(arg0).node;
|
|
401
|
+
return addHeapObject(ret);
|
|
402
|
+
},
|
|
403
|
+
__wbg_process_3975fd6c72f520aa: function(arg0) {
|
|
404
|
+
const ret = getObject(arg0).process;
|
|
405
|
+
return addHeapObject(ret);
|
|
406
|
+
},
|
|
407
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
408
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
409
|
+
},
|
|
410
|
+
__wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
|
|
411
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
412
|
+
}, arguments); },
|
|
413
|
+
__wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
|
|
414
|
+
const ret = module.require;
|
|
415
|
+
return addHeapObject(ret);
|
|
416
|
+
}, arguments); },
|
|
417
|
+
__wbg_static_accessor_GLOBAL_12837167ad935116: function() {
|
|
418
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
419
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
420
|
+
},
|
|
421
|
+
__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
|
|
422
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
423
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
424
|
+
},
|
|
425
|
+
__wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
|
|
426
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
427
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
428
|
+
},
|
|
429
|
+
__wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
|
|
430
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
431
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
432
|
+
},
|
|
433
|
+
__wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
|
|
434
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
435
|
+
return addHeapObject(ret);
|
|
436
|
+
},
|
|
437
|
+
__wbg_versions_4e31226f5e8dc909: function(arg0) {
|
|
438
|
+
const ret = getObject(arg0).versions;
|
|
439
|
+
return addHeapObject(ret);
|
|
440
|
+
},
|
|
441
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
442
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
443
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
444
|
+
return addHeapObject(ret);
|
|
445
|
+
},
|
|
446
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
447
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
448
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
449
|
+
return addHeapObject(ret);
|
|
450
|
+
},
|
|
451
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
452
|
+
const ret = getObject(arg0);
|
|
453
|
+
return addHeapObject(ret);
|
|
454
|
+
},
|
|
455
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
456
|
+
takeObject(arg0);
|
|
457
|
+
},
|
|
458
|
+
};
|
|
459
|
+
return {
|
|
460
|
+
__proto__: null,
|
|
461
|
+
"./wasm_mps_bg.js": import0,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const MsgShareFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
466
|
+
? { register: () => {}, unregister: () => {} }
|
|
467
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_msgshare_free(ptr >>> 0, 1));
|
|
468
|
+
const MsgStateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
469
|
+
? { register: () => {}, unregister: () => {} }
|
|
470
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_msgstate_free(ptr >>> 0, 1));
|
|
471
|
+
const ShareFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
472
|
+
? { register: () => {}, unregister: () => {} }
|
|
473
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_share_free(ptr >>> 0, 1));
|
|
474
|
+
|
|
475
|
+
function addHeapObject(obj) {
|
|
476
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
477
|
+
const idx = heap_next;
|
|
478
|
+
heap_next = heap[idx];
|
|
479
|
+
|
|
480
|
+
heap[idx] = obj;
|
|
481
|
+
return idx;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function dropObject(idx) {
|
|
485
|
+
if (idx < 132) return;
|
|
486
|
+
heap[idx] = heap_next;
|
|
487
|
+
heap_next = idx;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
491
|
+
ptr = ptr >>> 0;
|
|
492
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
let cachedDataViewMemory0 = null;
|
|
496
|
+
function getDataViewMemory0() {
|
|
497
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
498
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
499
|
+
}
|
|
500
|
+
return cachedDataViewMemory0;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function getStringFromWasm0(ptr, len) {
|
|
504
|
+
ptr = ptr >>> 0;
|
|
505
|
+
return decodeText(ptr, len);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
let cachedUint8ArrayMemory0 = null;
|
|
509
|
+
function getUint8ArrayMemory0() {
|
|
510
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
511
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
512
|
+
}
|
|
513
|
+
return cachedUint8ArrayMemory0;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function getObject(idx) { return heap[idx]; }
|
|
517
|
+
|
|
518
|
+
function handleError(f, args) {
|
|
519
|
+
try {
|
|
520
|
+
return f.apply(this, args);
|
|
521
|
+
} catch (e) {
|
|
522
|
+
wasm.__wbindgen_export(addHeapObject(e));
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
let heap = new Array(128).fill(undefined);
|
|
527
|
+
heap.push(undefined, null, true, false);
|
|
528
|
+
|
|
529
|
+
let heap_next = heap.length;
|
|
530
|
+
|
|
531
|
+
function isLikeNone(x) {
|
|
532
|
+
return x === undefined || x === null;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
536
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
537
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
538
|
+
WASM_VECTOR_LEN = arg.length;
|
|
539
|
+
return ptr;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
543
|
+
if (realloc === undefined) {
|
|
544
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
545
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
546
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
547
|
+
WASM_VECTOR_LEN = buf.length;
|
|
548
|
+
return ptr;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
let len = arg.length;
|
|
552
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
553
|
+
|
|
554
|
+
const mem = getUint8ArrayMemory0();
|
|
555
|
+
|
|
556
|
+
let offset = 0;
|
|
557
|
+
|
|
558
|
+
for (; offset < len; offset++) {
|
|
559
|
+
const code = arg.charCodeAt(offset);
|
|
560
|
+
if (code > 0x7F) break;
|
|
561
|
+
mem[ptr + offset] = code;
|
|
562
|
+
}
|
|
563
|
+
if (offset !== len) {
|
|
564
|
+
if (offset !== 0) {
|
|
565
|
+
arg = arg.slice(offset);
|
|
566
|
+
}
|
|
567
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
568
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
569
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
570
|
+
|
|
571
|
+
offset += ret.written;
|
|
572
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
WASM_VECTOR_LEN = offset;
|
|
576
|
+
return ptr;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function takeObject(idx) {
|
|
580
|
+
const ret = getObject(idx);
|
|
581
|
+
dropObject(idx);
|
|
582
|
+
return ret;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
586
|
+
cachedTextDecoder.decode();
|
|
587
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
588
|
+
let numBytesDecoded = 0;
|
|
589
|
+
function decodeText(ptr, len) {
|
|
590
|
+
numBytesDecoded += len;
|
|
591
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
592
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
593
|
+
cachedTextDecoder.decode();
|
|
594
|
+
numBytesDecoded = len;
|
|
595
|
+
}
|
|
596
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const cachedTextEncoder = new TextEncoder();
|
|
600
|
+
|
|
601
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
602
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
603
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
604
|
+
view.set(buf);
|
|
605
|
+
return {
|
|
606
|
+
read: arg.length,
|
|
607
|
+
written: buf.length
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
let WASM_VECTOR_LEN = 0;
|
|
613
|
+
|
|
614
|
+
let wasmModule, wasm;
|
|
615
|
+
function __wbg_finalize_init(instance, module) {
|
|
616
|
+
wasm = instance.exports;
|
|
617
|
+
wasmModule = module;
|
|
618
|
+
cachedDataViewMemory0 = null;
|
|
619
|
+
cachedUint8ArrayMemory0 = null;
|
|
620
|
+
return wasm;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
async function __wbg_load(module, imports) {
|
|
624
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
625
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
626
|
+
try {
|
|
627
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
628
|
+
} catch (e) {
|
|
629
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
630
|
+
|
|
631
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
632
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
633
|
+
|
|
634
|
+
} else { throw e; }
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
const bytes = await module.arrayBuffer();
|
|
639
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
640
|
+
} else {
|
|
641
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
642
|
+
|
|
643
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
644
|
+
return { instance, module };
|
|
645
|
+
} else {
|
|
646
|
+
return instance;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
function expectedResponseType(type) {
|
|
651
|
+
switch (type) {
|
|
652
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
653
|
+
}
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function initSync(module) {
|
|
659
|
+
if (wasm !== undefined) return wasm;
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
if (module !== undefined) {
|
|
663
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
664
|
+
({module} = module)
|
|
665
|
+
} else {
|
|
666
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
const imports = __wbg_get_imports();
|
|
671
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
672
|
+
module = new WebAssembly.Module(module);
|
|
673
|
+
}
|
|
674
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
675
|
+
return __wbg_finalize_init(instance, module);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
async function __wbg_init(module_or_path) {
|
|
679
|
+
if (wasm !== undefined) return wasm;
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
if (module_or_path !== undefined) {
|
|
683
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
684
|
+
({module_or_path} = module_or_path)
|
|
685
|
+
} else {
|
|
686
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
if (module_or_path === undefined) {
|
|
691
|
+
module_or_path = new URL('wasm_mps_bg.wasm', import.meta.url);
|
|
692
|
+
}
|
|
693
|
+
const imports = __wbg_get_imports();
|
|
694
|
+
|
|
695
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
696
|
+
module_or_path = fetch(module_or_path);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
700
|
+
|
|
701
|
+
return __wbg_finalize_init(instance, module);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_msgshare_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_msgstate_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_share_free: (a: number, b: number) => void;
|
|
7
|
+
export const ed25519_dkg_round0_process: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
8
|
+
export const ed25519_dkg_round1_process: (a: number, b: number, c: number, d: number) => void;
|
|
9
|
+
export const ed25519_dkg_round2_process: (a: number, b: number, c: number, d: number) => void;
|
|
10
|
+
export const ed25519_dsg_round0_process: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
11
|
+
export const ed25519_dsg_round1_process: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
|
+
export const ed25519_dsg_round2_process: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
13
|
+
export const ed25519_dsg_round3_process: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
14
|
+
export const msgshare_msg: (a: number, b: number) => void;
|
|
15
|
+
export const msgshare_share: (a: number) => number;
|
|
16
|
+
export const msgstate_msg: (a: number, b: number) => void;
|
|
17
|
+
export const msgstate_state: (a: number, b: number) => void;
|
|
18
|
+
export const share_chaincode: (a: number, b: number) => void;
|
|
19
|
+
export const share_pk: (a: number, b: number) => void;
|
|
20
|
+
export const share_share: (a: number, b: number) => void;
|
|
21
|
+
export const __wbindgen_export: (a: number) => void;
|
|
22
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
23
|
+
export const __wbindgen_export2: (a: number, b: number) => number;
|
|
24
|
+
export const __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
25
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitgo/wasm-mps",
|
|
3
3
|
"description": "WebAssembly wrapper for multi-party-schnorr protocol",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/esm/js/**/*",
|
|
13
13
|
"dist/cjs/js/**/*",
|
|
14
|
-
"dist/cjs/package.json"
|
|
14
|
+
"dist/cjs/package.json",
|
|
15
|
+
"dist/web/js/**/*"
|
|
15
16
|
],
|
|
16
17
|
"exports": {
|
|
17
18
|
".": {
|
|
@@ -23,6 +24,10 @@
|
|
|
23
24
|
"types": "./dist/cjs/js/index.d.ts",
|
|
24
25
|
"default": "./dist/cjs/js/index.js"
|
|
25
26
|
}
|
|
27
|
+
},
|
|
28
|
+
"./web": {
|
|
29
|
+
"types": "./dist/web/js/wasm/wasm_mps.d.ts",
|
|
30
|
+
"default": "./dist/web/js/wasm/wasm_mps.js"
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"main": "./dist/cjs/js/index.js",
|
|
@@ -35,7 +40,7 @@
|
|
|
35
40
|
"scripts": {
|
|
36
41
|
"test": "npm run test:mocha",
|
|
37
42
|
"test:mocha": "mocha --recursive test",
|
|
38
|
-
"build:wasm": "make js/wasm && make dist/esm/js/wasm && make dist/cjs/js/wasm",
|
|
43
|
+
"build:wasm": "make js/wasm && make dist/esm/js/wasm && make dist/cjs/js/wasm && make dist/web/js/wasm",
|
|
39
44
|
"build:ts-esm": "tsc",
|
|
40
45
|
"build:ts-cjs": "tsc --project tsconfig.cjs.json",
|
|
41
46
|
"build:ts": "npm run build:ts-esm && npm run build:ts-cjs",
|