tkms 0.13.3 → 0.13.10-rc.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/kms_lib.d.ts +498 -444
- package/kms_lib.js +1705 -1752
- package/kms_lib_bg.wasm +0 -0
- package/package.json +1 -1
package/kms_lib.js
CHANGED
|
@@ -1,974 +1,633 @@
|
|
|
1
|
-
|
|
1
|
+
/* @ts-self-types="./kms_lib.d.ts" */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export class CiphertextHandle {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
CiphertextHandleFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_ciphertexthandle_free(ptr, 0);
|
|
10
13
|
}
|
|
11
|
-
return cachedUint8ArrayMemory0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
15
|
-
|
|
16
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
17
|
-
? function (arg, view) {
|
|
18
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
22
|
-
view.set(buf);
|
|
23
|
-
return {
|
|
24
|
-
read: arg.length,
|
|
25
|
-
written: buf.length
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
15
|
+
if (Symbol.dispose) CiphertextHandle.prototype[Symbol.dispose] = CiphertextHandle.prototype.free;
|
|
30
16
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Core Client
|
|
19
|
+
*
|
|
20
|
+
* Simple client to interact with the KMS servers. This can be seen as a proof-of-concept
|
|
21
|
+
* and reference code for validating the KMS. The logic supplied by the client will be
|
|
22
|
+
* distributed across the aggregator/proxy and smart contracts.
|
|
23
|
+
*/
|
|
24
|
+
export class Client {
|
|
25
|
+
static __wrap(ptr) {
|
|
26
|
+
ptr = ptr >>> 0;
|
|
27
|
+
const obj = Object.create(Client.prototype);
|
|
28
|
+
obj.__wbg_ptr = ptr;
|
|
29
|
+
ClientFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
30
|
+
return obj;
|
|
37
31
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
let offset = 0;
|
|
45
|
-
|
|
46
|
-
for (; offset < len; offset++) {
|
|
47
|
-
const code = arg.charCodeAt(offset);
|
|
48
|
-
if (code > 0x7F) break;
|
|
49
|
-
mem[ptr + offset] = code;
|
|
32
|
+
__destroy_into_raw() {
|
|
33
|
+
const ptr = this.__wbg_ptr;
|
|
34
|
+
this.__wbg_ptr = 0;
|
|
35
|
+
ClientFinalization.unregister(this);
|
|
36
|
+
return ptr;
|
|
50
37
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
arg = arg.slice(offset);
|
|
55
|
-
}
|
|
56
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
57
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
58
|
-
const ret = encodeString(arg, view);
|
|
59
|
-
|
|
60
|
-
offset += ret.written;
|
|
61
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
38
|
+
free() {
|
|
39
|
+
const ptr = this.__destroy_into_raw();
|
|
40
|
+
wasm.__wbg_client_free(ptr, 0);
|
|
62
41
|
}
|
|
63
|
-
|
|
64
|
-
WASM_VECTOR_LEN = offset;
|
|
65
|
-
return ptr;
|
|
66
42
|
}
|
|
43
|
+
if (Symbol.dispose) Client.prototype[Symbol.dispose] = Client.prototype.free;
|
|
67
44
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Eip712 domain information.
|
|
47
|
+
* Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) _must_ be fulfilled.
|
|
48
|
+
* Furthermore, be aware that all parameters will eventually be parsed into Solidity types.
|
|
49
|
+
*/
|
|
50
|
+
export class Eip712DomainMsg {
|
|
51
|
+
static __wrap(ptr) {
|
|
52
|
+
ptr = ptr >>> 0;
|
|
53
|
+
const obj = Object.create(Eip712DomainMsg.prototype);
|
|
54
|
+
obj.__wbg_ptr = ptr;
|
|
55
|
+
Eip712DomainMsgFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
56
|
+
return obj;
|
|
73
57
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
wasm.__wbindgen_export_4.set(idx, obj);
|
|
80
|
-
return idx;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function handleError(f, args) {
|
|
84
|
-
try {
|
|
85
|
-
return f.apply(this, args);
|
|
86
|
-
} catch (e) {
|
|
87
|
-
const idx = addToExternrefTable0(e);
|
|
88
|
-
wasm.__wbindgen_exn_store(idx);
|
|
58
|
+
__destroy_into_raw() {
|
|
59
|
+
const ptr = this.__wbg_ptr;
|
|
60
|
+
this.__wbg_ptr = 0;
|
|
61
|
+
Eip712DomainMsgFinalization.unregister(this);
|
|
62
|
+
return ptr;
|
|
89
63
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
95
|
-
|
|
96
|
-
function getStringFromWasm0(ptr, len) {
|
|
97
|
-
ptr = ptr >>> 0;
|
|
98
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function isLikeNone(x) {
|
|
102
|
-
return x === undefined || x === null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function debugString(val) {
|
|
106
|
-
// primitive types
|
|
107
|
-
const type = typeof val;
|
|
108
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
109
|
-
return `${val}`;
|
|
64
|
+
free() {
|
|
65
|
+
const ptr = this.__destroy_into_raw();
|
|
66
|
+
wasm.__wbg_eip712domainmsg_free(ptr, 0);
|
|
110
67
|
}
|
|
111
|
-
|
|
112
|
-
|
|
68
|
+
/**
|
|
69
|
+
* @returns {Uint8Array}
|
|
70
|
+
*/
|
|
71
|
+
get chain_id() {
|
|
72
|
+
const ret = wasm.__wbg_get_eip712domainmsg_chain_id(this.__wbg_ptr);
|
|
73
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
74
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
75
|
+
return v1;
|
|
113
76
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
77
|
+
/**
|
|
78
|
+
* @returns {string}
|
|
79
|
+
*/
|
|
80
|
+
get name() {
|
|
81
|
+
let deferred1_0;
|
|
82
|
+
let deferred1_1;
|
|
83
|
+
try {
|
|
84
|
+
const ret = wasm.__wbg_get_eip712domainmsg_name(this.__wbg_ptr);
|
|
85
|
+
deferred1_0 = ret[0];
|
|
86
|
+
deferred1_1 = ret[1];
|
|
87
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
88
|
+
} finally {
|
|
89
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
120
90
|
}
|
|
121
91
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
92
|
+
/**
|
|
93
|
+
* @returns {Uint8Array | undefined}
|
|
94
|
+
*/
|
|
95
|
+
get salt() {
|
|
96
|
+
const ret = wasm.__wbg_get_eip712domainmsg_salt(this.__wbg_ptr);
|
|
97
|
+
let v1;
|
|
98
|
+
if (ret[0] !== 0) {
|
|
99
|
+
v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
100
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
128
101
|
}
|
|
102
|
+
return v1;
|
|
129
103
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
104
|
+
/**
|
|
105
|
+
* @returns {string}
|
|
106
|
+
*/
|
|
107
|
+
get verifying_contract() {
|
|
108
|
+
let deferred1_0;
|
|
109
|
+
let deferred1_1;
|
|
110
|
+
try {
|
|
111
|
+
const ret = wasm.__wbg_get_eip712domainmsg_verifying_contract(this.__wbg_ptr);
|
|
112
|
+
deferred1_0 = ret[0];
|
|
113
|
+
deferred1_1 = ret[1];
|
|
114
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
115
|
+
} finally {
|
|
116
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
139
117
|
}
|
|
140
|
-
debug += ']';
|
|
141
|
-
return debug;
|
|
142
|
-
}
|
|
143
|
-
// Test for built-in
|
|
144
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
145
|
-
let className;
|
|
146
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
147
|
-
className = builtInMatches[1];
|
|
148
|
-
} else {
|
|
149
|
-
// Failed to match the standard '[object ClassName]'
|
|
150
|
-
return toString.call(val);
|
|
151
118
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
119
|
+
/**
|
|
120
|
+
* @returns {string}
|
|
121
|
+
*/
|
|
122
|
+
get version() {
|
|
123
|
+
let deferred1_0;
|
|
124
|
+
let deferred1_1;
|
|
156
125
|
try {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
126
|
+
const ret = wasm.__wbg_get_eip712domainmsg_version(this.__wbg_ptr);
|
|
127
|
+
deferred1_0 = ret[0];
|
|
128
|
+
deferred1_1 = ret[1];
|
|
129
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
130
|
+
} finally {
|
|
131
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
160
132
|
}
|
|
161
133
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
134
|
+
/**
|
|
135
|
+
* @param {Uint8Array} arg0
|
|
136
|
+
*/
|
|
137
|
+
set chain_id(arg0) {
|
|
138
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
139
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140
|
+
wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
|
|
165
141
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return value;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Create a new [ServerIdAddr] structure that holds an ID and an address
|
|
177
|
-
* which must be a valid EIP-55 address, notably prefixed with "0x".
|
|
178
|
-
* @param {number} id
|
|
179
|
-
* @param {string} addr
|
|
180
|
-
* @returns {ServerIdAddr}
|
|
181
|
-
*/
|
|
182
|
-
export function new_server_id_addr(id, addr) {
|
|
183
|
-
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
184
|
-
const len0 = WASM_VECTOR_LEN;
|
|
185
|
-
const ret = wasm.new_server_id_addr(id, ptr0, len0);
|
|
186
|
-
if (ret[2]) {
|
|
187
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
142
|
+
/**
|
|
143
|
+
* @param {string} arg0
|
|
144
|
+
*/
|
|
145
|
+
set name(arg0) {
|
|
146
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
147
|
+
const len0 = WASM_VECTOR_LEN;
|
|
148
|
+
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
188
149
|
}
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
150
|
+
/**
|
|
151
|
+
* @param {Uint8Array | null} [arg0]
|
|
152
|
+
*/
|
|
153
|
+
set salt(arg0) {
|
|
154
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
155
|
+
var len0 = WASM_VECTOR_LEN;
|
|
156
|
+
wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
|
|
195
157
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
|
|
158
|
+
/**
|
|
159
|
+
* @param {string} arg0
|
|
160
|
+
*/
|
|
161
|
+
set verifying_contract(arg0) {
|
|
162
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
163
|
+
const len0 = WASM_VECTOR_LEN;
|
|
164
|
+
wasm.__wbg_set_eip712domainmsg_verifying_contract(this.__wbg_ptr, ptr0, len0);
|
|
204
165
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
*
|
|
213
|
-
* * `client` - client that wants to perform user_decryption.
|
|
214
|
-
*
|
|
215
|
-
* * `request` - the initial user_decryption request JS object.
|
|
216
|
-
* It can be set to null if `verify` is false.
|
|
217
|
-
* Otherwise the caller needs to give the following JS object.
|
|
218
|
-
* Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
|
|
219
|
-
* The signature field is not needed.
|
|
220
|
-
* ```
|
|
221
|
-
* {
|
|
222
|
-
* signature: undefined,
|
|
223
|
-
* client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
|
|
224
|
-
* enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
|
|
225
|
-
* ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
|
|
226
|
-
* eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
|
|
227
|
-
* }
|
|
228
|
-
* ```
|
|
229
|
-
*
|
|
230
|
-
* * `eip712_domain` - the EIP-712 domain JS object.
|
|
231
|
-
* It can be set to null if `verify` is false.
|
|
232
|
-
* Otherwise the caller needs to give the following JS object.
|
|
233
|
-
* Note that `salt` is optional and `verifying_contract` follows EIP-55,
|
|
234
|
-
* additionally, `chain_id` is an array of u8.
|
|
235
|
-
* ```
|
|
236
|
-
* {
|
|
237
|
-
* name: 'Authorization token',
|
|
238
|
-
* version: '1',
|
|
239
|
-
* chain_id: [
|
|
240
|
-
* 70, 31, 0, 0, 0, 0, 0, 0, 0,
|
|
241
|
-
* 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
242
|
-
* 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
243
|
-
* 0, 0, 0, 0, 0
|
|
244
|
-
* ],
|
|
245
|
-
* verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657',
|
|
246
|
-
* salt: []
|
|
247
|
-
* }
|
|
248
|
-
* ```
|
|
249
|
-
*
|
|
250
|
-
* * `agg_resp` - the response JS object from the gateway.
|
|
251
|
-
* It has two fields like so, both are hex encoded byte arrays.
|
|
252
|
-
* ```
|
|
253
|
-
* [
|
|
254
|
-
* {
|
|
255
|
-
* signature: '69e7e040cab157aa819015b321c012dccb1545ffefd325b359b492653f0347517e28e66c572cdc299e259024329859ff9fcb0096e1ce072af0b6e1ca1fe25ec6',
|
|
256
|
-
* payload: '0100000029...',
|
|
257
|
-
* extra_data: '01234...',
|
|
258
|
-
* }
|
|
259
|
-
* ]
|
|
260
|
-
* ```
|
|
261
|
-
*
|
|
262
|
-
* * `enc_pk` - The ephemeral public key.
|
|
263
|
-
*
|
|
264
|
-
* * `enc_sk` - The ephemeral secret key.
|
|
265
|
-
*
|
|
266
|
-
* * `verify` - Whether to perform signature verification for the response.
|
|
267
|
-
* It is insecure if `verify = false`!
|
|
268
|
-
* @param {Client} client
|
|
269
|
-
* @param {any} request
|
|
270
|
-
* @param {any} eip712_domain
|
|
271
|
-
* @param {any} agg_resp
|
|
272
|
-
* @param {PublicEncKeyMlKem512} enc_pk
|
|
273
|
-
* @param {PrivateEncKeyMlKem512} enc_sk
|
|
274
|
-
* @param {boolean} verify
|
|
275
|
-
* @returns {TypedPlaintext[]}
|
|
276
|
-
*/
|
|
277
|
-
export function process_user_decryption_resp_from_js(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
|
|
278
|
-
_assertClass(client, Client);
|
|
279
|
-
_assertClass(enc_pk, PublicEncKeyMlKem512);
|
|
280
|
-
_assertClass(enc_sk, PrivateEncKeyMlKem512);
|
|
281
|
-
const ret = wasm.process_user_decryption_resp_from_js(client.__wbg_ptr, request, eip712_domain, agg_resp, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
|
|
282
|
-
if (ret[3]) {
|
|
283
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
166
|
+
/**
|
|
167
|
+
* @param {string} arg0
|
|
168
|
+
*/
|
|
169
|
+
set version(arg0) {
|
|
170
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
171
|
+
const len0 = WASM_VECTOR_LEN;
|
|
172
|
+
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
284
173
|
}
|
|
285
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
286
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
287
|
-
return v1;
|
|
288
174
|
}
|
|
175
|
+
if (Symbol.dispose) Eip712DomainMsg.prototype[Symbol.dispose] = Eip712DomainMsg.prototype.free;
|
|
289
176
|
|
|
290
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
291
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
292
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
293
|
-
WASM_VECTOR_LEN = arg.length;
|
|
294
|
-
return ptr;
|
|
295
|
-
}
|
|
296
177
|
/**
|
|
297
|
-
*
|
|
298
|
-
* @returns {PublicEncKeyMlKem512}
|
|
178
|
+
* Validity of this struct is not checked.
|
|
299
179
|
*/
|
|
300
|
-
export
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
180
|
+
export class ParsedUserDecryptionRequest {
|
|
181
|
+
__destroy_into_raw() {
|
|
182
|
+
const ptr = this.__wbg_ptr;
|
|
183
|
+
this.__wbg_ptr = 0;
|
|
184
|
+
ParsedUserDecryptionRequestFinalization.unregister(this);
|
|
185
|
+
return ptr;
|
|
186
|
+
}
|
|
187
|
+
free() {
|
|
188
|
+
const ptr = this.__destroy_into_raw();
|
|
189
|
+
wasm.__wbg_parseduserdecryptionrequest_free(ptr, 0);
|
|
306
190
|
}
|
|
307
|
-
return PublicEncKeyMlKem512.__wrap(ret[0]);
|
|
308
191
|
}
|
|
192
|
+
if (Symbol.dispose) ParsedUserDecryptionRequest.prototype[Symbol.dispose] = ParsedUserDecryptionRequest.prototype.free;
|
|
309
193
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
194
|
+
export class PrivateEncKeyMlKem512 {
|
|
195
|
+
static __wrap(ptr) {
|
|
196
|
+
ptr = ptr >>> 0;
|
|
197
|
+
const obj = Object.create(PrivateEncKeyMlKem512.prototype);
|
|
198
|
+
obj.__wbg_ptr = ptr;
|
|
199
|
+
PrivateEncKeyMlKem512Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
200
|
+
return obj;
|
|
315
201
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
* * `client_address_hex` - the client (wallet) address in hex,
|
|
326
|
-
* must be prefixed with "0x".
|
|
327
|
-
*
|
|
328
|
-
* * `fhe_parameter` - the parameter choice, which can be either `"test"` or `"default"`.
|
|
329
|
-
* The "default" parameter choice is selected if no matching string is found.
|
|
330
|
-
* @param {ServerIdAddr[]} server_addrs
|
|
331
|
-
* @param {string} client_address_hex
|
|
332
|
-
* @param {string} fhe_parameter
|
|
333
|
-
* @returns {Client}
|
|
334
|
-
*/
|
|
335
|
-
export function new_client(server_addrs, client_address_hex, fhe_parameter) {
|
|
336
|
-
const ptr0 = passArrayJsValueToWasm0(server_addrs, wasm.__wbindgen_malloc);
|
|
337
|
-
const len0 = WASM_VECTOR_LEN;
|
|
338
|
-
const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
339
|
-
const len1 = WASM_VECTOR_LEN;
|
|
340
|
-
const ptr2 = passStringToWasm0(fhe_parameter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
341
|
-
const len2 = WASM_VECTOR_LEN;
|
|
342
|
-
const ret = wasm.new_client(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
343
|
-
if (ret[2]) {
|
|
344
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
202
|
+
__destroy_into_raw() {
|
|
203
|
+
const ptr = this.__wbg_ptr;
|
|
204
|
+
this.__wbg_ptr = 0;
|
|
205
|
+
PrivateEncKeyMlKem512Finalization.unregister(this);
|
|
206
|
+
return ptr;
|
|
207
|
+
}
|
|
208
|
+
free() {
|
|
209
|
+
const ptr = this.__destroy_into_raw();
|
|
210
|
+
wasm.__wbg_privateenckeymlkem512_free(ptr, 0);
|
|
345
211
|
}
|
|
346
|
-
return Client.__wrap(ret[0]);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* @param {PrivateEncKeyMlKem512} sk
|
|
351
|
-
* @returns {PublicEncKeyMlKem512}
|
|
352
|
-
*/
|
|
353
|
-
export function ml_kem_pke_get_pk(sk) {
|
|
354
|
-
_assertClass(sk, PrivateEncKeyMlKem512);
|
|
355
|
-
const ret = wasm.ml_kem_pke_get_pk(sk.__wbg_ptr);
|
|
356
|
-
return PublicEncKeyMlKem512.__wrap(ret);
|
|
357
212
|
}
|
|
213
|
+
if (Symbol.dispose) PrivateEncKeyMlKem512.prototype[Symbol.dispose] = PrivateEncKeyMlKem512.prototype.free;
|
|
358
214
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
215
|
+
export class PrivateSigKey {
|
|
216
|
+
static __wrap(ptr) {
|
|
217
|
+
ptr = ptr >>> 0;
|
|
218
|
+
const obj = Object.create(PrivateSigKey.prototype);
|
|
219
|
+
obj.__wbg_ptr = ptr;
|
|
220
|
+
PrivateSigKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
221
|
+
return obj;
|
|
222
|
+
}
|
|
223
|
+
__destroy_into_raw() {
|
|
224
|
+
const ptr = this.__wbg_ptr;
|
|
225
|
+
this.__wbg_ptr = 0;
|
|
226
|
+
PrivateSigKeyFinalization.unregister(this);
|
|
227
|
+
return ptr;
|
|
228
|
+
}
|
|
229
|
+
free() {
|
|
230
|
+
const ptr = this.__destroy_into_raw();
|
|
231
|
+
wasm.__wbg_privatesigkey_free(ptr, 0);
|
|
369
232
|
}
|
|
370
|
-
return PrivateSigKey.__wrap(ret[0]);
|
|
371
233
|
}
|
|
234
|
+
if (Symbol.dispose) PrivateSigKey.prototype[Symbol.dispose] = PrivateSigKey.prototype.free;
|
|
372
235
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const ret = wasm.u8vec_to_ml_kem_pke_sk(ptr0, len0);
|
|
381
|
-
if (ret[2]) {
|
|
382
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
383
|
-
}
|
|
384
|
-
return PrivateEncKeyMlKem512.__wrap(ret[0]);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
388
|
-
ptr = ptr >>> 0;
|
|
389
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* This function is *not* used by relayer-sdk because the encryption
|
|
393
|
-
* happens on the KMS side. It's just here for completeness and tests.
|
|
394
|
-
* @param {Uint8Array} msg
|
|
395
|
-
* @param {PublicEncKeyMlKem512} their_pk
|
|
396
|
-
* @returns {Uint8Array}
|
|
397
|
-
*/
|
|
398
|
-
export function ml_kem_pke_encrypt(msg, their_pk) {
|
|
399
|
-
const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
|
|
400
|
-
const len0 = WASM_VECTOR_LEN;
|
|
401
|
-
_assertClass(their_pk, PublicEncKeyMlKem512);
|
|
402
|
-
const ret = wasm.ml_kem_pke_encrypt(ptr0, len0, their_pk.__wbg_ptr);
|
|
403
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
404
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
405
|
-
return v2;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* This function is *not* used by relayer-sdk because the decryption
|
|
410
|
-
* is handled by [process_user_decryption_resp].
|
|
411
|
-
* It's just here for completeness and tests.
|
|
412
|
-
* @param {Uint8Array} ct
|
|
413
|
-
* @param {PrivateEncKeyMlKem512} my_sk
|
|
414
|
-
* @returns {Uint8Array}
|
|
415
|
-
*/
|
|
416
|
-
export function ml_kem_pke_decrypt(ct, my_sk) {
|
|
417
|
-
const ptr0 = passArray8ToWasm0(ct, wasm.__wbindgen_malloc);
|
|
418
|
-
const len0 = WASM_VECTOR_LEN;
|
|
419
|
-
_assertClass(my_sk, PrivateEncKeyMlKem512);
|
|
420
|
-
const ret = wasm.ml_kem_pke_decrypt(ptr0, len0, my_sk.__wbg_ptr);
|
|
421
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
422
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
423
|
-
return v2;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* @returns {number}
|
|
428
|
-
*/
|
|
429
|
-
export function ml_kem_pke_pk_len() {
|
|
430
|
-
const ret = wasm.ml_kem_pke_pk_len();
|
|
431
|
-
return ret >>> 0;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Process the user_decryption response from Rust objects.
|
|
436
|
-
* Consider using [process_user_decryption_resp_from_js]
|
|
437
|
-
* when using the JS API.
|
|
438
|
-
* The result is a byte array representing a plaintext of any length.
|
|
439
|
-
*
|
|
440
|
-
* * `client` - client that wants to perform user_decryption.
|
|
441
|
-
*
|
|
442
|
-
* * `request` - the initial user_decryption request.
|
|
443
|
-
* Must be given if `verify` is true.
|
|
444
|
-
*
|
|
445
|
-
* * `eip712_domain` - the EIP-712 domain.
|
|
446
|
-
* Must be given if `verify` is true.
|
|
447
|
-
*
|
|
448
|
-
* * `agg_resp` - the vector of user_decryption responses.
|
|
449
|
-
*
|
|
450
|
-
* * `enc_pk` - The ephemeral public key.
|
|
451
|
-
*
|
|
452
|
-
* * `enc_sk` - The ephemeral secret key.
|
|
453
|
-
*
|
|
454
|
-
* * `verify` - Whether to perform signature verification for the response.
|
|
455
|
-
* It is insecure if `verify = false`!
|
|
456
|
-
* @param {Client} client
|
|
457
|
-
* @param {ParsedUserDecryptionRequest | null | undefined} request
|
|
458
|
-
* @param {Eip712DomainMsg | null | undefined} eip712_domain
|
|
459
|
-
* @param {UserDecryptionResponse[]} agg_resp
|
|
460
|
-
* @param {PublicEncKeyMlKem512} enc_pk
|
|
461
|
-
* @param {PrivateEncKeyMlKem512} enc_sk
|
|
462
|
-
* @param {boolean} verify
|
|
463
|
-
* @returns {TypedPlaintext[]}
|
|
464
|
-
*/
|
|
465
|
-
export function process_user_decryption_resp(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
|
|
466
|
-
_assertClass(client, Client);
|
|
467
|
-
let ptr0 = 0;
|
|
468
|
-
if (!isLikeNone(request)) {
|
|
469
|
-
_assertClass(request, ParsedUserDecryptionRequest);
|
|
470
|
-
ptr0 = request.__destroy_into_raw();
|
|
236
|
+
export class PublicEncKeyMlKem512 {
|
|
237
|
+
static __wrap(ptr) {
|
|
238
|
+
ptr = ptr >>> 0;
|
|
239
|
+
const obj = Object.create(PublicEncKeyMlKem512.prototype);
|
|
240
|
+
obj.__wbg_ptr = ptr;
|
|
241
|
+
PublicEncKeyMlKem512Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
242
|
+
return obj;
|
|
471
243
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
244
|
+
__destroy_into_raw() {
|
|
245
|
+
const ptr = this.__wbg_ptr;
|
|
246
|
+
this.__wbg_ptr = 0;
|
|
247
|
+
PublicEncKeyMlKem512Finalization.unregister(this);
|
|
248
|
+
return ptr;
|
|
476
249
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
_assertClass(enc_sk, PrivateEncKeyMlKem512);
|
|
481
|
-
const ret = wasm.process_user_decryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
|
|
482
|
-
if (ret[3]) {
|
|
483
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
250
|
+
free() {
|
|
251
|
+
const ptr = this.__destroy_into_raw();
|
|
252
|
+
wasm.__wbg_publicenckeymlkem512_free(ptr, 0);
|
|
484
253
|
}
|
|
485
|
-
var v4 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
486
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
487
|
-
return v4;
|
|
488
254
|
}
|
|
255
|
+
if (Symbol.dispose) PublicEncKeyMlKem512.prototype[Symbol.dispose] = PublicEncKeyMlKem512.prototype.free;
|
|
489
256
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
if (ret[3]) {
|
|
498
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
257
|
+
export class PublicSigKey {
|
|
258
|
+
static __wrap(ptr) {
|
|
259
|
+
ptr = ptr >>> 0;
|
|
260
|
+
const obj = Object.create(PublicSigKey.prototype);
|
|
261
|
+
obj.__wbg_ptr = ptr;
|
|
262
|
+
PublicSigKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
263
|
+
return obj;
|
|
499
264
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
export function ml_kem_pke_sk_to_u8vec(sk) {
|
|
510
|
-
_assertClass(sk, PrivateEncKeyMlKem512);
|
|
511
|
-
const ret = wasm.ml_kem_pke_sk_to_u8vec(sk.__wbg_ptr);
|
|
512
|
-
if (ret[3]) {
|
|
513
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
265
|
+
__destroy_into_raw() {
|
|
266
|
+
const ptr = this.__wbg_ptr;
|
|
267
|
+
this.__wbg_ptr = 0;
|
|
268
|
+
PublicSigKeyFinalization.unregister(this);
|
|
269
|
+
return ptr;
|
|
270
|
+
}
|
|
271
|
+
free() {
|
|
272
|
+
const ptr = this.__destroy_into_raw();
|
|
273
|
+
wasm.__wbg_publicsigkey_free(ptr, 0);
|
|
514
274
|
}
|
|
515
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
516
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
517
|
-
return v1;
|
|
518
275
|
}
|
|
276
|
+
if (Symbol.dispose) PublicSigKey.prototype[Symbol.dispose] = PublicSigKey.prototype.free;
|
|
519
277
|
|
|
520
278
|
/**
|
|
521
|
-
*
|
|
279
|
+
* / A unique 32 Byte / 256 Bit ID, to be used to identify a request and
|
|
280
|
+
* / for retrieving the computed result later on.
|
|
281
|
+
* / Must be encoded in lower-case hex. The string must NOT contain a `0x` prefix.
|
|
522
282
|
*/
|
|
523
|
-
export
|
|
524
|
-
|
|
525
|
-
|
|
283
|
+
export class RequestId {
|
|
284
|
+
static __wrap(ptr) {
|
|
285
|
+
ptr = ptr >>> 0;
|
|
286
|
+
const obj = Object.create(RequestId.prototype);
|
|
287
|
+
obj.__wbg_ptr = ptr;
|
|
288
|
+
RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
289
|
+
return obj;
|
|
290
|
+
}
|
|
291
|
+
__destroy_into_raw() {
|
|
292
|
+
const ptr = this.__wbg_ptr;
|
|
293
|
+
this.__wbg_ptr = 0;
|
|
294
|
+
RequestIdFinalization.unregister(this);
|
|
295
|
+
return ptr;
|
|
296
|
+
}
|
|
297
|
+
free() {
|
|
298
|
+
const ptr = this.__destroy_into_raw();
|
|
299
|
+
wasm.__wbg_requestid_free(ptr, 0);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* @returns {string}
|
|
303
|
+
*/
|
|
304
|
+
get request_id() {
|
|
305
|
+
let deferred1_0;
|
|
306
|
+
let deferred1_1;
|
|
307
|
+
try {
|
|
308
|
+
const ret = wasm.__wbg_get_requestid_request_id(this.__wbg_ptr);
|
|
309
|
+
deferred1_0 = ret[0];
|
|
310
|
+
deferred1_1 = ret[1];
|
|
311
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* @param {string} arg0
|
|
318
|
+
*/
|
|
319
|
+
set request_id(arg0) {
|
|
320
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
321
|
+
const len0 = WASM_VECTOR_LEN;
|
|
322
|
+
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
323
|
+
}
|
|
526
324
|
}
|
|
325
|
+
if (Symbol.dispose) RequestId.prototype[Symbol.dispose] = RequestId.prototype.free;
|
|
527
326
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return
|
|
541
|
-
}
|
|
542
|
-
|
|
327
|
+
export class ServerIdAddr {
|
|
328
|
+
static __wrap(ptr) {
|
|
329
|
+
ptr = ptr >>> 0;
|
|
330
|
+
const obj = Object.create(ServerIdAddr.prototype);
|
|
331
|
+
obj.__wbg_ptr = ptr;
|
|
332
|
+
ServerIdAddrFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
333
|
+
return obj;
|
|
334
|
+
}
|
|
335
|
+
static __unwrap(jsValue) {
|
|
336
|
+
if (!(jsValue instanceof ServerIdAddr)) {
|
|
337
|
+
return 0;
|
|
338
|
+
}
|
|
339
|
+
return jsValue.__destroy_into_raw();
|
|
340
|
+
}
|
|
341
|
+
__destroy_into_raw() {
|
|
342
|
+
const ptr = this.__wbg_ptr;
|
|
343
|
+
this.__wbg_ptr = 0;
|
|
344
|
+
ServerIdAddrFinalization.unregister(this);
|
|
345
|
+
return ptr;
|
|
346
|
+
}
|
|
347
|
+
free() {
|
|
348
|
+
const ptr = this.__destroy_into_raw();
|
|
349
|
+
wasm.__wbg_serveridaddr_free(ptr, 0);
|
|
543
350
|
}
|
|
544
351
|
}
|
|
352
|
+
if (Symbol.dispose) ServerIdAddr.prototype[Symbol.dispose] = ServerIdAddr.prototype.free;
|
|
545
353
|
|
|
546
|
-
|
|
547
|
-
* @param {PrivateSigKey} sk
|
|
548
|
-
* @returns {Uint8Array}
|
|
549
|
-
*/
|
|
550
|
-
export function private_sig_key_to_u8vec(sk) {
|
|
551
|
-
_assertClass(sk, PrivateSigKey);
|
|
552
|
-
const ret = wasm.private_sig_key_to_u8vec(sk.__wbg_ptr);
|
|
553
|
-
if (ret[3]) {
|
|
554
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
555
|
-
}
|
|
556
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
557
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
558
|
-
return v1;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* @param {Client} client
|
|
563
|
-
* @returns {PrivateSigKey | undefined}
|
|
564
|
-
*/
|
|
565
|
-
export function get_client_secret_key(client) {
|
|
566
|
-
_assertClass(client, Client);
|
|
567
|
-
const ret = wasm.get_client_secret_key(client.__wbg_ptr);
|
|
568
|
-
return ret === 0 ? undefined : PrivateSigKey.__wrap(ret);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* @param {PublicSigKey} pk
|
|
573
|
-
* @returns {Uint8Array}
|
|
574
|
-
*/
|
|
575
|
-
export function public_sig_key_to_u8vec(pk) {
|
|
576
|
-
_assertClass(pk, PublicSigKey);
|
|
577
|
-
const ret = wasm.public_sig_key_to_u8vec(pk.__wbg_ptr);
|
|
578
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
579
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
580
|
-
return v1;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* @returns {PrivateEncKeyMlKem512}
|
|
585
|
-
*/
|
|
586
|
-
export function ml_kem_pke_keygen() {
|
|
587
|
-
const ret = wasm.ml_kem_pke_keygen();
|
|
588
|
-
return PrivateEncKeyMlKem512.__wrap(ret);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* @param {Uint8Array} v
|
|
593
|
-
* @returns {PublicSigKey}
|
|
594
|
-
*/
|
|
595
|
-
export function u8vec_to_public_sig_key(v) {
|
|
596
|
-
const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
|
|
597
|
-
const len0 = WASM_VECTOR_LEN;
|
|
598
|
-
const ret = wasm.u8vec_to_public_sig_key(ptr0, len0);
|
|
599
|
-
if (ret[2]) {
|
|
600
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
601
|
-
}
|
|
602
|
-
return PublicSigKey.__wrap(ret[0]);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* @param {Client} client
|
|
607
|
-
* @returns {ServerIdAddr[]}
|
|
608
|
-
*/
|
|
609
|
-
export function get_server_addrs(client) {
|
|
610
|
-
_assertClass(client, Client);
|
|
611
|
-
const ret = wasm.get_server_addrs(client.__wbg_ptr);
|
|
612
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
613
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
614
|
-
return v1;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
const CiphertextHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
618
|
-
? { register: () => {}, unregister: () => {} }
|
|
619
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_ciphertexthandle_free(ptr >>> 0, 1));
|
|
620
|
-
|
|
621
|
-
export class CiphertextHandle {
|
|
622
|
-
|
|
623
|
-
__destroy_into_raw() {
|
|
624
|
-
const ptr = this.__wbg_ptr;
|
|
625
|
-
this.__wbg_ptr = 0;
|
|
626
|
-
CiphertextHandleFinalization.unregister(this);
|
|
627
|
-
return ptr;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
free() {
|
|
631
|
-
const ptr = this.__destroy_into_raw();
|
|
632
|
-
wasm.__wbg_ciphertexthandle_free(ptr, 0);
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
637
|
-
? { register: () => {}, unregister: () => {} }
|
|
638
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
|
|
639
|
-
/**
|
|
640
|
-
* Core Client
|
|
641
|
-
*
|
|
642
|
-
* Simple client to interact with the KMS servers. This can be seen as a proof-of-concept
|
|
643
|
-
* and reference code for validating the KMS. The logic supplied by the client will be
|
|
644
|
-
* distributed across the aggregator/proxy and smart contracts.
|
|
645
|
-
*/
|
|
646
|
-
export class Client {
|
|
647
|
-
|
|
354
|
+
export class TypedCiphertext {
|
|
648
355
|
static __wrap(ptr) {
|
|
649
356
|
ptr = ptr >>> 0;
|
|
650
|
-
const obj = Object.create(
|
|
357
|
+
const obj = Object.create(TypedCiphertext.prototype);
|
|
651
358
|
obj.__wbg_ptr = ptr;
|
|
652
|
-
|
|
359
|
+
TypedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
653
360
|
return obj;
|
|
654
361
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
return ptr;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
free() {
|
|
664
|
-
const ptr = this.__destroy_into_raw();
|
|
665
|
-
wasm.__wbg_client_free(ptr, 0);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
const Eip712DomainMsgFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
670
|
-
? { register: () => {}, unregister: () => {} }
|
|
671
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_eip712domainmsg_free(ptr >>> 0, 1));
|
|
672
|
-
/**
|
|
673
|
-
* Eip712 domain information.
|
|
674
|
-
* Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) _must_ be fulfilled.
|
|
675
|
-
* Furthermore, be aware that all parameters will eventually be parsed into Solidity types.
|
|
676
|
-
*/
|
|
677
|
-
export class Eip712DomainMsg {
|
|
678
|
-
|
|
679
|
-
static __wrap(ptr) {
|
|
680
|
-
ptr = ptr >>> 0;
|
|
681
|
-
const obj = Object.create(Eip712DomainMsg.prototype);
|
|
682
|
-
obj.__wbg_ptr = ptr;
|
|
683
|
-
Eip712DomainMsgFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
684
|
-
return obj;
|
|
362
|
+
static __unwrap(jsValue) {
|
|
363
|
+
if (!(jsValue instanceof TypedCiphertext)) {
|
|
364
|
+
return 0;
|
|
365
|
+
}
|
|
366
|
+
return jsValue.__destroy_into_raw();
|
|
685
367
|
}
|
|
686
|
-
|
|
687
368
|
__destroy_into_raw() {
|
|
688
369
|
const ptr = this.__wbg_ptr;
|
|
689
370
|
this.__wbg_ptr = 0;
|
|
690
|
-
|
|
371
|
+
TypedCiphertextFinalization.unregister(this);
|
|
691
372
|
return ptr;
|
|
692
373
|
}
|
|
693
|
-
|
|
694
374
|
free() {
|
|
695
375
|
const ptr = this.__destroy_into_raw();
|
|
696
|
-
wasm.
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* @returns {string}
|
|
700
|
-
*/
|
|
701
|
-
get name() {
|
|
702
|
-
let deferred1_0;
|
|
703
|
-
let deferred1_1;
|
|
704
|
-
try {
|
|
705
|
-
const ret = wasm.__wbg_get_eip712domainmsg_name(this.__wbg_ptr);
|
|
706
|
-
deferred1_0 = ret[0];
|
|
707
|
-
deferred1_1 = ret[1];
|
|
708
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
709
|
-
} finally {
|
|
710
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* @param {string} arg0
|
|
715
|
-
*/
|
|
716
|
-
set name(arg0) {
|
|
717
|
-
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
718
|
-
const len0 = WASM_VECTOR_LEN;
|
|
719
|
-
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
376
|
+
wasm.__wbg_typedciphertext_free(ptr, 0);
|
|
720
377
|
}
|
|
721
378
|
/**
|
|
722
|
-
*
|
|
379
|
+
* The ciphertext format, see CiphertextFormat documentation for details.
|
|
380
|
+
* CiphertextFormat::default() is used if unspecified.
|
|
381
|
+
* @returns {number}
|
|
723
382
|
*/
|
|
724
|
-
get
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
try {
|
|
728
|
-
const ret = wasm.__wbg_get_eip712domainmsg_version(this.__wbg_ptr);
|
|
729
|
-
deferred1_0 = ret[0];
|
|
730
|
-
deferred1_1 = ret[1];
|
|
731
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
732
|
-
} finally {
|
|
733
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
734
|
-
}
|
|
383
|
+
get ciphertext_format() {
|
|
384
|
+
const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
|
|
385
|
+
return ret;
|
|
735
386
|
}
|
|
736
387
|
/**
|
|
737
|
-
*
|
|
388
|
+
* The actual ciphertext to decrypt, taken directly from fhevm.
|
|
389
|
+
* @returns {Uint8Array}
|
|
738
390
|
*/
|
|
739
|
-
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
wasm.
|
|
391
|
+
get ciphertext() {
|
|
392
|
+
const ret = wasm.__wbg_get_typedciphertext_ciphertext(this.__wbg_ptr);
|
|
393
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
394
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
395
|
+
return v1;
|
|
743
396
|
}
|
|
744
397
|
/**
|
|
398
|
+
* The external handle of the ciphertext (the handle used in the copro).
|
|
745
399
|
* @returns {Uint8Array}
|
|
746
400
|
*/
|
|
747
|
-
get
|
|
748
|
-
const ret = wasm.
|
|
401
|
+
get external_handle() {
|
|
402
|
+
const ret = wasm.__wbg_get_typedciphertext_external_handle(this.__wbg_ptr);
|
|
749
403
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
750
404
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
751
405
|
return v1;
|
|
752
406
|
}
|
|
753
407
|
/**
|
|
754
|
-
*
|
|
408
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
409
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
410
|
+
* @returns {number}
|
|
755
411
|
*/
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
|
|
412
|
+
get fhe_type() {
|
|
413
|
+
const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
|
|
414
|
+
return ret;
|
|
760
415
|
}
|
|
761
416
|
/**
|
|
762
|
-
*
|
|
417
|
+
* The ciphertext format, see CiphertextFormat documentation for details.
|
|
418
|
+
* CiphertextFormat::default() is used if unspecified.
|
|
419
|
+
* @param {number} arg0
|
|
763
420
|
*/
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
let deferred1_1;
|
|
767
|
-
try {
|
|
768
|
-
const ret = wasm.__wbg_get_eip712domainmsg_verifying_contract(this.__wbg_ptr);
|
|
769
|
-
deferred1_0 = ret[0];
|
|
770
|
-
deferred1_1 = ret[1];
|
|
771
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
772
|
-
} finally {
|
|
773
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
774
|
-
}
|
|
421
|
+
set ciphertext_format(arg0) {
|
|
422
|
+
wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
|
|
775
423
|
}
|
|
776
424
|
/**
|
|
777
|
-
*
|
|
425
|
+
* The actual ciphertext to decrypt, taken directly from fhevm.
|
|
426
|
+
* @param {Uint8Array} arg0
|
|
778
427
|
*/
|
|
779
|
-
set
|
|
780
|
-
const ptr0 =
|
|
428
|
+
set ciphertext(arg0) {
|
|
429
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
781
430
|
const len0 = WASM_VECTOR_LEN;
|
|
782
|
-
wasm.
|
|
431
|
+
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
783
432
|
}
|
|
784
433
|
/**
|
|
785
|
-
*
|
|
434
|
+
* The external handle of the ciphertext (the handle used in the copro).
|
|
435
|
+
* @param {Uint8Array} arg0
|
|
786
436
|
*/
|
|
787
|
-
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
792
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
793
|
-
}
|
|
794
|
-
return v1;
|
|
437
|
+
set external_handle(arg0) {
|
|
438
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
439
|
+
const len0 = WASM_VECTOR_LEN;
|
|
440
|
+
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
795
441
|
}
|
|
796
442
|
/**
|
|
797
|
-
*
|
|
443
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
444
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
445
|
+
* @param {number} arg0
|
|
798
446
|
*/
|
|
799
|
-
set
|
|
800
|
-
|
|
801
|
-
var len0 = WASM_VECTOR_LEN;
|
|
802
|
-
wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
|
|
447
|
+
set fhe_type(arg0) {
|
|
448
|
+
wasm.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr, arg0);
|
|
803
449
|
}
|
|
804
450
|
}
|
|
451
|
+
if (Symbol.dispose) TypedCiphertext.prototype[Symbol.dispose] = TypedCiphertext.prototype.free;
|
|
805
452
|
|
|
806
|
-
|
|
807
|
-
? { register: () => {}, unregister: () => {} }
|
|
808
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_parseduserdecryptionrequest_free(ptr >>> 0, 1));
|
|
809
|
-
/**
|
|
810
|
-
* Validity of this struct is not checked.
|
|
811
|
-
*/
|
|
812
|
-
export class ParsedUserDecryptionRequest {
|
|
813
|
-
|
|
814
|
-
__destroy_into_raw() {
|
|
815
|
-
const ptr = this.__wbg_ptr;
|
|
816
|
-
this.__wbg_ptr = 0;
|
|
817
|
-
ParsedUserDecryptionRequestFinalization.unregister(this);
|
|
818
|
-
return ptr;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
free() {
|
|
822
|
-
const ptr = this.__destroy_into_raw();
|
|
823
|
-
wasm.__wbg_parseduserdecryptionrequest_free(ptr, 0);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
const PrivateEncKeyMlKem512Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
828
|
-
? { register: () => {}, unregister: () => {} }
|
|
829
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_privateenckeymlkem512_free(ptr >>> 0, 1));
|
|
830
|
-
|
|
831
|
-
export class PrivateEncKeyMlKem512 {
|
|
832
|
-
|
|
453
|
+
export class TypedPlaintext {
|
|
833
454
|
static __wrap(ptr) {
|
|
834
455
|
ptr = ptr >>> 0;
|
|
835
|
-
const obj = Object.create(
|
|
456
|
+
const obj = Object.create(TypedPlaintext.prototype);
|
|
836
457
|
obj.__wbg_ptr = ptr;
|
|
837
|
-
|
|
458
|
+
TypedPlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
838
459
|
return obj;
|
|
839
460
|
}
|
|
840
|
-
|
|
841
461
|
__destroy_into_raw() {
|
|
842
462
|
const ptr = this.__wbg_ptr;
|
|
843
463
|
this.__wbg_ptr = 0;
|
|
844
|
-
|
|
464
|
+
TypedPlaintextFinalization.unregister(this);
|
|
845
465
|
return ptr;
|
|
846
466
|
}
|
|
847
|
-
|
|
848
467
|
free() {
|
|
849
468
|
const ptr = this.__destroy_into_raw();
|
|
850
|
-
wasm.
|
|
469
|
+
wasm.__wbg_typedplaintext_free(ptr, 0);
|
|
851
470
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
ptr = ptr >>> 0;
|
|
862
|
-
const obj = Object.create(PrivateSigKey.prototype);
|
|
863
|
-
obj.__wbg_ptr = ptr;
|
|
864
|
-
PrivateSigKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
865
|
-
return obj;
|
|
471
|
+
/**
|
|
472
|
+
* The actual plaintext in bytes.
|
|
473
|
+
* @returns {Uint8Array}
|
|
474
|
+
*/
|
|
475
|
+
get bytes() {
|
|
476
|
+
const ret = wasm.__wbg_get_typedplaintext_bytes(this.__wbg_ptr);
|
|
477
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
478
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
479
|
+
return v1;
|
|
866
480
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
481
|
+
/**
|
|
482
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
483
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
484
|
+
* @returns {number}
|
|
485
|
+
*/
|
|
486
|
+
get fhe_type() {
|
|
487
|
+
const ret = wasm.__wbg_get_typedplaintext_fhe_type(this.__wbg_ptr);
|
|
488
|
+
return ret;
|
|
873
489
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
490
|
+
/**
|
|
491
|
+
* The actual plaintext in bytes.
|
|
492
|
+
* @param {Uint8Array} arg0
|
|
493
|
+
*/
|
|
494
|
+
set bytes(arg0) {
|
|
495
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
496
|
+
const len0 = WASM_VECTOR_LEN;
|
|
497
|
+
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
501
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
502
|
+
* @param {number} arg0
|
|
503
|
+
*/
|
|
504
|
+
set fhe_type(arg0) {
|
|
505
|
+
wasm.__wbg_set_typedplaintext_fhe_type(this.__wbg_ptr, arg0);
|
|
878
506
|
}
|
|
879
507
|
}
|
|
508
|
+
if (Symbol.dispose) TypedPlaintext.prototype[Symbol.dispose] = TypedPlaintext.prototype.free;
|
|
880
509
|
|
|
881
|
-
|
|
882
|
-
? { register: () => {}, unregister: () => {} }
|
|
883
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_publicenckeymlkem512_free(ptr >>> 0, 1));
|
|
884
|
-
|
|
885
|
-
export class PublicEncKeyMlKem512 {
|
|
886
|
-
|
|
510
|
+
export class TypedSigncryptedCiphertext {
|
|
887
511
|
static __wrap(ptr) {
|
|
888
512
|
ptr = ptr >>> 0;
|
|
889
|
-
const obj = Object.create(
|
|
513
|
+
const obj = Object.create(TypedSigncryptedCiphertext.prototype);
|
|
890
514
|
obj.__wbg_ptr = ptr;
|
|
891
|
-
|
|
515
|
+
TypedSigncryptedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
892
516
|
return obj;
|
|
893
517
|
}
|
|
894
|
-
|
|
518
|
+
static __unwrap(jsValue) {
|
|
519
|
+
if (!(jsValue instanceof TypedSigncryptedCiphertext)) {
|
|
520
|
+
return 0;
|
|
521
|
+
}
|
|
522
|
+
return jsValue.__destroy_into_raw();
|
|
523
|
+
}
|
|
895
524
|
__destroy_into_raw() {
|
|
896
525
|
const ptr = this.__wbg_ptr;
|
|
897
526
|
this.__wbg_ptr = 0;
|
|
898
|
-
|
|
527
|
+
TypedSigncryptedCiphertextFinalization.unregister(this);
|
|
899
528
|
return ptr;
|
|
900
529
|
}
|
|
901
|
-
|
|
902
530
|
free() {
|
|
903
531
|
const ptr = this.__destroy_into_raw();
|
|
904
|
-
wasm.
|
|
532
|
+
wasm.__wbg_typedsigncryptedciphertext_free(ptr, 0);
|
|
905
533
|
}
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
ptr = ptr >>> 0;
|
|
916
|
-
const obj = Object.create(PublicSigKey.prototype);
|
|
917
|
-
obj.__wbg_ptr = ptr;
|
|
918
|
-
PublicSigKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
919
|
-
return obj;
|
|
534
|
+
/**
|
|
535
|
+
* The external handles that were originally in the request.
|
|
536
|
+
* @returns {Uint8Array}
|
|
537
|
+
*/
|
|
538
|
+
get external_handle() {
|
|
539
|
+
const ret = wasm.__wbg_get_typedsigncryptedciphertext_external_handle(this.__wbg_ptr);
|
|
540
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
541
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
542
|
+
return v1;
|
|
920
543
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
544
|
+
/**
|
|
545
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
546
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
547
|
+
* @returns {number}
|
|
548
|
+
*/
|
|
549
|
+
get fhe_type() {
|
|
550
|
+
const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
|
|
551
|
+
return ret;
|
|
927
552
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
553
|
+
/**
|
|
554
|
+
* The packing factor determines whether the decrypted plaintext
|
|
555
|
+
* has a different way of packing compared to what is specified in the plaintext modulus.
|
|
556
|
+
* @returns {number}
|
|
557
|
+
*/
|
|
558
|
+
get packing_factor() {
|
|
559
|
+
const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
|
|
560
|
+
return ret >>> 0;
|
|
932
561
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
562
|
+
/**
|
|
563
|
+
* The signcrypted payload, using a hybrid encryption approach in
|
|
564
|
+
* sign-then-encrypt.
|
|
565
|
+
* @returns {Uint8Array}
|
|
566
|
+
*/
|
|
567
|
+
get signcrypted_ciphertext() {
|
|
568
|
+
const ret = wasm.__wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext(this.__wbg_ptr);
|
|
569
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
570
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
571
|
+
return v1;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* The external handles that were originally in the request.
|
|
575
|
+
* @param {Uint8Array} arg0
|
|
576
|
+
*/
|
|
577
|
+
set external_handle(arg0) {
|
|
578
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
579
|
+
const len0 = WASM_VECTOR_LEN;
|
|
580
|
+
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
584
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
585
|
+
* @param {number} arg0
|
|
586
|
+
*/
|
|
587
|
+
set fhe_type(arg0) {
|
|
588
|
+
wasm.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr, arg0);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* The packing factor determines whether the decrypted plaintext
|
|
592
|
+
* has a different way of packing compared to what is specified in the plaintext modulus.
|
|
593
|
+
* @param {number} arg0
|
|
594
|
+
*/
|
|
595
|
+
set packing_factor(arg0) {
|
|
596
|
+
wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* The signcrypted payload, using a hybrid encryption approach in
|
|
600
|
+
* sign-then-encrypt.
|
|
601
|
+
* @param {Uint8Array} arg0
|
|
602
|
+
*/
|
|
603
|
+
set signcrypted_ciphertext(arg0) {
|
|
604
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
605
|
+
const len0 = WASM_VECTOR_LEN;
|
|
606
|
+
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
951
607
|
}
|
|
608
|
+
}
|
|
609
|
+
if (Symbol.dispose) TypedSigncryptedCiphertext.prototype[Symbol.dispose] = TypedSigncryptedCiphertext.prototype.free;
|
|
952
610
|
|
|
611
|
+
export class UserDecryptionRequest {
|
|
953
612
|
__destroy_into_raw() {
|
|
954
613
|
const ptr = this.__wbg_ptr;
|
|
955
614
|
this.__wbg_ptr = 0;
|
|
956
|
-
|
|
615
|
+
UserDecryptionRequestFinalization.unregister(this);
|
|
957
616
|
return ptr;
|
|
958
617
|
}
|
|
959
|
-
|
|
960
618
|
free() {
|
|
961
619
|
const ptr = this.__destroy_into_raw();
|
|
962
|
-
wasm.
|
|
620
|
+
wasm.__wbg_userdecryptionrequest_free(ptr, 0);
|
|
963
621
|
}
|
|
964
622
|
/**
|
|
623
|
+
* The client's (blockchain wallet) address, encoded using EIP-55. I.e. including `0x`.
|
|
965
624
|
* @returns {string}
|
|
966
625
|
*/
|
|
967
|
-
get
|
|
626
|
+
get client_address() {
|
|
968
627
|
let deferred1_0;
|
|
969
628
|
let deferred1_1;
|
|
970
629
|
try {
|
|
971
|
-
const ret = wasm.
|
|
630
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_client_address(this.__wbg_ptr);
|
|
972
631
|
deferred1_0 = ret[0];
|
|
973
632
|
deferred1_1 = ret[1];
|
|
974
633
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -977,780 +636,1394 @@ export class RequestId {
|
|
|
977
636
|
}
|
|
978
637
|
}
|
|
979
638
|
/**
|
|
980
|
-
*
|
|
639
|
+
* MPC context ID which is used to identify the context to use for this request.
|
|
640
|
+
*
|
|
641
|
+
* NOTE: at the moment this can be None since we do not fully support multiple contexts.
|
|
642
|
+
* See <https://github.com/zama-ai/kms-internal/issues/2530>
|
|
643
|
+
* @returns {RequestId | undefined}
|
|
981
644
|
*/
|
|
982
|
-
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
645
|
+
get context_id() {
|
|
646
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_context_id(this.__wbg_ptr);
|
|
647
|
+
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
986
648
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
static __wrap(ptr) {
|
|
996
|
-
ptr = ptr >>> 0;
|
|
997
|
-
const obj = Object.create(ServerIdAddr.prototype);
|
|
998
|
-
obj.__wbg_ptr = ptr;
|
|
999
|
-
ServerIdAddrFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1000
|
-
return obj;
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
static __unwrap(jsValue) {
|
|
1004
|
-
if (!(jsValue instanceof ServerIdAddr)) {
|
|
1005
|
-
return 0;
|
|
1006
|
-
}
|
|
1007
|
-
return jsValue.__destroy_into_raw();
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
__destroy_into_raw() {
|
|
1011
|
-
const ptr = this.__wbg_ptr;
|
|
1012
|
-
this.__wbg_ptr = 0;
|
|
1013
|
-
ServerIdAddrFinalization.unregister(this);
|
|
1014
|
-
return ptr;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
free() {
|
|
1018
|
-
const ptr = this.__destroy_into_raw();
|
|
1019
|
-
wasm.__wbg_serveridaddr_free(ptr, 0);
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
const TypedCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1024
|
-
? { register: () => {}, unregister: () => {} }
|
|
1025
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_typedciphertext_free(ptr >>> 0, 1));
|
|
1026
|
-
|
|
1027
|
-
export class TypedCiphertext {
|
|
1028
|
-
|
|
1029
|
-
static __wrap(ptr) {
|
|
1030
|
-
ptr = ptr >>> 0;
|
|
1031
|
-
const obj = Object.create(TypedCiphertext.prototype);
|
|
1032
|
-
obj.__wbg_ptr = ptr;
|
|
1033
|
-
TypedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1034
|
-
return obj;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
static __unwrap(jsValue) {
|
|
1038
|
-
if (!(jsValue instanceof TypedCiphertext)) {
|
|
1039
|
-
return 0;
|
|
1040
|
-
}
|
|
1041
|
-
return jsValue.__destroy_into_raw();
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
__destroy_into_raw() {
|
|
1045
|
-
const ptr = this.__wbg_ptr;
|
|
1046
|
-
this.__wbg_ptr = 0;
|
|
1047
|
-
TypedCiphertextFinalization.unregister(this);
|
|
1048
|
-
return ptr;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
free() {
|
|
1052
|
-
const ptr = this.__destroy_into_raw();
|
|
1053
|
-
wasm.__wbg_typedciphertext_free(ptr, 0);
|
|
649
|
+
/**
|
|
650
|
+
* The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
|
|
651
|
+
* @returns {Eip712DomainMsg | undefined}
|
|
652
|
+
*/
|
|
653
|
+
get domain() {
|
|
654
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_domain(this.__wbg_ptr);
|
|
655
|
+
return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
|
|
1054
656
|
}
|
|
1055
657
|
/**
|
|
1056
|
-
*
|
|
658
|
+
* Encoding of the user's public encryption key for this request.
|
|
659
|
+
* This must be a bincode (v.1) encoded ML-KEM 512 key.
|
|
1057
660
|
* @returns {Uint8Array}
|
|
1058
661
|
*/
|
|
1059
|
-
get
|
|
1060
|
-
const ret = wasm.
|
|
662
|
+
get enc_key() {
|
|
663
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_enc_key(this.__wbg_ptr);
|
|
1061
664
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1062
665
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1063
666
|
return v1;
|
|
1064
667
|
}
|
|
1065
668
|
/**
|
|
1066
|
-
* The
|
|
1067
|
-
* @
|
|
669
|
+
* The epoch number placeholder (zama-ai/kms-internal#2743).
|
|
670
|
+
* @returns {RequestId | undefined}
|
|
1068
671
|
*/
|
|
1069
|
-
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
672
|
+
get epoch_id() {
|
|
673
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_epoch_id(this.__wbg_ptr);
|
|
674
|
+
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
1073
675
|
}
|
|
1074
676
|
/**
|
|
1075
|
-
*
|
|
1076
|
-
*
|
|
1077
|
-
* @returns {number}
|
|
677
|
+
* Extra data from the gateway.
|
|
678
|
+
* @returns {Uint8Array}
|
|
1078
679
|
*/
|
|
1079
|
-
get
|
|
1080
|
-
const ret = wasm.
|
|
1081
|
-
|
|
680
|
+
get extra_data() {
|
|
681
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_extra_data(this.__wbg_ptr);
|
|
682
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
683
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
684
|
+
return v1;
|
|
1082
685
|
}
|
|
1083
686
|
/**
|
|
1084
|
-
* The
|
|
1085
|
-
*
|
|
1086
|
-
* @
|
|
687
|
+
* The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
|
|
688
|
+
* used for key generation
|
|
689
|
+
* @returns {RequestId | undefined}
|
|
1087
690
|
*/
|
|
1088
|
-
|
|
1089
|
-
wasm.
|
|
691
|
+
get key_id() {
|
|
692
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_key_id(this.__wbg_ptr);
|
|
693
|
+
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
1090
694
|
}
|
|
1091
695
|
/**
|
|
1092
|
-
* The
|
|
1093
|
-
*
|
|
696
|
+
* The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
|
|
697
|
+
* prefix. Future queries for the result must use this request ID.
|
|
698
|
+
* @returns {RequestId | undefined}
|
|
1094
699
|
*/
|
|
1095
|
-
get
|
|
1096
|
-
const ret = wasm.
|
|
1097
|
-
|
|
1098
|
-
|
|
700
|
+
get request_id() {
|
|
701
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_request_id(this.__wbg_ptr);
|
|
702
|
+
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* The list of ciphertexts to decrypt for the user.
|
|
706
|
+
* @returns {TypedCiphertext[]}
|
|
707
|
+
*/
|
|
708
|
+
get typed_ciphertexts() {
|
|
709
|
+
const ret = wasm.__wbg_get_userdecryptionrequest_typed_ciphertexts(this.__wbg_ptr);
|
|
710
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
711
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1099
712
|
return v1;
|
|
1100
713
|
}
|
|
1101
714
|
/**
|
|
1102
|
-
* The
|
|
1103
|
-
* @param {
|
|
715
|
+
* The client's (blockchain wallet) address, encoded using EIP-55. I.e. including `0x`.
|
|
716
|
+
* @param {string} arg0
|
|
1104
717
|
*/
|
|
1105
|
-
set
|
|
1106
|
-
const ptr0 =
|
|
718
|
+
set client_address(arg0) {
|
|
719
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1107
720
|
const len0 = WASM_VECTOR_LEN;
|
|
1108
721
|
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1109
722
|
}
|
|
1110
723
|
/**
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
724
|
+
* MPC context ID which is used to identify the context to use for this request.
|
|
725
|
+
*
|
|
726
|
+
* NOTE: at the moment this can be None since we do not fully support multiple contexts.
|
|
727
|
+
* See <https://github.com/zama-ai/kms-internal/issues/2530>
|
|
728
|
+
* @param {RequestId | null} [arg0]
|
|
1114
729
|
*/
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
730
|
+
set context_id(arg0) {
|
|
731
|
+
let ptr0 = 0;
|
|
732
|
+
if (!isLikeNone(arg0)) {
|
|
733
|
+
_assertClass(arg0, RequestId);
|
|
734
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
735
|
+
}
|
|
736
|
+
wasm.__wbg_set_userdecryptionrequest_context_id(this.__wbg_ptr, ptr0);
|
|
1118
737
|
}
|
|
1119
738
|
/**
|
|
1120
|
-
* The
|
|
1121
|
-
*
|
|
1122
|
-
* @param {number} arg0
|
|
739
|
+
* The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
|
|
740
|
+
* @param {Eip712DomainMsg | null} [arg0]
|
|
1123
741
|
*/
|
|
1124
|
-
set
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_typedplaintext_free(ptr >>> 0, 1));
|
|
1132
|
-
|
|
1133
|
-
export class TypedPlaintext {
|
|
1134
|
-
|
|
1135
|
-
static __wrap(ptr) {
|
|
1136
|
-
ptr = ptr >>> 0;
|
|
1137
|
-
const obj = Object.create(TypedPlaintext.prototype);
|
|
1138
|
-
obj.__wbg_ptr = ptr;
|
|
1139
|
-
TypedPlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1140
|
-
return obj;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
__destroy_into_raw() {
|
|
1144
|
-
const ptr = this.__wbg_ptr;
|
|
1145
|
-
this.__wbg_ptr = 0;
|
|
1146
|
-
TypedPlaintextFinalization.unregister(this);
|
|
1147
|
-
return ptr;
|
|
742
|
+
set domain(arg0) {
|
|
743
|
+
let ptr0 = 0;
|
|
744
|
+
if (!isLikeNone(arg0)) {
|
|
745
|
+
_assertClass(arg0, Eip712DomainMsg);
|
|
746
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
747
|
+
}
|
|
748
|
+
wasm.__wbg_set_userdecryptionrequest_domain(this.__wbg_ptr, ptr0);
|
|
1148
749
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
750
|
+
/**
|
|
751
|
+
* Encoding of the user's public encryption key for this request.
|
|
752
|
+
* This must be a bincode (v.1) encoded ML-KEM 512 key.
|
|
753
|
+
* @param {Uint8Array} arg0
|
|
754
|
+
*/
|
|
755
|
+
set enc_key(arg0) {
|
|
756
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
757
|
+
const len0 = WASM_VECTOR_LEN;
|
|
758
|
+
wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
|
|
1153
759
|
}
|
|
1154
760
|
/**
|
|
1155
|
-
* The
|
|
1156
|
-
* @
|
|
761
|
+
* The epoch number placeholder (zama-ai/kms-internal#2743).
|
|
762
|
+
* @param {RequestId | null} [arg0]
|
|
1157
763
|
*/
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
764
|
+
set epoch_id(arg0) {
|
|
765
|
+
let ptr0 = 0;
|
|
766
|
+
if (!isLikeNone(arg0)) {
|
|
767
|
+
_assertClass(arg0, RequestId);
|
|
768
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
769
|
+
}
|
|
770
|
+
wasm.__wbg_set_userdecryptionrequest_epoch_id(this.__wbg_ptr, ptr0);
|
|
1163
771
|
}
|
|
1164
772
|
/**
|
|
1165
|
-
*
|
|
773
|
+
* Extra data from the gateway.
|
|
1166
774
|
* @param {Uint8Array} arg0
|
|
1167
775
|
*/
|
|
1168
|
-
set
|
|
776
|
+
set extra_data(arg0) {
|
|
1169
777
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1170
778
|
const len0 = WASM_VECTOR_LEN;
|
|
1171
|
-
wasm.
|
|
779
|
+
wasm.__wbg_set_eip712domainmsg_verifying_contract(this.__wbg_ptr, ptr0, len0);
|
|
1172
780
|
}
|
|
1173
781
|
/**
|
|
1174
|
-
* The
|
|
1175
|
-
*
|
|
1176
|
-
* @
|
|
782
|
+
* The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
|
|
783
|
+
* used for key generation
|
|
784
|
+
* @param {RequestId | null} [arg0]
|
|
1177
785
|
*/
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
786
|
+
set key_id(arg0) {
|
|
787
|
+
let ptr0 = 0;
|
|
788
|
+
if (!isLikeNone(arg0)) {
|
|
789
|
+
_assertClass(arg0, RequestId);
|
|
790
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
791
|
+
}
|
|
792
|
+
wasm.__wbg_set_userdecryptionrequest_key_id(this.__wbg_ptr, ptr0);
|
|
1181
793
|
}
|
|
1182
794
|
/**
|
|
1183
|
-
* The
|
|
1184
|
-
*
|
|
1185
|
-
* @param {
|
|
795
|
+
* The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
|
|
796
|
+
* prefix. Future queries for the result must use this request ID.
|
|
797
|
+
* @param {RequestId | null} [arg0]
|
|
1186
798
|
*/
|
|
1187
|
-
set
|
|
1188
|
-
|
|
799
|
+
set request_id(arg0) {
|
|
800
|
+
let ptr0 = 0;
|
|
801
|
+
if (!isLikeNone(arg0)) {
|
|
802
|
+
_assertClass(arg0, RequestId);
|
|
803
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
804
|
+
}
|
|
805
|
+
wasm.__wbg_set_userdecryptionrequest_request_id(this.__wbg_ptr, ptr0);
|
|
1189
806
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
static __wrap(ptr) {
|
|
1199
|
-
ptr = ptr >>> 0;
|
|
1200
|
-
const obj = Object.create(TypedSigncryptedCiphertext.prototype);
|
|
1201
|
-
obj.__wbg_ptr = ptr;
|
|
1202
|
-
TypedSigncryptedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1203
|
-
return obj;
|
|
807
|
+
/**
|
|
808
|
+
* The list of ciphertexts to decrypt for the user.
|
|
809
|
+
* @param {TypedCiphertext[]} arg0
|
|
810
|
+
*/
|
|
811
|
+
set typed_ciphertexts(arg0) {
|
|
812
|
+
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
813
|
+
const len0 = WASM_VECTOR_LEN;
|
|
814
|
+
wasm.__wbg_set_userdecryptionrequest_typed_ciphertexts(this.__wbg_ptr, ptr0, len0);
|
|
1204
815
|
}
|
|
816
|
+
}
|
|
817
|
+
if (Symbol.dispose) UserDecryptionRequest.prototype[Symbol.dispose] = UserDecryptionRequest.prototype.free;
|
|
1205
818
|
|
|
819
|
+
export class UserDecryptionResponse {
|
|
1206
820
|
static __unwrap(jsValue) {
|
|
1207
|
-
if (!(jsValue instanceof
|
|
821
|
+
if (!(jsValue instanceof UserDecryptionResponse)) {
|
|
1208
822
|
return 0;
|
|
1209
823
|
}
|
|
1210
824
|
return jsValue.__destroy_into_raw();
|
|
1211
825
|
}
|
|
1212
|
-
|
|
1213
826
|
__destroy_into_raw() {
|
|
1214
827
|
const ptr = this.__wbg_ptr;
|
|
1215
828
|
this.__wbg_ptr = 0;
|
|
1216
|
-
|
|
829
|
+
UserDecryptionResponseFinalization.unregister(this);
|
|
1217
830
|
return ptr;
|
|
1218
831
|
}
|
|
1219
|
-
|
|
1220
832
|
free() {
|
|
1221
833
|
const ptr = this.__destroy_into_raw();
|
|
1222
|
-
wasm.
|
|
1223
|
-
}
|
|
1224
|
-
/**
|
|
1225
|
-
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
1226
|
-
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
1227
|
-
* @returns {number}
|
|
1228
|
-
*/
|
|
1229
|
-
get fhe_type() {
|
|
1230
|
-
const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
|
|
1231
|
-
return ret;
|
|
834
|
+
wasm.__wbg_userdecryptionresponse_free(ptr, 0);
|
|
1232
835
|
}
|
|
1233
836
|
/**
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
837
|
+
* This is the external signature created from the Eip712 domain
|
|
838
|
+
* on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
|
|
839
|
+
* struct UserDecryptResponseVerification {
|
|
840
|
+
* bytes publicKey;
|
|
841
|
+
* uint256\[\] ctHandles;
|
|
842
|
+
* bytes userDecryptedShare; // serialization of payload
|
|
843
|
+
* bytes extraData;
|
|
844
|
+
* }
|
|
845
|
+
* @returns {Uint8Array}
|
|
1237
846
|
*/
|
|
1238
|
-
|
|
1239
|
-
wasm.
|
|
847
|
+
get external_signature() {
|
|
848
|
+
const ret = wasm.__wbg_get_userdecryptionresponse_external_signature(this.__wbg_ptr);
|
|
849
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
850
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
851
|
+
return v1;
|
|
1240
852
|
}
|
|
1241
853
|
/**
|
|
1242
|
-
*
|
|
1243
|
-
* sign-then-encrypt.
|
|
854
|
+
* Extra data used in the EIP712 signature - external_signature.
|
|
1244
855
|
* @returns {Uint8Array}
|
|
1245
856
|
*/
|
|
1246
|
-
get
|
|
1247
|
-
const ret = wasm.
|
|
857
|
+
get extra_data() {
|
|
858
|
+
const ret = wasm.__wbg_get_userdecryptionresponse_extra_data(this.__wbg_ptr);
|
|
1248
859
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1249
860
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1250
861
|
return v1;
|
|
1251
862
|
}
|
|
1252
863
|
/**
|
|
1253
|
-
* The
|
|
1254
|
-
*
|
|
1255
|
-
* @param {Uint8Array} arg0
|
|
864
|
+
* The actual \[UserDecryptionResponsePayload\].
|
|
865
|
+
* @returns {UserDecryptionResponsePayload | undefined}
|
|
1256
866
|
*/
|
|
1257
|
-
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1260
|
-
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
867
|
+
get payload() {
|
|
868
|
+
const ret = wasm.__wbg_get_userdecryptionresponse_payload(this.__wbg_ptr);
|
|
869
|
+
return ret === 0 ? undefined : UserDecryptionResponsePayload.__wrap(ret);
|
|
1261
870
|
}
|
|
1262
871
|
/**
|
|
1263
|
-
* The external handles that were originally in the request.
|
|
1264
872
|
* @returns {Uint8Array}
|
|
1265
873
|
*/
|
|
1266
|
-
get
|
|
1267
|
-
const ret = wasm.
|
|
874
|
+
get signature() {
|
|
875
|
+
const ret = wasm.__wbg_get_userdecryptionresponse_signature(this.__wbg_ptr);
|
|
1268
876
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1269
877
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1270
878
|
return v1;
|
|
1271
879
|
}
|
|
1272
880
|
/**
|
|
1273
|
-
*
|
|
881
|
+
* This is the external signature created from the Eip712 domain
|
|
882
|
+
* on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
|
|
883
|
+
* struct UserDecryptResponseVerification {
|
|
884
|
+
* bytes publicKey;
|
|
885
|
+
* uint256\[\] ctHandles;
|
|
886
|
+
* bytes userDecryptedShare; // serialization of payload
|
|
887
|
+
* bytes extraData;
|
|
888
|
+
* }
|
|
1274
889
|
* @param {Uint8Array} arg0
|
|
1275
890
|
*/
|
|
1276
|
-
set
|
|
891
|
+
set external_signature(arg0) {
|
|
1277
892
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1278
893
|
const len0 = WASM_VECTOR_LEN;
|
|
1279
894
|
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1280
895
|
}
|
|
1281
896
|
/**
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1284
|
-
* @returns {number}
|
|
897
|
+
* Extra data used in the EIP712 signature - external_signature.
|
|
898
|
+
* @param {Uint8Array} arg0
|
|
1285
899
|
*/
|
|
1286
|
-
|
|
1287
|
-
const
|
|
1288
|
-
|
|
900
|
+
set extra_data(arg0) {
|
|
901
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
902
|
+
const len0 = WASM_VECTOR_LEN;
|
|
903
|
+
wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
|
|
1289
904
|
}
|
|
1290
905
|
/**
|
|
1291
|
-
* The
|
|
1292
|
-
*
|
|
1293
|
-
* @param {number} arg0
|
|
906
|
+
* The actual \[UserDecryptionResponsePayload\].
|
|
907
|
+
* @param {UserDecryptionResponsePayload | null} [arg0]
|
|
1294
908
|
*/
|
|
1295
|
-
set
|
|
1296
|
-
|
|
909
|
+
set payload(arg0) {
|
|
910
|
+
let ptr0 = 0;
|
|
911
|
+
if (!isLikeNone(arg0)) {
|
|
912
|
+
_assertClass(arg0, UserDecryptionResponsePayload);
|
|
913
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
914
|
+
}
|
|
915
|
+
wasm.__wbg_set_userdecryptionresponse_payload(this.__wbg_ptr, ptr0);
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* @param {Uint8Array} arg0
|
|
919
|
+
*/
|
|
920
|
+
set signature(arg0) {
|
|
921
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
922
|
+
const len0 = WASM_VECTOR_LEN;
|
|
923
|
+
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
1297
924
|
}
|
|
1298
925
|
}
|
|
926
|
+
if (Symbol.dispose) UserDecryptionResponse.prototype[Symbol.dispose] = UserDecryptionResponse.prototype.free;
|
|
1299
927
|
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
928
|
+
export class UserDecryptionResponsePayload {
|
|
929
|
+
static __wrap(ptr) {
|
|
930
|
+
ptr = ptr >>> 0;
|
|
931
|
+
const obj = Object.create(UserDecryptionResponsePayload.prototype);
|
|
932
|
+
obj.__wbg_ptr = ptr;
|
|
933
|
+
UserDecryptionResponsePayloadFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
934
|
+
return obj;
|
|
935
|
+
}
|
|
1306
936
|
__destroy_into_raw() {
|
|
1307
937
|
const ptr = this.__wbg_ptr;
|
|
1308
938
|
this.__wbg_ptr = 0;
|
|
1309
|
-
|
|
939
|
+
UserDecryptionResponsePayloadFinalization.unregister(this);
|
|
1310
940
|
return ptr;
|
|
1311
941
|
}
|
|
1312
|
-
|
|
1313
942
|
free() {
|
|
1314
943
|
const ptr = this.__destroy_into_raw();
|
|
1315
|
-
wasm.
|
|
944
|
+
wasm.__wbg_userdecryptionresponsepayload_free(ptr, 0);
|
|
1316
945
|
}
|
|
1317
946
|
/**
|
|
1318
|
-
* The
|
|
1319
|
-
*
|
|
1320
|
-
* @returns {RequestId | undefined}
|
|
947
|
+
* The degree of the sharing scheme used.
|
|
948
|
+
* @returns {number}
|
|
1321
949
|
*/
|
|
1322
|
-
get
|
|
1323
|
-
const ret = wasm.
|
|
1324
|
-
return ret
|
|
950
|
+
get degree() {
|
|
951
|
+
const ret = wasm.__wbg_get_userdecryptionresponsepayload_degree(this.__wbg_ptr);
|
|
952
|
+
return ret >>> 0;
|
|
1325
953
|
}
|
|
1326
954
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1329
|
-
*
|
|
955
|
+
* This is needed to ensure the response corresponds to the request.
|
|
956
|
+
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
957
|
+
* under the given domain in the request.
|
|
958
|
+
* @returns {Uint8Array}
|
|
1330
959
|
*/
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
}
|
|
1337
|
-
wasm.__wbg_set_userdecryptionrequest_request_id(this.__wbg_ptr, ptr0);
|
|
960
|
+
get digest() {
|
|
961
|
+
const ret = wasm.__wbg_get_userdecryptionresponsepayload_digest(this.__wbg_ptr);
|
|
962
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
963
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
964
|
+
return v1;
|
|
1338
965
|
}
|
|
1339
966
|
/**
|
|
1340
|
-
* The
|
|
1341
|
-
*
|
|
967
|
+
* The ID of the MPC party doing the user decryption. Used for polynomial
|
|
968
|
+
* reconstruction.
|
|
969
|
+
* @returns {number}
|
|
1342
970
|
*/
|
|
1343
|
-
get
|
|
1344
|
-
const ret = wasm.
|
|
971
|
+
get party_id() {
|
|
972
|
+
const ret = wasm.__wbg_get_userdecryptionresponsepayload_party_id(this.__wbg_ptr);
|
|
973
|
+
return ret >>> 0;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* The resulting signcrypted ciphertexts, each ciphertext
|
|
977
|
+
* must be decrypted and then reconstructed with the other shares
|
|
978
|
+
* to produce the final plaintext.
|
|
979
|
+
* @returns {TypedSigncryptedCiphertext[]}
|
|
980
|
+
*/
|
|
981
|
+
get signcrypted_ciphertexts() {
|
|
982
|
+
const ret = wasm.__wbg_get_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr);
|
|
1345
983
|
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1346
984
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1347
985
|
return v1;
|
|
1348
986
|
}
|
|
1349
987
|
/**
|
|
1350
|
-
* The
|
|
1351
|
-
*
|
|
988
|
+
* The server's signature verification key, Encoded using SEC1.
|
|
989
|
+
* Needed to validate the response, but MUST also be linked to a list of
|
|
990
|
+
* trusted keys.
|
|
991
|
+
* @returns {Uint8Array}
|
|
1352
992
|
*/
|
|
1353
|
-
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
wasm.
|
|
993
|
+
get verification_key() {
|
|
994
|
+
const ret = wasm.__wbg_get_userdecryptionresponsepayload_verification_key(this.__wbg_ptr);
|
|
995
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
996
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
997
|
+
return v1;
|
|
1357
998
|
}
|
|
1358
999
|
/**
|
|
1359
|
-
* The
|
|
1360
|
-
*
|
|
1361
|
-
* @returns {RequestId | undefined}
|
|
1000
|
+
* The degree of the sharing scheme used.
|
|
1001
|
+
* @param {number} arg0
|
|
1362
1002
|
*/
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
1003
|
+
set degree(arg0) {
|
|
1004
|
+
wasm.__wbg_set_userdecryptionresponsepayload_degree(this.__wbg_ptr, arg0);
|
|
1366
1005
|
}
|
|
1367
1006
|
/**
|
|
1368
|
-
*
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1007
|
+
* This is needed to ensure the response corresponds to the request.
|
|
1008
|
+
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
1009
|
+
* under the given domain in the request.
|
|
1010
|
+
* @param {Uint8Array} arg0
|
|
1371
1011
|
*/
|
|
1372
|
-
set
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
ptr0 = arg0.__destroy_into_raw();
|
|
1377
|
-
}
|
|
1378
|
-
wasm.__wbg_set_userdecryptionrequest_key_id(this.__wbg_ptr, ptr0);
|
|
1012
|
+
set digest(arg0) {
|
|
1013
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1014
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1015
|
+
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1379
1016
|
}
|
|
1380
1017
|
/**
|
|
1381
|
-
* The
|
|
1382
|
-
*
|
|
1018
|
+
* The ID of the MPC party doing the user decryption. Used for polynomial
|
|
1019
|
+
* reconstruction.
|
|
1020
|
+
* @param {number} arg0
|
|
1383
1021
|
*/
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
let deferred1_1;
|
|
1387
|
-
try {
|
|
1388
|
-
const ret = wasm.__wbg_get_userdecryptionrequest_client_address(this.__wbg_ptr);
|
|
1389
|
-
deferred1_0 = ret[0];
|
|
1390
|
-
deferred1_1 = ret[1];
|
|
1391
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1392
|
-
} finally {
|
|
1393
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
/**
|
|
1397
|
-
* The client's (blockchain wallet) address, encoded using EIP-55. I.e. including `0x`.
|
|
1398
|
-
* @param {string} arg0
|
|
1399
|
-
*/
|
|
1400
|
-
set client_address(arg0) {
|
|
1401
|
-
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1402
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1403
|
-
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1404
|
-
}
|
|
1405
|
-
/**
|
|
1406
|
-
* Encoding of the user's public encryption key for this request.
|
|
1407
|
-
* This must be a bincode (v.1) encoded ML-KEM 512 key.
|
|
1408
|
-
* @returns {Uint8Array}
|
|
1409
|
-
*/
|
|
1410
|
-
get enc_key() {
|
|
1411
|
-
const ret = wasm.__wbg_get_userdecryptionrequest_enc_key(this.__wbg_ptr);
|
|
1412
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1413
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1414
|
-
return v1;
|
|
1022
|
+
set party_id(arg0) {
|
|
1023
|
+
wasm.__wbg_set_userdecryptionresponsepayload_party_id(this.__wbg_ptr, arg0);
|
|
1415
1024
|
}
|
|
1416
1025
|
/**
|
|
1417
|
-
*
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1026
|
+
* The resulting signcrypted ciphertexts, each ciphertext
|
|
1027
|
+
* must be decrypted and then reconstructed with the other shares
|
|
1028
|
+
* to produce the final plaintext.
|
|
1029
|
+
* @param {TypedSigncryptedCiphertext[]} arg0
|
|
1420
1030
|
*/
|
|
1421
|
-
set
|
|
1422
|
-
const ptr0 =
|
|
1031
|
+
set signcrypted_ciphertexts(arg0) {
|
|
1032
|
+
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1423
1033
|
const len0 = WASM_VECTOR_LEN;
|
|
1424
|
-
wasm.
|
|
1425
|
-
}
|
|
1426
|
-
/**
|
|
1427
|
-
* The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
|
|
1428
|
-
* @returns {Eip712DomainMsg | undefined}
|
|
1429
|
-
*/
|
|
1430
|
-
get domain() {
|
|
1431
|
-
const ret = wasm.__wbg_get_userdecryptionrequest_domain(this.__wbg_ptr);
|
|
1432
|
-
return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
|
|
1433
|
-
}
|
|
1434
|
-
/**
|
|
1435
|
-
* The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
|
|
1436
|
-
* @param {Eip712DomainMsg | null} [arg0]
|
|
1437
|
-
*/
|
|
1438
|
-
set domain(arg0) {
|
|
1439
|
-
let ptr0 = 0;
|
|
1440
|
-
if (!isLikeNone(arg0)) {
|
|
1441
|
-
_assertClass(arg0, Eip712DomainMsg);
|
|
1442
|
-
ptr0 = arg0.__destroy_into_raw();
|
|
1443
|
-
}
|
|
1444
|
-
wasm.__wbg_set_userdecryptionrequest_domain(this.__wbg_ptr, ptr0);
|
|
1445
|
-
}
|
|
1446
|
-
/**
|
|
1447
|
-
* Extra data from the gateway.
|
|
1448
|
-
* @returns {Uint8Array}
|
|
1449
|
-
*/
|
|
1450
|
-
get extra_data() {
|
|
1451
|
-
const ret = wasm.__wbg_get_userdecryptionrequest_extra_data(this.__wbg_ptr);
|
|
1452
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1453
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1454
|
-
return v1;
|
|
1034
|
+
wasm.__wbg_set_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr, ptr0, len0);
|
|
1455
1035
|
}
|
|
1456
1036
|
/**
|
|
1457
|
-
*
|
|
1037
|
+
* The server's signature verification key, Encoded using SEC1.
|
|
1038
|
+
* Needed to validate the response, but MUST also be linked to a list of
|
|
1039
|
+
* trusted keys.
|
|
1458
1040
|
* @param {Uint8Array} arg0
|
|
1459
1041
|
*/
|
|
1460
|
-
set
|
|
1042
|
+
set verification_key(arg0) {
|
|
1461
1043
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1462
1044
|
const len0 = WASM_VECTOR_LEN;
|
|
1463
|
-
wasm.
|
|
1464
|
-
}
|
|
1465
|
-
/**
|
|
1466
|
-
* MPC context ID which is used to identify the context to use for this request.
|
|
1467
|
-
*
|
|
1468
|
-
* NOTE: at the moment this can be None since we do not fully support multiple contexts.
|
|
1469
|
-
* See <https://github.com/zama-ai/kms-internal/issues/2530>
|
|
1470
|
-
* @returns {RequestId | undefined}
|
|
1471
|
-
*/
|
|
1472
|
-
get context_id() {
|
|
1473
|
-
const ret = wasm.__wbg_get_userdecryptionrequest_context_id(this.__wbg_ptr);
|
|
1474
|
-
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* MPC context ID which is used to identify the context to use for this request.
|
|
1478
|
-
*
|
|
1479
|
-
* NOTE: at the moment this can be None since we do not fully support multiple contexts.
|
|
1480
|
-
* See <https://github.com/zama-ai/kms-internal/issues/2530>
|
|
1481
|
-
* @param {RequestId | null} [arg0]
|
|
1482
|
-
*/
|
|
1483
|
-
set context_id(arg0) {
|
|
1484
|
-
let ptr0 = 0;
|
|
1485
|
-
if (!isLikeNone(arg0)) {
|
|
1486
|
-
_assertClass(arg0, RequestId);
|
|
1487
|
-
ptr0 = arg0.__destroy_into_raw();
|
|
1488
|
-
}
|
|
1489
|
-
wasm.__wbg_set_userdecryptionrequest_context_id(this.__wbg_ptr, ptr0);
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* The epoch number placeholder (zama-ai/kms-internal#2743).
|
|
1493
|
-
* @returns {RequestId | undefined}
|
|
1494
|
-
*/
|
|
1495
|
-
get epoch_id() {
|
|
1496
|
-
const ret = wasm.__wbg_get_userdecryptionrequest_epoch_id(this.__wbg_ptr);
|
|
1497
|
-
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
1045
|
+
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
1498
1046
|
}
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1047
|
+
}
|
|
1048
|
+
if (Symbol.dispose) UserDecryptionResponsePayload.prototype[Symbol.dispose] = UserDecryptionResponsePayload.prototype.free;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* @param {Client} client
|
|
1052
|
+
* @returns {string}
|
|
1053
|
+
*/
|
|
1054
|
+
export function get_client_address(client) {
|
|
1055
|
+
let deferred1_0;
|
|
1056
|
+
let deferred1_1;
|
|
1057
|
+
try {
|
|
1058
|
+
_assertClass(client, Client);
|
|
1059
|
+
const ret = wasm.get_client_address(client.__wbg_ptr);
|
|
1060
|
+
deferred1_0 = ret[0];
|
|
1061
|
+
deferred1_1 = ret[1];
|
|
1062
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1063
|
+
} finally {
|
|
1064
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1510
1065
|
}
|
|
1511
1066
|
}
|
|
1512
1067
|
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1068
|
+
/**
|
|
1069
|
+
* @param {Client} client
|
|
1070
|
+
* @returns {PrivateSigKey | undefined}
|
|
1071
|
+
*/
|
|
1072
|
+
export function get_client_secret_key(client) {
|
|
1073
|
+
_assertClass(client, Client);
|
|
1074
|
+
const ret = wasm.get_client_secret_key(client.__wbg_ptr);
|
|
1075
|
+
return ret === 0 ? undefined : PrivateSigKey.__wrap(ret);
|
|
1076
|
+
}
|
|
1516
1077
|
|
|
1517
|
-
|
|
1078
|
+
/**
|
|
1079
|
+
* @param {Client} client
|
|
1080
|
+
* @returns {ServerIdAddr[]}
|
|
1081
|
+
*/
|
|
1082
|
+
export function get_server_addrs(client) {
|
|
1083
|
+
_assertClass(client, Client);
|
|
1084
|
+
const ret = wasm.get_server_addrs(client.__wbg_ptr);
|
|
1085
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1086
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1087
|
+
return v1;
|
|
1088
|
+
}
|
|
1518
1089
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1090
|
+
/**
|
|
1091
|
+
* This function is *not* used by relayer-sdk because the decryption
|
|
1092
|
+
* is handled by [process_user_decryption_resp].
|
|
1093
|
+
* It's just here for completeness and tests.
|
|
1094
|
+
* @param {Uint8Array} ct
|
|
1095
|
+
* @param {PrivateEncKeyMlKem512} my_sk
|
|
1096
|
+
* @returns {Uint8Array}
|
|
1097
|
+
*/
|
|
1098
|
+
export function ml_kem_pke_decrypt(ct, my_sk) {
|
|
1099
|
+
const ptr0 = passArray8ToWasm0(ct, wasm.__wbindgen_malloc);
|
|
1100
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1101
|
+
_assertClass(my_sk, PrivateEncKeyMlKem512);
|
|
1102
|
+
const ret = wasm.ml_kem_pke_decrypt(ptr0, len0, my_sk.__wbg_ptr);
|
|
1103
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1104
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1105
|
+
return v2;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* This function is *not* used by relayer-sdk because the encryption
|
|
1110
|
+
* happens on the KMS side. It's just here for completeness and tests.
|
|
1111
|
+
* @param {Uint8Array} msg
|
|
1112
|
+
* @param {PublicEncKeyMlKem512} their_pk
|
|
1113
|
+
* @returns {Uint8Array}
|
|
1114
|
+
*/
|
|
1115
|
+
export function ml_kem_pke_encrypt(msg, their_pk) {
|
|
1116
|
+
const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
|
|
1117
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1118
|
+
_assertClass(their_pk, PublicEncKeyMlKem512);
|
|
1119
|
+
const ret = wasm.ml_kem_pke_encrypt(ptr0, len0, their_pk.__wbg_ptr);
|
|
1120
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1121
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1122
|
+
return v2;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* @param {PrivateEncKeyMlKem512} sk
|
|
1127
|
+
* @returns {PublicEncKeyMlKem512}
|
|
1128
|
+
*/
|
|
1129
|
+
export function ml_kem_pke_get_pk(sk) {
|
|
1130
|
+
_assertClass(sk, PrivateEncKeyMlKem512);
|
|
1131
|
+
const ret = wasm.ml_kem_pke_get_pk(sk.__wbg_ptr);
|
|
1132
|
+
return PublicEncKeyMlKem512.__wrap(ret);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* @returns {PrivateEncKeyMlKem512}
|
|
1137
|
+
*/
|
|
1138
|
+
export function ml_kem_pke_keygen() {
|
|
1139
|
+
const ret = wasm.ml_kem_pke_keygen();
|
|
1140
|
+
return PrivateEncKeyMlKem512.__wrap(ret);
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* @returns {number}
|
|
1145
|
+
*/
|
|
1146
|
+
export function ml_kem_pke_pk_len() {
|
|
1147
|
+
const ret = wasm.ml_kem_pke_pk_len();
|
|
1148
|
+
return ret >>> 0;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* @param {PublicEncKeyMlKem512} pk
|
|
1153
|
+
* @returns {Uint8Array}
|
|
1154
|
+
*/
|
|
1155
|
+
export function ml_kem_pke_pk_to_u8vec(pk) {
|
|
1156
|
+
_assertClass(pk, PublicEncKeyMlKem512);
|
|
1157
|
+
const ret = wasm.ml_kem_pke_pk_to_u8vec(pk.__wbg_ptr);
|
|
1158
|
+
if (ret[3]) {
|
|
1159
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1524
1160
|
}
|
|
1161
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1162
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1163
|
+
return v1;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* @returns {number}
|
|
1168
|
+
*/
|
|
1169
|
+
export function ml_kem_pke_sk_len() {
|
|
1170
|
+
const ret = wasm.ml_kem_pke_sk_len();
|
|
1171
|
+
return ret >>> 0;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* @param {PrivateEncKeyMlKem512} sk
|
|
1176
|
+
* @returns {Uint8Array}
|
|
1177
|
+
*/
|
|
1178
|
+
export function ml_kem_pke_sk_to_u8vec(sk) {
|
|
1179
|
+
_assertClass(sk, PrivateEncKeyMlKem512);
|
|
1180
|
+
const ret = wasm.ml_kem_pke_sk_to_u8vec(sk.__wbg_ptr);
|
|
1181
|
+
if (ret[3]) {
|
|
1182
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1183
|
+
}
|
|
1184
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1185
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1186
|
+
return v1;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Instantiate a new client.
|
|
1191
|
+
*
|
|
1192
|
+
* * `server_addrs` - a list of KMS server ID with EIP-55 addresses,
|
|
1193
|
+
* the elements in the list can be created using [new_server_id_addr].
|
|
1194
|
+
*
|
|
1195
|
+
* * `client_address_hex` - the client (wallet) address in hex,
|
|
1196
|
+
* must be prefixed with "0x".
|
|
1197
|
+
*
|
|
1198
|
+
* * `fhe_parameter` - the parameter choice, which can be either `"test"` or `"default"`.
|
|
1199
|
+
* The "default" parameter choice is selected if no matching string is found.
|
|
1200
|
+
* @param {ServerIdAddr[]} server_addrs
|
|
1201
|
+
* @param {string} client_address_hex
|
|
1202
|
+
* @param {string} fhe_parameter
|
|
1203
|
+
* @returns {Client}
|
|
1204
|
+
*/
|
|
1205
|
+
export function new_client(server_addrs, client_address_hex, fhe_parameter) {
|
|
1206
|
+
const ptr0 = passArrayJsValueToWasm0(server_addrs, wasm.__wbindgen_malloc);
|
|
1207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1208
|
+
const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1209
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1210
|
+
const ptr2 = passStringToWasm0(fhe_parameter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1211
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1212
|
+
const ret = wasm.new_client(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1213
|
+
if (ret[2]) {
|
|
1214
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1215
|
+
}
|
|
1216
|
+
return Client.__wrap(ret[0]);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* Create a new [ServerIdAddr] structure that holds an ID and an address
|
|
1221
|
+
* which must be a valid EIP-55 address, notably prefixed with "0x".
|
|
1222
|
+
* @param {number} id
|
|
1223
|
+
* @param {string} addr
|
|
1224
|
+
* @returns {ServerIdAddr}
|
|
1225
|
+
*/
|
|
1226
|
+
export function new_server_id_addr(id, addr) {
|
|
1227
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1228
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1229
|
+
const ret = wasm.new_server_id_addr(id, ptr0, len0);
|
|
1230
|
+
if (ret[2]) {
|
|
1231
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1232
|
+
}
|
|
1233
|
+
return ServerIdAddr.__wrap(ret[0]);
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* @param {PrivateSigKey} sk
|
|
1238
|
+
* @returns {Uint8Array}
|
|
1239
|
+
*/
|
|
1240
|
+
export function private_sig_key_to_u8vec(sk) {
|
|
1241
|
+
_assertClass(sk, PrivateSigKey);
|
|
1242
|
+
const ret = wasm.private_sig_key_to_u8vec(sk.__wbg_ptr);
|
|
1243
|
+
if (ret[3]) {
|
|
1244
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1245
|
+
}
|
|
1246
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1247
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1248
|
+
return v1;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
/**
|
|
1252
|
+
* Process the user_decryption response from Rust objects.
|
|
1253
|
+
* Consider using [process_user_decryption_resp_from_js]
|
|
1254
|
+
* when using the JS API.
|
|
1255
|
+
* The result is a byte array representing a plaintext of any length.
|
|
1256
|
+
*
|
|
1257
|
+
* * `client` - client that wants to perform user_decryption.
|
|
1258
|
+
*
|
|
1259
|
+
* * `request` - the initial user_decryption request.
|
|
1260
|
+
* Must be given if `verify` is true.
|
|
1261
|
+
*
|
|
1262
|
+
* * `eip712_domain` - the EIP-712 domain.
|
|
1263
|
+
* Must be given if `verify` is true.
|
|
1264
|
+
*
|
|
1265
|
+
* * `agg_resp` - the vector of user_decryption responses.
|
|
1266
|
+
*
|
|
1267
|
+
* * `enc_pk` - The ephemeral public key.
|
|
1268
|
+
*
|
|
1269
|
+
* * `enc_sk` - The ephemeral secret key.
|
|
1270
|
+
*
|
|
1271
|
+
* * `verify` - Whether to perform signature verification for the response.
|
|
1272
|
+
* It is insecure if `verify = false`!
|
|
1273
|
+
* @param {Client} client
|
|
1274
|
+
* @param {ParsedUserDecryptionRequest | null | undefined} request
|
|
1275
|
+
* @param {Eip712DomainMsg | null | undefined} eip712_domain
|
|
1276
|
+
* @param {UserDecryptionResponse[]} agg_resp
|
|
1277
|
+
* @param {PublicEncKeyMlKem512} enc_pk
|
|
1278
|
+
* @param {PrivateEncKeyMlKem512} enc_sk
|
|
1279
|
+
* @param {boolean} verify
|
|
1280
|
+
* @returns {TypedPlaintext[]}
|
|
1281
|
+
*/
|
|
1282
|
+
export function process_user_decryption_resp(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
|
|
1283
|
+
_assertClass(client, Client);
|
|
1284
|
+
let ptr0 = 0;
|
|
1285
|
+
if (!isLikeNone(request)) {
|
|
1286
|
+
_assertClass(request, ParsedUserDecryptionRequest);
|
|
1287
|
+
ptr0 = request.__destroy_into_raw();
|
|
1288
|
+
}
|
|
1289
|
+
let ptr1 = 0;
|
|
1290
|
+
if (!isLikeNone(eip712_domain)) {
|
|
1291
|
+
_assertClass(eip712_domain, Eip712DomainMsg);
|
|
1292
|
+
ptr1 = eip712_domain.__destroy_into_raw();
|
|
1293
|
+
}
|
|
1294
|
+
const ptr2 = passArrayJsValueToWasm0(agg_resp, wasm.__wbindgen_malloc);
|
|
1295
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1296
|
+
_assertClass(enc_pk, PublicEncKeyMlKem512);
|
|
1297
|
+
_assertClass(enc_sk, PrivateEncKeyMlKem512);
|
|
1298
|
+
const ret = wasm.process_user_decryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
|
|
1299
|
+
if (ret[3]) {
|
|
1300
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1301
|
+
}
|
|
1302
|
+
var v4 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1303
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1304
|
+
return v4;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Process the user_decryption response from JavaScript objects.
|
|
1309
|
+
* The returned result is a byte array representing a plaintext of any length,
|
|
1310
|
+
* postprocessing is returned to turn it into an integer.
|
|
1311
|
+
*
|
|
1312
|
+
* * `client` - client that wants to perform user_decryption.
|
|
1313
|
+
*
|
|
1314
|
+
* * `request` - the initial user_decryption request JS object.
|
|
1315
|
+
* It can be set to null if `verify` is false.
|
|
1316
|
+
* Otherwise the caller needs to give the following JS object.
|
|
1317
|
+
* Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
|
|
1318
|
+
* The signature field is not needed.
|
|
1319
|
+
* ```
|
|
1320
|
+
* {
|
|
1321
|
+
* signature: undefined,
|
|
1322
|
+
* client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
|
|
1323
|
+
* enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
|
|
1324
|
+
* ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
|
|
1325
|
+
* eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
|
|
1326
|
+
* }
|
|
1327
|
+
* ```
|
|
1328
|
+
*
|
|
1329
|
+
* * `eip712_domain` - the EIP-712 domain JS object.
|
|
1330
|
+
* It can be set to null if `verify` is false.
|
|
1331
|
+
* Otherwise the caller needs to give the following JS object.
|
|
1332
|
+
* Note that `salt` is optional and `verifying_contract` follows EIP-55,
|
|
1333
|
+
* additionally, `chain_id` is an array of u8.
|
|
1334
|
+
* ```
|
|
1335
|
+
* {
|
|
1336
|
+
* name: 'Authorization token',
|
|
1337
|
+
* version: '1',
|
|
1338
|
+
* chain_id: [
|
|
1339
|
+
* 70, 31, 0, 0, 0, 0, 0, 0, 0,
|
|
1340
|
+
* 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
1341
|
+
* 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
1342
|
+
* 0, 0, 0, 0, 0
|
|
1343
|
+
* ],
|
|
1344
|
+
* verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657',
|
|
1345
|
+
* salt: []
|
|
1346
|
+
* }
|
|
1347
|
+
* ```
|
|
1348
|
+
*
|
|
1349
|
+
* * `agg_resp` - the response JS object from the gateway.
|
|
1350
|
+
* It has two fields like so, both are hex encoded byte arrays.
|
|
1351
|
+
* ```
|
|
1352
|
+
* [
|
|
1353
|
+
* {
|
|
1354
|
+
* signature: '69e7e040cab157aa819015b321c012dccb1545ffefd325b359b492653f0347517e28e66c572cdc299e259024329859ff9fcb0096e1ce072af0b6e1ca1fe25ec6',
|
|
1355
|
+
* payload: '0100000029...',
|
|
1356
|
+
* extra_data: '01234...',
|
|
1357
|
+
* }
|
|
1358
|
+
* ]
|
|
1359
|
+
* ```
|
|
1360
|
+
*
|
|
1361
|
+
* * `enc_pk` - The ephemeral public key.
|
|
1362
|
+
*
|
|
1363
|
+
* * `enc_sk` - The ephemeral secret key.
|
|
1364
|
+
*
|
|
1365
|
+
* * `verify` - Whether to perform signature verification for the response.
|
|
1366
|
+
* It is insecure if `verify = false`!
|
|
1367
|
+
* @param {Client} client
|
|
1368
|
+
* @param {any} request
|
|
1369
|
+
* @param {any} eip712_domain
|
|
1370
|
+
* @param {any} agg_resp
|
|
1371
|
+
* @param {PublicEncKeyMlKem512} enc_pk
|
|
1372
|
+
* @param {PrivateEncKeyMlKem512} enc_sk
|
|
1373
|
+
* @param {boolean} verify
|
|
1374
|
+
* @returns {TypedPlaintext[]}
|
|
1375
|
+
*/
|
|
1376
|
+
export function process_user_decryption_resp_from_js(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
|
|
1377
|
+
_assertClass(client, Client);
|
|
1378
|
+
_assertClass(enc_pk, PublicEncKeyMlKem512);
|
|
1379
|
+
_assertClass(enc_sk, PrivateEncKeyMlKem512);
|
|
1380
|
+
const ret = wasm.process_user_decryption_resp_from_js(client.__wbg_ptr, request, eip712_domain, agg_resp, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
|
|
1381
|
+
if (ret[3]) {
|
|
1382
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1383
|
+
}
|
|
1384
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1385
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1386
|
+
return v1;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* @param {PublicSigKey} pk
|
|
1391
|
+
* @returns {Uint8Array}
|
|
1392
|
+
*/
|
|
1393
|
+
export function public_sig_key_to_u8vec(pk) {
|
|
1394
|
+
_assertClass(pk, PublicSigKey);
|
|
1395
|
+
const ret = wasm.public_sig_key_to_u8vec(pk.__wbg_ptr);
|
|
1396
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1397
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1398
|
+
return v1;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* @param {Uint8Array} v
|
|
1403
|
+
* @returns {PublicEncKeyMlKem512}
|
|
1404
|
+
*/
|
|
1405
|
+
export function u8vec_to_ml_kem_pke_pk(v) {
|
|
1406
|
+
const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
|
|
1407
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1408
|
+
const ret = wasm.u8vec_to_ml_kem_pke_pk(ptr0, len0);
|
|
1409
|
+
if (ret[2]) {
|
|
1410
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1411
|
+
}
|
|
1412
|
+
return PublicEncKeyMlKem512.__wrap(ret[0]);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* @param {Uint8Array} v
|
|
1417
|
+
* @returns {PrivateEncKeyMlKem512}
|
|
1418
|
+
*/
|
|
1419
|
+
export function u8vec_to_ml_kem_pke_sk(v) {
|
|
1420
|
+
const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
|
|
1421
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1422
|
+
const ret = wasm.u8vec_to_ml_kem_pke_sk(ptr0, len0);
|
|
1423
|
+
if (ret[2]) {
|
|
1424
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1425
|
+
}
|
|
1426
|
+
return PrivateEncKeyMlKem512.__wrap(ret[0]);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* @param {Uint8Array} v
|
|
1431
|
+
* @returns {PrivateSigKey}
|
|
1432
|
+
*/
|
|
1433
|
+
export function u8vec_to_private_sig_key(v) {
|
|
1434
|
+
const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
|
|
1435
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1436
|
+
const ret = wasm.u8vec_to_private_sig_key(ptr0, len0);
|
|
1437
|
+
if (ret[2]) {
|
|
1438
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1439
|
+
}
|
|
1440
|
+
return PrivateSigKey.__wrap(ret[0]);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* @param {Uint8Array} v
|
|
1445
|
+
* @returns {PublicSigKey}
|
|
1446
|
+
*/
|
|
1447
|
+
export function u8vec_to_public_sig_key(v) {
|
|
1448
|
+
const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
|
|
1449
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1450
|
+
const ret = wasm.u8vec_to_public_sig_key(ptr0, len0);
|
|
1451
|
+
if (ret[2]) {
|
|
1452
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1453
|
+
}
|
|
1454
|
+
return PublicSigKey.__wrap(ret[0]);
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
function __wbg_get_imports() {
|
|
1458
|
+
const import0 = {
|
|
1459
|
+
__proto__: null,
|
|
1460
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
1461
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1462
|
+
return ret;
|
|
1463
|
+
},
|
|
1464
|
+
__wbg_Number_04624de7d0e8332d: function(arg0) {
|
|
1465
|
+
const ret = Number(arg0);
|
|
1466
|
+
return ret;
|
|
1467
|
+
},
|
|
1468
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
1469
|
+
const ret = String(arg1);
|
|
1470
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1471
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1472
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1473
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1474
|
+
},
|
|
1475
|
+
__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
|
|
1476
|
+
const v = arg0;
|
|
1477
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1478
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1479
|
+
},
|
|
1480
|
+
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
|
|
1481
|
+
const ret = debugString(arg1);
|
|
1482
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1483
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1484
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1485
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1486
|
+
},
|
|
1487
|
+
__wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
|
|
1488
|
+
const ret = arg0 in arg1;
|
|
1489
|
+
return ret;
|
|
1490
|
+
},
|
|
1491
|
+
__wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
|
|
1492
|
+
const ret = typeof(arg0) === 'function';
|
|
1493
|
+
return ret;
|
|
1494
|
+
},
|
|
1495
|
+
__wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {
|
|
1496
|
+
const ret = arg0 === null;
|
|
1497
|
+
return ret;
|
|
1498
|
+
},
|
|
1499
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
1500
|
+
const val = arg0;
|
|
1501
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1502
|
+
return ret;
|
|
1503
|
+
},
|
|
1504
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
1505
|
+
const ret = typeof(arg0) === 'string';
|
|
1506
|
+
return ret;
|
|
1507
|
+
},
|
|
1508
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
1509
|
+
const ret = arg0 === undefined;
|
|
1510
|
+
return ret;
|
|
1511
|
+
},
|
|
1512
|
+
__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
|
|
1513
|
+
const ret = arg0 == arg1;
|
|
1514
|
+
return ret;
|
|
1515
|
+
},
|
|
1516
|
+
__wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
|
|
1517
|
+
const obj = arg1;
|
|
1518
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1519
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1520
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1521
|
+
},
|
|
1522
|
+
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
1523
|
+
const obj = arg1;
|
|
1524
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1525
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1526
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1527
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1528
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1529
|
+
},
|
|
1530
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
1531
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1532
|
+
},
|
|
1533
|
+
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
1534
|
+
const ret = arg0.call(arg1);
|
|
1535
|
+
return ret;
|
|
1536
|
+
}, arguments); },
|
|
1537
|
+
__wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1538
|
+
const ret = arg0.call(arg1, arg2);
|
|
1539
|
+
return ret;
|
|
1540
|
+
}, arguments); },
|
|
1541
|
+
__wbg_crypto_ed58b8e10a292839: function(arg0) {
|
|
1542
|
+
const ret = arg0.crypto;
|
|
1543
|
+
return ret;
|
|
1544
|
+
},
|
|
1545
|
+
__wbg_done_57b39ecd9addfe81: function(arg0) {
|
|
1546
|
+
const ret = arg0.done;
|
|
1547
|
+
return ret;
|
|
1548
|
+
},
|
|
1549
|
+
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
1550
|
+
let deferred0_0;
|
|
1551
|
+
let deferred0_1;
|
|
1552
|
+
try {
|
|
1553
|
+
deferred0_0 = arg0;
|
|
1554
|
+
deferred0_1 = arg1;
|
|
1555
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
1556
|
+
} finally {
|
|
1557
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1560
|
+
__wbg_getRandomValues_bcb4912f16000dc4: function() { return handleError(function (arg0, arg1) {
|
|
1561
|
+
arg0.getRandomValues(arg1);
|
|
1562
|
+
}, arguments); },
|
|
1563
|
+
__wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
|
|
1564
|
+
const ret = arg0[arg1 >>> 0];
|
|
1565
|
+
return ret;
|
|
1566
|
+
},
|
|
1567
|
+
__wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
|
|
1568
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1569
|
+
return ret;
|
|
1570
|
+
}, arguments); },
|
|
1571
|
+
__wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
|
|
1572
|
+
const ret = arg0[arg1];
|
|
1573
|
+
return ret;
|
|
1574
|
+
},
|
|
1575
|
+
__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
|
|
1576
|
+
let result;
|
|
1577
|
+
try {
|
|
1578
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1579
|
+
} catch (_) {
|
|
1580
|
+
result = false;
|
|
1581
|
+
}
|
|
1582
|
+
const ret = result;
|
|
1583
|
+
return ret;
|
|
1584
|
+
},
|
|
1585
|
+
__wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
|
|
1586
|
+
let result;
|
|
1587
|
+
try {
|
|
1588
|
+
result = arg0 instanceof Uint8Array;
|
|
1589
|
+
} catch (_) {
|
|
1590
|
+
result = false;
|
|
1591
|
+
}
|
|
1592
|
+
const ret = result;
|
|
1593
|
+
return ret;
|
|
1594
|
+
},
|
|
1595
|
+
__wbg_isArray_d314bb98fcf08331: function(arg0) {
|
|
1596
|
+
const ret = Array.isArray(arg0);
|
|
1597
|
+
return ret;
|
|
1598
|
+
},
|
|
1599
|
+
__wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
|
|
1600
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1601
|
+
return ret;
|
|
1602
|
+
},
|
|
1603
|
+
__wbg_iterator_6ff6560ca1568e55: function() {
|
|
1604
|
+
const ret = Symbol.iterator;
|
|
1605
|
+
return ret;
|
|
1606
|
+
},
|
|
1607
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
1608
|
+
const ret = arg0.length;
|
|
1609
|
+
return ret;
|
|
1610
|
+
},
|
|
1611
|
+
__wbg_length_35a7bace40f36eac: function(arg0) {
|
|
1612
|
+
const ret = arg0.length;
|
|
1613
|
+
return ret;
|
|
1614
|
+
},
|
|
1615
|
+
__wbg_msCrypto_0a36e2ec3a343d26: function(arg0) {
|
|
1616
|
+
const ret = arg0.msCrypto;
|
|
1617
|
+
return ret;
|
|
1618
|
+
},
|
|
1619
|
+
__wbg_new_8a6f238a6ece86ea: function() {
|
|
1620
|
+
const ret = new Error();
|
|
1621
|
+
return ret;
|
|
1622
|
+
},
|
|
1623
|
+
__wbg_new_dd2b680c8bf6ae29: function(arg0) {
|
|
1624
|
+
const ret = new Uint8Array(arg0);
|
|
1625
|
+
return ret;
|
|
1626
|
+
},
|
|
1627
|
+
__wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
|
|
1628
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1629
|
+
return ret;
|
|
1630
|
+
},
|
|
1631
|
+
__wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
|
|
1632
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1633
|
+
return ret;
|
|
1634
|
+
},
|
|
1635
|
+
__wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
|
|
1636
|
+
const ret = arg0.next();
|
|
1637
|
+
return ret;
|
|
1638
|
+
}, arguments); },
|
|
1639
|
+
__wbg_next_418f80d8f5303233: function(arg0) {
|
|
1640
|
+
const ret = arg0.next;
|
|
1641
|
+
return ret;
|
|
1642
|
+
},
|
|
1643
|
+
__wbg_node_02999533c4ea02e3: function(arg0) {
|
|
1644
|
+
const ret = arg0.node;
|
|
1645
|
+
return ret;
|
|
1646
|
+
},
|
|
1647
|
+
__wbg_process_5c1d670bc53614b8: function(arg0) {
|
|
1648
|
+
const ret = arg0.process;
|
|
1649
|
+
return ret;
|
|
1650
|
+
},
|
|
1651
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
1652
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1653
|
+
},
|
|
1654
|
+
__wbg_randomFillSync_ab2cfe79ebbf2740: function() { return handleError(function (arg0, arg1) {
|
|
1655
|
+
arg0.randomFillSync(arg1);
|
|
1656
|
+
}, arguments); },
|
|
1657
|
+
__wbg_require_79b1e9274cde3c87: function() { return handleError(function () {
|
|
1658
|
+
const ret = module.require;
|
|
1659
|
+
return ret;
|
|
1660
|
+
}, arguments); },
|
|
1661
|
+
__wbg_serveridaddr_new: function(arg0) {
|
|
1662
|
+
const ret = ServerIdAddr.__wrap(arg0);
|
|
1663
|
+
return ret;
|
|
1664
|
+
},
|
|
1665
|
+
__wbg_serveridaddr_unwrap: function(arg0) {
|
|
1666
|
+
const ret = ServerIdAddr.__unwrap(arg0);
|
|
1667
|
+
return ret;
|
|
1668
|
+
},
|
|
1669
|
+
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
1670
|
+
const ret = arg1.stack;
|
|
1671
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1672
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1673
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1674
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1675
|
+
},
|
|
1676
|
+
__wbg_static_accessor_GLOBAL_12837167ad935116: function() {
|
|
1677
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1678
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1679
|
+
},
|
|
1680
|
+
__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
|
|
1681
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1682
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1683
|
+
},
|
|
1684
|
+
__wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
|
|
1685
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1686
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1687
|
+
},
|
|
1688
|
+
__wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
|
|
1689
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1690
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1691
|
+
},
|
|
1692
|
+
__wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
|
|
1693
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1694
|
+
return ret;
|
|
1695
|
+
},
|
|
1696
|
+
__wbg_typedciphertext_new: function(arg0) {
|
|
1697
|
+
const ret = TypedCiphertext.__wrap(arg0);
|
|
1698
|
+
return ret;
|
|
1699
|
+
},
|
|
1700
|
+
__wbg_typedciphertext_unwrap: function(arg0) {
|
|
1701
|
+
const ret = TypedCiphertext.__unwrap(arg0);
|
|
1702
|
+
return ret;
|
|
1703
|
+
},
|
|
1704
|
+
__wbg_typedplaintext_new: function(arg0) {
|
|
1705
|
+
const ret = TypedPlaintext.__wrap(arg0);
|
|
1706
|
+
return ret;
|
|
1707
|
+
},
|
|
1708
|
+
__wbg_typedsigncryptedciphertext_new: function(arg0) {
|
|
1709
|
+
const ret = TypedSigncryptedCiphertext.__wrap(arg0);
|
|
1710
|
+
return ret;
|
|
1711
|
+
},
|
|
1712
|
+
__wbg_typedsigncryptedciphertext_unwrap: function(arg0) {
|
|
1713
|
+
const ret = TypedSigncryptedCiphertext.__unwrap(arg0);
|
|
1714
|
+
return ret;
|
|
1715
|
+
},
|
|
1716
|
+
__wbg_userdecryptionresponse_unwrap: function(arg0) {
|
|
1717
|
+
const ret = UserDecryptionResponse.__unwrap(arg0);
|
|
1718
|
+
return ret;
|
|
1719
|
+
},
|
|
1720
|
+
__wbg_value_0546255b415e96c1: function(arg0) {
|
|
1721
|
+
const ret = arg0.value;
|
|
1722
|
+
return ret;
|
|
1723
|
+
},
|
|
1724
|
+
__wbg_versions_c71aa1626a93e0a1: function(arg0) {
|
|
1725
|
+
const ret = arg0.versions;
|
|
1726
|
+
return ret;
|
|
1727
|
+
},
|
|
1728
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1729
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
1730
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
1731
|
+
return ret;
|
|
1732
|
+
},
|
|
1733
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1734
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1735
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1736
|
+
return ret;
|
|
1737
|
+
},
|
|
1738
|
+
__wbindgen_init_externref_table: function() {
|
|
1739
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1740
|
+
const offset = table.grow(4);
|
|
1741
|
+
table.set(0, undefined);
|
|
1742
|
+
table.set(offset + 0, undefined);
|
|
1743
|
+
table.set(offset + 1, null);
|
|
1744
|
+
table.set(offset + 2, true);
|
|
1745
|
+
table.set(offset + 3, false);
|
|
1746
|
+
},
|
|
1747
|
+
};
|
|
1748
|
+
return {
|
|
1749
|
+
__proto__: null,
|
|
1750
|
+
"./kms_lib_bg.js": import0,
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
const CiphertextHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1755
|
+
? { register: () => {}, unregister: () => {} }
|
|
1756
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ciphertexthandle_free(ptr >>> 0, 1));
|
|
1757
|
+
const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1758
|
+
? { register: () => {}, unregister: () => {} }
|
|
1759
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
|
|
1760
|
+
const Eip712DomainMsgFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1761
|
+
? { register: () => {}, unregister: () => {} }
|
|
1762
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_eip712domainmsg_free(ptr >>> 0, 1));
|
|
1763
|
+
const ParsedUserDecryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1764
|
+
? { register: () => {}, unregister: () => {} }
|
|
1765
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_parseduserdecryptionrequest_free(ptr >>> 0, 1));
|
|
1766
|
+
const PrivateEncKeyMlKem512Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
1767
|
+
? { register: () => {}, unregister: () => {} }
|
|
1768
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_privateenckeymlkem512_free(ptr >>> 0, 1));
|
|
1769
|
+
const PrivateSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1770
|
+
? { register: () => {}, unregister: () => {} }
|
|
1771
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_privatesigkey_free(ptr >>> 0, 1));
|
|
1772
|
+
const PublicEncKeyMlKem512Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
1773
|
+
? { register: () => {}, unregister: () => {} }
|
|
1774
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_publicenckeymlkem512_free(ptr >>> 0, 1));
|
|
1775
|
+
const PublicSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1776
|
+
? { register: () => {}, unregister: () => {} }
|
|
1777
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_publicsigkey_free(ptr >>> 0, 1));
|
|
1778
|
+
const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1779
|
+
? { register: () => {}, unregister: () => {} }
|
|
1780
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
|
|
1781
|
+
const ServerIdAddrFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1782
|
+
? { register: () => {}, unregister: () => {} }
|
|
1783
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_serveridaddr_free(ptr >>> 0, 1));
|
|
1784
|
+
const TypedCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1785
|
+
? { register: () => {}, unregister: () => {} }
|
|
1786
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_typedciphertext_free(ptr >>> 0, 1));
|
|
1787
|
+
const TypedPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1788
|
+
? { register: () => {}, unregister: () => {} }
|
|
1789
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_typedplaintext_free(ptr >>> 0, 1));
|
|
1790
|
+
const TypedSigncryptedCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1791
|
+
? { register: () => {}, unregister: () => {} }
|
|
1792
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_typedsigncryptedciphertext_free(ptr >>> 0, 1));
|
|
1793
|
+
const UserDecryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1794
|
+
? { register: () => {}, unregister: () => {} }
|
|
1795
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionrequest_free(ptr >>> 0, 1));
|
|
1796
|
+
const UserDecryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1797
|
+
? { register: () => {}, unregister: () => {} }
|
|
1798
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionresponse_free(ptr >>> 0, 1));
|
|
1799
|
+
const UserDecryptionResponsePayloadFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1800
|
+
? { register: () => {}, unregister: () => {} }
|
|
1801
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionresponsepayload_free(ptr >>> 0, 1));
|
|
1802
|
+
|
|
1803
|
+
function addToExternrefTable0(obj) {
|
|
1804
|
+
const idx = wasm.__externref_table_alloc();
|
|
1805
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1806
|
+
return idx;
|
|
1807
|
+
}
|
|
1525
1808
|
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
UserDecryptionResponseFinalization.unregister(this);
|
|
1530
|
-
return ptr;
|
|
1809
|
+
function _assertClass(instance, klass) {
|
|
1810
|
+
if (!(instance instanceof klass)) {
|
|
1811
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1531
1812
|
}
|
|
1813
|
+
}
|
|
1532
1814
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1815
|
+
function debugString(val) {
|
|
1816
|
+
// primitive types
|
|
1817
|
+
const type = typeof val;
|
|
1818
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1819
|
+
return `${val}`;
|
|
1536
1820
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
*/
|
|
1540
|
-
get signature() {
|
|
1541
|
-
const ret = wasm.__wbg_get_userdecryptionresponse_signature(this.__wbg_ptr);
|
|
1542
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1543
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1544
|
-
return v1;
|
|
1821
|
+
if (type == 'string') {
|
|
1822
|
+
return `"${val}"`;
|
|
1545
1823
|
}
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1824
|
+
if (type == 'symbol') {
|
|
1825
|
+
const description = val.description;
|
|
1826
|
+
if (description == null) {
|
|
1827
|
+
return 'Symbol';
|
|
1828
|
+
} else {
|
|
1829
|
+
return `Symbol(${description})`;
|
|
1830
|
+
}
|
|
1553
1831
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
* bytes extraData;
|
|
1562
|
-
* }
|
|
1563
|
-
* @returns {Uint8Array}
|
|
1564
|
-
*/
|
|
1565
|
-
get external_signature() {
|
|
1566
|
-
const ret = wasm.__wbg_get_userdecryptionresponse_external_signature(this.__wbg_ptr);
|
|
1567
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1568
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1569
|
-
return v1;
|
|
1832
|
+
if (type == 'function') {
|
|
1833
|
+
const name = val.name;
|
|
1834
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1835
|
+
return `Function(${name})`;
|
|
1836
|
+
} else {
|
|
1837
|
+
return 'Function';
|
|
1838
|
+
}
|
|
1570
1839
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1584
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1585
|
-
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1840
|
+
// objects
|
|
1841
|
+
if (Array.isArray(val)) {
|
|
1842
|
+
const length = val.length;
|
|
1843
|
+
let debug = '[';
|
|
1844
|
+
if (length > 0) {
|
|
1845
|
+
debug += debugString(val[0]);
|
|
1846
|
+
}
|
|
1847
|
+
for(let i = 1; i < length; i++) {
|
|
1848
|
+
debug += ', ' + debugString(val[i]);
|
|
1849
|
+
}
|
|
1850
|
+
debug += ']';
|
|
1851
|
+
return debug;
|
|
1586
1852
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1853
|
+
// Test for built-in
|
|
1854
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1855
|
+
let className;
|
|
1856
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1857
|
+
className = builtInMatches[1];
|
|
1858
|
+
} else {
|
|
1859
|
+
// Failed to match the standard '[object ClassName]'
|
|
1860
|
+
return toString.call(val);
|
|
1594
1861
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
ptr0 = arg0.__destroy_into_raw();
|
|
1862
|
+
if (className == 'Object') {
|
|
1863
|
+
// we're a user defined class or Object
|
|
1864
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1865
|
+
// easier than looping through ownProperties of `val`.
|
|
1866
|
+
try {
|
|
1867
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1868
|
+
} catch (_) {
|
|
1869
|
+
return 'Object';
|
|
1604
1870
|
}
|
|
1605
|
-
wasm.__wbg_set_userdecryptionresponse_payload(this.__wbg_ptr, ptr0);
|
|
1606
|
-
}
|
|
1607
|
-
/**
|
|
1608
|
-
* Extra data used in the EIP712 signature - external_signature.
|
|
1609
|
-
* @returns {Uint8Array}
|
|
1610
|
-
*/
|
|
1611
|
-
get extra_data() {
|
|
1612
|
-
const ret = wasm.__wbg_get_userdecryptionresponse_extra_data(this.__wbg_ptr);
|
|
1613
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1614
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1615
|
-
return v1;
|
|
1616
1871
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
*/
|
|
1621
|
-
set extra_data(arg0) {
|
|
1622
|
-
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1623
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1624
|
-
wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
|
|
1872
|
+
// errors
|
|
1873
|
+
if (val instanceof Error) {
|
|
1874
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1625
1875
|
}
|
|
1876
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1877
|
+
return className;
|
|
1626
1878
|
}
|
|
1627
1879
|
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1880
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
1881
|
+
ptr = ptr >>> 0;
|
|
1882
|
+
const mem = getDataViewMemory0();
|
|
1883
|
+
const result = [];
|
|
1884
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1885
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
1886
|
+
}
|
|
1887
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
1888
|
+
return result;
|
|
1889
|
+
}
|
|
1631
1890
|
|
|
1632
|
-
|
|
1891
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1892
|
+
ptr = ptr >>> 0;
|
|
1893
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1894
|
+
}
|
|
1633
1895
|
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
UserDecryptionResponsePayloadFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1639
|
-
return obj;
|
|
1896
|
+
let cachedDataViewMemory0 = null;
|
|
1897
|
+
function getDataViewMemory0() {
|
|
1898
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1899
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1640
1900
|
}
|
|
1901
|
+
return cachedDataViewMemory0;
|
|
1902
|
+
}
|
|
1641
1903
|
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
return ptr;
|
|
1647
|
-
}
|
|
1904
|
+
function getStringFromWasm0(ptr, len) {
|
|
1905
|
+
ptr = ptr >>> 0;
|
|
1906
|
+
return decodeText(ptr, len);
|
|
1907
|
+
}
|
|
1648
1908
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
/**
|
|
1654
|
-
* The server's signature verification key, Encoded using SEC1.
|
|
1655
|
-
* Needed to validate the response, but MUST also be linked to a list of
|
|
1656
|
-
* trusted keys.
|
|
1657
|
-
* @returns {Uint8Array}
|
|
1658
|
-
*/
|
|
1659
|
-
get verification_key() {
|
|
1660
|
-
const ret = wasm.__wbg_get_userdecryptionresponsepayload_verification_key(this.__wbg_ptr);
|
|
1661
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1662
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1663
|
-
return v1;
|
|
1664
|
-
}
|
|
1665
|
-
/**
|
|
1666
|
-
* The server's signature verification key, Encoded using SEC1.
|
|
1667
|
-
* Needed to validate the response, but MUST also be linked to a list of
|
|
1668
|
-
* trusted keys.
|
|
1669
|
-
* @param {Uint8Array} arg0
|
|
1670
|
-
*/
|
|
1671
|
-
set verification_key(arg0) {
|
|
1672
|
-
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1673
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1674
|
-
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
1675
|
-
}
|
|
1676
|
-
/**
|
|
1677
|
-
* This is needed to ensure the response corresponds to the request.
|
|
1678
|
-
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
1679
|
-
* under the given domain in the request.
|
|
1680
|
-
* @returns {Uint8Array}
|
|
1681
|
-
*/
|
|
1682
|
-
get digest() {
|
|
1683
|
-
const ret = wasm.__wbg_get_userdecryptionresponsepayload_digest(this.__wbg_ptr);
|
|
1684
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1685
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1686
|
-
return v1;
|
|
1687
|
-
}
|
|
1688
|
-
/**
|
|
1689
|
-
* This is needed to ensure the response corresponds to the request.
|
|
1690
|
-
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
1691
|
-
* under the given domain in the request.
|
|
1692
|
-
* @param {Uint8Array} arg0
|
|
1693
|
-
*/
|
|
1694
|
-
set digest(arg0) {
|
|
1695
|
-
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1696
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1697
|
-
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1909
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1910
|
+
function getUint8ArrayMemory0() {
|
|
1911
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1912
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1698
1913
|
}
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1709
|
-
return v1;
|
|
1914
|
+
return cachedUint8ArrayMemory0;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
function handleError(f, args) {
|
|
1918
|
+
try {
|
|
1919
|
+
return f.apply(this, args);
|
|
1920
|
+
} catch (e) {
|
|
1921
|
+
const idx = addToExternrefTable0(e);
|
|
1922
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1710
1923
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
function isLikeNone(x) {
|
|
1927
|
+
return x === undefined || x === null;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1931
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1932
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1933
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1934
|
+
return ptr;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
1938
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
1939
|
+
for (let i = 0; i < array.length; i++) {
|
|
1940
|
+
const add = addToExternrefTable0(array[i]);
|
|
1941
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
1721
1942
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1943
|
+
WASM_VECTOR_LEN = array.length;
|
|
1944
|
+
return ptr;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1948
|
+
if (realloc === undefined) {
|
|
1949
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1950
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1951
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1952
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1953
|
+
return ptr;
|
|
1730
1954
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1955
|
+
|
|
1956
|
+
let len = arg.length;
|
|
1957
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1958
|
+
|
|
1959
|
+
const mem = getUint8ArrayMemory0();
|
|
1960
|
+
|
|
1961
|
+
let offset = 0;
|
|
1962
|
+
|
|
1963
|
+
for (; offset < len; offset++) {
|
|
1964
|
+
const code = arg.charCodeAt(offset);
|
|
1965
|
+
if (code > 0x7F) break;
|
|
1966
|
+
mem[ptr + offset] = code;
|
|
1738
1967
|
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1968
|
+
if (offset !== len) {
|
|
1969
|
+
if (offset !== 0) {
|
|
1970
|
+
arg = arg.slice(offset);
|
|
1971
|
+
}
|
|
1972
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1973
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1974
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1975
|
+
|
|
1976
|
+
offset += ret.written;
|
|
1977
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1746
1978
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1979
|
+
|
|
1980
|
+
WASM_VECTOR_LEN = offset;
|
|
1981
|
+
return ptr;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
function takeFromExternrefTable0(idx) {
|
|
1985
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1986
|
+
wasm.__externref_table_dealloc(idx);
|
|
1987
|
+
return value;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1991
|
+
cachedTextDecoder.decode();
|
|
1992
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1993
|
+
let numBytesDecoded = 0;
|
|
1994
|
+
function decodeText(ptr, len) {
|
|
1995
|
+
numBytesDecoded += len;
|
|
1996
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1997
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1998
|
+
cachedTextDecoder.decode();
|
|
1999
|
+
numBytesDecoded = len;
|
|
1753
2000
|
}
|
|
2001
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
const cachedTextEncoder = new TextEncoder();
|
|
2005
|
+
|
|
2006
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
2007
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
2008
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
2009
|
+
view.set(buf);
|
|
2010
|
+
return {
|
|
2011
|
+
read: arg.length,
|
|
2012
|
+
written: buf.length
|
|
2013
|
+
};
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
let WASM_VECTOR_LEN = 0;
|
|
2018
|
+
|
|
2019
|
+
let wasmModule, wasm;
|
|
2020
|
+
function __wbg_finalize_init(instance, module) {
|
|
2021
|
+
wasm = instance.exports;
|
|
2022
|
+
wasmModule = module;
|
|
2023
|
+
cachedDataViewMemory0 = null;
|
|
2024
|
+
cachedUint8ArrayMemory0 = null;
|
|
2025
|
+
wasm.__wbindgen_start();
|
|
2026
|
+
return wasm;
|
|
1754
2027
|
}
|
|
1755
2028
|
|
|
1756
2029
|
async function __wbg_load(module, imports) {
|
|
@@ -1758,353 +2031,41 @@ async function __wbg_load(module, imports) {
|
|
|
1758
2031
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1759
2032
|
try {
|
|
1760
2033
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1761
|
-
|
|
1762
2034
|
} catch (e) {
|
|
1763
|
-
|
|
2035
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
2036
|
+
|
|
2037
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1764
2038
|
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);
|
|
1765
2039
|
|
|
1766
|
-
} else {
|
|
1767
|
-
throw e;
|
|
1768
|
-
}
|
|
2040
|
+
} else { throw e; }
|
|
1769
2041
|
}
|
|
1770
2042
|
}
|
|
1771
2043
|
|
|
1772
2044
|
const bytes = await module.arrayBuffer();
|
|
1773
2045
|
return await WebAssembly.instantiate(bytes, imports);
|
|
1774
|
-
|
|
1775
2046
|
} else {
|
|
1776
2047
|
const instance = await WebAssembly.instantiate(module, imports);
|
|
1777
2048
|
|
|
1778
2049
|
if (instance instanceof WebAssembly.Instance) {
|
|
1779
2050
|
return { instance, module };
|
|
1780
|
-
|
|
1781
2051
|
} else {
|
|
1782
2052
|
return instance;
|
|
1783
2053
|
}
|
|
1784
2054
|
}
|
|
1785
|
-
}
|
|
1786
2055
|
|
|
1787
|
-
function
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
1791
|
-
const ret = String(arg1);
|
|
1792
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1793
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1794
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1795
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1796
|
-
};
|
|
1797
|
-
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
1798
|
-
const ret = arg0.buffer;
|
|
1799
|
-
return ret;
|
|
1800
|
-
};
|
|
1801
|
-
imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
1802
|
-
const ret = arg0.call(arg1);
|
|
1803
|
-
return ret;
|
|
1804
|
-
}, arguments) };
|
|
1805
|
-
imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1806
|
-
const ret = arg0.call(arg1, arg2);
|
|
1807
|
-
return ret;
|
|
1808
|
-
}, arguments) };
|
|
1809
|
-
imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
|
|
1810
|
-
const ret = arg0.crypto;
|
|
1811
|
-
return ret;
|
|
1812
|
-
};
|
|
1813
|
-
imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
|
|
1814
|
-
const ret = arg0.done;
|
|
1815
|
-
return ret;
|
|
1816
|
-
};
|
|
1817
|
-
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
1818
|
-
let deferred0_0;
|
|
1819
|
-
let deferred0_1;
|
|
1820
|
-
try {
|
|
1821
|
-
deferred0_0 = arg0;
|
|
1822
|
-
deferred0_1 = arg1;
|
|
1823
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
1824
|
-
} finally {
|
|
1825
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1826
|
-
}
|
|
1827
|
-
};
|
|
1828
|
-
imports.wbg.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) {
|
|
1829
|
-
arg0.getRandomValues(arg1);
|
|
1830
|
-
}, arguments) };
|
|
1831
|
-
imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
|
|
1832
|
-
const ret = Reflect.get(arg0, arg1);
|
|
1833
|
-
return ret;
|
|
1834
|
-
}, arguments) };
|
|
1835
|
-
imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
|
|
1836
|
-
const ret = arg0[arg1 >>> 0];
|
|
1837
|
-
return ret;
|
|
1838
|
-
};
|
|
1839
|
-
imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
|
|
1840
|
-
const ret = arg0[arg1];
|
|
1841
|
-
return ret;
|
|
1842
|
-
};
|
|
1843
|
-
imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
|
|
1844
|
-
let result;
|
|
1845
|
-
try {
|
|
1846
|
-
result = arg0 instanceof ArrayBuffer;
|
|
1847
|
-
} catch (_) {
|
|
1848
|
-
result = false;
|
|
1849
|
-
}
|
|
1850
|
-
const ret = result;
|
|
1851
|
-
return ret;
|
|
1852
|
-
};
|
|
1853
|
-
imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
|
|
1854
|
-
let result;
|
|
1855
|
-
try {
|
|
1856
|
-
result = arg0 instanceof Uint8Array;
|
|
1857
|
-
} catch (_) {
|
|
1858
|
-
result = false;
|
|
2056
|
+
function expectedResponseType(type) {
|
|
2057
|
+
switch (type) {
|
|
2058
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1859
2059
|
}
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
};
|
|
1863
|
-
imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
|
|
1864
|
-
const ret = Array.isArray(arg0);
|
|
1865
|
-
return ret;
|
|
1866
|
-
};
|
|
1867
|
-
imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
|
|
1868
|
-
const ret = Number.isSafeInteger(arg0);
|
|
1869
|
-
return ret;
|
|
1870
|
-
};
|
|
1871
|
-
imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
|
|
1872
|
-
const ret = Symbol.iterator;
|
|
1873
|
-
return ret;
|
|
1874
|
-
};
|
|
1875
|
-
imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
|
|
1876
|
-
const ret = arg0.length;
|
|
1877
|
-
return ret;
|
|
1878
|
-
};
|
|
1879
|
-
imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
|
|
1880
|
-
const ret = arg0.length;
|
|
1881
|
-
return ret;
|
|
1882
|
-
};
|
|
1883
|
-
imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
1884
|
-
const ret = arg0.msCrypto;
|
|
1885
|
-
return ret;
|
|
1886
|
-
};
|
|
1887
|
-
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
1888
|
-
const ret = new Error();
|
|
1889
|
-
return ret;
|
|
1890
|
-
};
|
|
1891
|
-
imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
|
|
1892
|
-
const ret = new Uint8Array(arg0);
|
|
1893
|
-
return ret;
|
|
1894
|
-
};
|
|
1895
|
-
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
1896
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1897
|
-
return ret;
|
|
1898
|
-
};
|
|
1899
|
-
imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
|
|
1900
|
-
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
1901
|
-
return ret;
|
|
1902
|
-
};
|
|
1903
|
-
imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
|
|
1904
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
1905
|
-
return ret;
|
|
1906
|
-
};
|
|
1907
|
-
imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
|
|
1908
|
-
const ret = arg0.next;
|
|
1909
|
-
return ret;
|
|
1910
|
-
};
|
|
1911
|
-
imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
|
|
1912
|
-
const ret = arg0.next();
|
|
1913
|
-
return ret;
|
|
1914
|
-
}, arguments) };
|
|
1915
|
-
imports.wbg.__wbg_node_02999533c4ea02e3 = function(arg0) {
|
|
1916
|
-
const ret = arg0.node;
|
|
1917
|
-
return ret;
|
|
1918
|
-
};
|
|
1919
|
-
imports.wbg.__wbg_process_5c1d670bc53614b8 = function(arg0) {
|
|
1920
|
-
const ret = arg0.process;
|
|
1921
|
-
return ret;
|
|
1922
|
-
};
|
|
1923
|
-
imports.wbg.__wbg_randomFillSync_ab2cfe79ebbf2740 = function() { return handleError(function (arg0, arg1) {
|
|
1924
|
-
arg0.randomFillSync(arg1);
|
|
1925
|
-
}, arguments) };
|
|
1926
|
-
imports.wbg.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () {
|
|
1927
|
-
const ret = module.require;
|
|
1928
|
-
return ret;
|
|
1929
|
-
}, arguments) };
|
|
1930
|
-
imports.wbg.__wbg_serveridaddr_new = function(arg0) {
|
|
1931
|
-
const ret = ServerIdAddr.__wrap(arg0);
|
|
1932
|
-
return ret;
|
|
1933
|
-
};
|
|
1934
|
-
imports.wbg.__wbg_serveridaddr_unwrap = function(arg0) {
|
|
1935
|
-
const ret = ServerIdAddr.__unwrap(arg0);
|
|
1936
|
-
return ret;
|
|
1937
|
-
};
|
|
1938
|
-
imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
|
|
1939
|
-
arg0.set(arg1, arg2 >>> 0);
|
|
1940
|
-
};
|
|
1941
|
-
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
1942
|
-
const ret = arg1.stack;
|
|
1943
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1944
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1945
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1946
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1947
|
-
};
|
|
1948
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
1949
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
1950
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1951
|
-
};
|
|
1952
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
|
|
1953
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1954
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1955
|
-
};
|
|
1956
|
-
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
|
|
1957
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
1958
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1959
|
-
};
|
|
1960
|
-
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
|
|
1961
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
1962
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1963
|
-
};
|
|
1964
|
-
imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
|
|
1965
|
-
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1966
|
-
return ret;
|
|
1967
|
-
};
|
|
1968
|
-
imports.wbg.__wbg_typedciphertext_new = function(arg0) {
|
|
1969
|
-
const ret = TypedCiphertext.__wrap(arg0);
|
|
1970
|
-
return ret;
|
|
1971
|
-
};
|
|
1972
|
-
imports.wbg.__wbg_typedciphertext_unwrap = function(arg0) {
|
|
1973
|
-
const ret = TypedCiphertext.__unwrap(arg0);
|
|
1974
|
-
return ret;
|
|
1975
|
-
};
|
|
1976
|
-
imports.wbg.__wbg_typedplaintext_new = function(arg0) {
|
|
1977
|
-
const ret = TypedPlaintext.__wrap(arg0);
|
|
1978
|
-
return ret;
|
|
1979
|
-
};
|
|
1980
|
-
imports.wbg.__wbg_typedsigncryptedciphertext_new = function(arg0) {
|
|
1981
|
-
const ret = TypedSigncryptedCiphertext.__wrap(arg0);
|
|
1982
|
-
return ret;
|
|
1983
|
-
};
|
|
1984
|
-
imports.wbg.__wbg_typedsigncryptedciphertext_unwrap = function(arg0) {
|
|
1985
|
-
const ret = TypedSigncryptedCiphertext.__unwrap(arg0);
|
|
1986
|
-
return ret;
|
|
1987
|
-
};
|
|
1988
|
-
imports.wbg.__wbg_userdecryptionresponse_unwrap = function(arg0) {
|
|
1989
|
-
const ret = UserDecryptionResponse.__unwrap(arg0);
|
|
1990
|
-
return ret;
|
|
1991
|
-
};
|
|
1992
|
-
imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
|
|
1993
|
-
const ret = arg0.value;
|
|
1994
|
-
return ret;
|
|
1995
|
-
};
|
|
1996
|
-
imports.wbg.__wbg_versions_c71aa1626a93e0a1 = function(arg0) {
|
|
1997
|
-
const ret = arg0.versions;
|
|
1998
|
-
return ret;
|
|
1999
|
-
};
|
|
2000
|
-
imports.wbg.__wbindgen_as_number = function(arg0) {
|
|
2001
|
-
const ret = +arg0;
|
|
2002
|
-
return ret;
|
|
2003
|
-
};
|
|
2004
|
-
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
|
2005
|
-
const v = arg0;
|
|
2006
|
-
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
2007
|
-
return ret;
|
|
2008
|
-
};
|
|
2009
|
-
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
2010
|
-
const ret = debugString(arg1);
|
|
2011
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2012
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2013
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2014
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2015
|
-
};
|
|
2016
|
-
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
2017
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
2018
|
-
return ret;
|
|
2019
|
-
};
|
|
2020
|
-
imports.wbg.__wbindgen_in = function(arg0, arg1) {
|
|
2021
|
-
const ret = arg0 in arg1;
|
|
2022
|
-
return ret;
|
|
2023
|
-
};
|
|
2024
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
2025
|
-
const table = wasm.__wbindgen_export_4;
|
|
2026
|
-
const offset = table.grow(4);
|
|
2027
|
-
table.set(0, undefined);
|
|
2028
|
-
table.set(offset + 0, undefined);
|
|
2029
|
-
table.set(offset + 1, null);
|
|
2030
|
-
table.set(offset + 2, true);
|
|
2031
|
-
table.set(offset + 3, false);
|
|
2032
|
-
;
|
|
2033
|
-
};
|
|
2034
|
-
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
2035
|
-
const ret = typeof(arg0) === 'function';
|
|
2036
|
-
return ret;
|
|
2037
|
-
};
|
|
2038
|
-
imports.wbg.__wbindgen_is_null = function(arg0) {
|
|
2039
|
-
const ret = arg0 === null;
|
|
2040
|
-
return ret;
|
|
2041
|
-
};
|
|
2042
|
-
imports.wbg.__wbindgen_is_object = function(arg0) {
|
|
2043
|
-
const val = arg0;
|
|
2044
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
2045
|
-
return ret;
|
|
2046
|
-
};
|
|
2047
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
2048
|
-
const ret = typeof(arg0) === 'string';
|
|
2049
|
-
return ret;
|
|
2050
|
-
};
|
|
2051
|
-
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
2052
|
-
const ret = arg0 === undefined;
|
|
2053
|
-
return ret;
|
|
2054
|
-
};
|
|
2055
|
-
imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
|
2056
|
-
const ret = arg0 == arg1;
|
|
2057
|
-
return ret;
|
|
2058
|
-
};
|
|
2059
|
-
imports.wbg.__wbindgen_memory = function() {
|
|
2060
|
-
const ret = wasm.memory;
|
|
2061
|
-
return ret;
|
|
2062
|
-
};
|
|
2063
|
-
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
2064
|
-
const obj = arg1;
|
|
2065
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
2066
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
2067
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
2068
|
-
};
|
|
2069
|
-
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
2070
|
-
const obj = arg1;
|
|
2071
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
2072
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2073
|
-
var len1 = WASM_VECTOR_LEN;
|
|
2074
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2075
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2076
|
-
};
|
|
2077
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
2078
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
2079
|
-
return ret;
|
|
2080
|
-
};
|
|
2081
|
-
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
2082
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
2083
|
-
};
|
|
2084
|
-
|
|
2085
|
-
return imports;
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
function __wbg_init_memory(imports, memory) {
|
|
2089
|
-
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
function __wbg_finalize_init(instance, module) {
|
|
2093
|
-
wasm = instance.exports;
|
|
2094
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
2095
|
-
cachedDataViewMemory0 = null;
|
|
2096
|
-
cachedUint8ArrayMemory0 = null;
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
wasm.__wbindgen_start();
|
|
2100
|
-
return wasm;
|
|
2060
|
+
return false;
|
|
2061
|
+
}
|
|
2101
2062
|
}
|
|
2102
2063
|
|
|
2103
2064
|
function initSync(module) {
|
|
2104
2065
|
if (wasm !== undefined) return wasm;
|
|
2105
2066
|
|
|
2106
2067
|
|
|
2107
|
-
if (
|
|
2068
|
+
if (module !== undefined) {
|
|
2108
2069
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
2109
2070
|
({module} = module)
|
|
2110
2071
|
} else {
|
|
@@ -2113,15 +2074,10 @@ function initSync(module) {
|
|
|
2113
2074
|
}
|
|
2114
2075
|
|
|
2115
2076
|
const imports = __wbg_get_imports();
|
|
2116
|
-
|
|
2117
|
-
__wbg_init_memory(imports);
|
|
2118
|
-
|
|
2119
2077
|
if (!(module instanceof WebAssembly.Module)) {
|
|
2120
2078
|
module = new WebAssembly.Module(module);
|
|
2121
2079
|
}
|
|
2122
|
-
|
|
2123
2080
|
const instance = new WebAssembly.Instance(module, imports);
|
|
2124
|
-
|
|
2125
2081
|
return __wbg_finalize_init(instance, module);
|
|
2126
2082
|
}
|
|
2127
2083
|
|
|
@@ -2129,7 +2085,7 @@ async function __wbg_init(module_or_path) {
|
|
|
2129
2085
|
if (wasm !== undefined) return wasm;
|
|
2130
2086
|
|
|
2131
2087
|
|
|
2132
|
-
if (
|
|
2088
|
+
if (module_or_path !== undefined) {
|
|
2133
2089
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2134
2090
|
({module_or_path} = module_or_path)
|
|
2135
2091
|
} else {
|
|
@@ -2137,7 +2093,7 @@ async function __wbg_init(module_or_path) {
|
|
|
2137
2093
|
}
|
|
2138
2094
|
}
|
|
2139
2095
|
|
|
2140
|
-
if (
|
|
2096
|
+
if (module_or_path === undefined) {
|
|
2141
2097
|
module_or_path = new URL('kms_lib_bg.wasm', import.meta.url);
|
|
2142
2098
|
}
|
|
2143
2099
|
const imports = __wbg_get_imports();
|
|
@@ -2146,12 +2102,9 @@ async function __wbg_init(module_or_path) {
|
|
|
2146
2102
|
module_or_path = fetch(module_or_path);
|
|
2147
2103
|
}
|
|
2148
2104
|
|
|
2149
|
-
__wbg_init_memory(imports);
|
|
2150
|
-
|
|
2151
2105
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
2152
2106
|
|
|
2153
2107
|
return __wbg_finalize_init(instance, module);
|
|
2154
2108
|
}
|
|
2155
2109
|
|
|
2156
|
-
export { initSync };
|
|
2157
|
-
export default __wbg_init;
|
|
2110
|
+
export { initSync, __wbg_init as default };
|