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