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