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