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