node-tkms 0.10.0-rc1 → 0.11.0-23
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 +214 -223
- package/kms_lib.js +946 -695
- package/kms_lib_bg.wasm +0 -0
- package/package.json +1 -1
- package/LICENSE +0 -28
package/kms_lib.d.ts
CHANGED
|
@@ -1,117 +1,67 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @returns {Uint8Array}
|
|
6
|
-
*/
|
|
3
|
+
export function ml_kem_pke_pk_len(): number;
|
|
4
|
+
export function ml_kem_pke_sk_len(): number;
|
|
7
5
|
export function public_sig_key_to_u8vec(pk: PublicSigKey): Uint8Array;
|
|
8
|
-
/**
|
|
9
|
-
* @param {Uint8Array} v
|
|
10
|
-
* @returns {PublicSigKey}
|
|
11
|
-
*/
|
|
12
6
|
export function u8vec_to_public_sig_key(v: Uint8Array): PublicSigKey;
|
|
13
|
-
/**
|
|
14
|
-
* @param {PrivateSigKey} sk
|
|
15
|
-
* @returns {Uint8Array}
|
|
16
|
-
*/
|
|
17
7
|
export function private_sig_key_to_u8vec(sk: PrivateSigKey): Uint8Array;
|
|
8
|
+
export function u8vec_to_private_sig_key(v: Uint8Array): PrivateSigKey;
|
|
18
9
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
10
|
+
* Create a new [ServerIdAddr] structure that holds an ID and an address
|
|
11
|
+
* which must be a valid EIP-55 address, notably prefixed with "0x".
|
|
21
12
|
*/
|
|
22
|
-
export function
|
|
13
|
+
export function new_server_id_addr(id: number, addr: string): ServerIdAddr;
|
|
23
14
|
/**
|
|
24
15
|
* Instantiate a new client.
|
|
25
16
|
*
|
|
26
|
-
* * `server_addrs` - a list of KMS server EIP-55 addresses,
|
|
27
|
-
*
|
|
17
|
+
* * `server_addrs` - a list of KMS server ID with EIP-55 addresses,
|
|
18
|
+
* the elements in the list can be created using [new_server_id_addr].
|
|
28
19
|
*
|
|
29
20
|
* * `client_address_hex` - the client (wallet) address in hex,
|
|
30
21
|
* must be prefixed with "0x".
|
|
31
22
|
*
|
|
32
|
-
* * `
|
|
23
|
+
* * `fhe_parameter` - the parameter choice, which can be either `"test"` or `"default"`.
|
|
33
24
|
* The "default" parameter choice is selected if no matching string is found.
|
|
34
|
-
* @param {(string)[]} server_addrs
|
|
35
|
-
* @param {string} client_address_hex
|
|
36
|
-
* @param {string} param_choice
|
|
37
|
-
* @returns {Client}
|
|
38
|
-
*/
|
|
39
|
-
export function new_client(server_addrs: (string)[], client_address_hex: string, param_choice: string): Client;
|
|
40
|
-
/**
|
|
41
|
-
* @param {Client} client
|
|
42
|
-
* @returns {(string)[]}
|
|
43
|
-
*/
|
|
44
|
-
export function get_server_addrs(client: Client): (string)[];
|
|
45
|
-
/**
|
|
46
|
-
* @param {Client} client
|
|
47
|
-
* @returns {PrivateSigKey | undefined}
|
|
48
25
|
*/
|
|
26
|
+
export function new_client(server_addrs: ServerIdAddr[], client_address_hex: string, fhe_parameter: string): Client;
|
|
27
|
+
export function get_server_addrs(client: Client): ServerIdAddr[];
|
|
49
28
|
export function get_client_secret_key(client: Client): PrivateSigKey | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* @param {Client} client
|
|
52
|
-
* @returns {string}
|
|
53
|
-
*/
|
|
54
29
|
export function get_client_address(client: Client): string;
|
|
30
|
+
export function ml_kem_pke_keygen(): PrivateEncKeyMlKem512;
|
|
31
|
+
export function ml_kem_pke_get_pk(sk: PrivateEncKeyMlKem512): PublicEncKeyMlKem512;
|
|
32
|
+
export function ml_kem_pke_pk_to_u8vec(pk: PublicEncKeyMlKem512): Uint8Array;
|
|
33
|
+
export function ml_kem_pke_sk_to_u8vec(sk: PrivateEncKeyMlKem512): Uint8Array;
|
|
34
|
+
export function u8vec_to_ml_kem_pke_pk(v: Uint8Array): PublicEncKeyMlKem512;
|
|
35
|
+
export function u8vec_to_ml_kem_pke_sk(v: Uint8Array): PrivateEncKeyMlKem512;
|
|
55
36
|
/**
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
export function cryptobox_keygen(): PrivateEncKey;
|
|
59
|
-
/**
|
|
60
|
-
* @param {PrivateEncKey} sk
|
|
61
|
-
* @returns {PublicEncKey}
|
|
62
|
-
*/
|
|
63
|
-
export function cryptobox_get_pk(sk: PrivateEncKey): PublicEncKey;
|
|
64
|
-
/**
|
|
65
|
-
* @param {PublicEncKey} pk
|
|
66
|
-
* @returns {Uint8Array}
|
|
67
|
-
*/
|
|
68
|
-
export function cryptobox_pk_to_u8vec(pk: PublicEncKey): Uint8Array;
|
|
69
|
-
/**
|
|
70
|
-
* @param {PrivateEncKey} sk
|
|
71
|
-
* @returns {Uint8Array}
|
|
72
|
-
*/
|
|
73
|
-
export function cryptobox_sk_to_u8vec(sk: PrivateEncKey): Uint8Array;
|
|
74
|
-
/**
|
|
75
|
-
* @param {Uint8Array} v
|
|
76
|
-
* @returns {PublicEncKey}
|
|
77
|
-
*/
|
|
78
|
-
export function u8vec_to_cryptobox_pk(v: Uint8Array): PublicEncKey;
|
|
79
|
-
/**
|
|
80
|
-
* @param {Uint8Array} v
|
|
81
|
-
* @returns {PrivateEncKey}
|
|
37
|
+
* This function is *not* used by relayer-sdk because the encryption
|
|
38
|
+
* happens on the KMS side. It's just here for completeness and tests.
|
|
82
39
|
*/
|
|
83
|
-
export function
|
|
40
|
+
export function ml_kem_pke_encrypt(msg: Uint8Array, their_pk: PublicEncKeyMlKem512): Uint8Array;
|
|
84
41
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @returns {CryptoBoxCt}
|
|
42
|
+
* This function is *not* used by relayer-sdk because the decryption
|
|
43
|
+
* is handled by [process_user_decryption_resp].
|
|
44
|
+
* It's just here for completeness and tests.
|
|
89
45
|
*/
|
|
90
|
-
export function
|
|
46
|
+
export function ml_kem_pke_decrypt(ct: Uint8Array, my_sk: PrivateEncKeyMlKem512): Uint8Array;
|
|
91
47
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @param {PrivateEncKey} my_sk
|
|
94
|
-
* @param {PublicEncKey} their_pk
|
|
95
|
-
* @returns {Uint8Array}
|
|
96
|
-
*/
|
|
97
|
-
export function cryptobox_decrypt(ct: CryptoBoxCt, my_sk: PrivateEncKey, their_pk: PublicEncKey): Uint8Array;
|
|
98
|
-
/**
|
|
99
|
-
* Process the reencryption response from JavaScript objects.
|
|
48
|
+
* Process the user_decryption response from JavaScript objects.
|
|
100
49
|
* The returned result is a byte array representing a plaintext of any length,
|
|
101
50
|
* postprocessing is returned to turn it into an integer.
|
|
102
51
|
*
|
|
103
|
-
* * `client` - client that wants to perform
|
|
52
|
+
* * `client` - client that wants to perform user_decryption.
|
|
104
53
|
*
|
|
105
|
-
* * `request` - the initial
|
|
54
|
+
* * `request` - the initial user_decryption request JS object.
|
|
106
55
|
* It can be set to null if `verify` is false.
|
|
107
56
|
* Otherwise the caller needs to give the following JS object.
|
|
108
57
|
* Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
|
|
58
|
+
* The signature field is not needed.
|
|
109
59
|
* ```
|
|
110
60
|
* {
|
|
111
|
-
* signature:
|
|
61
|
+
* signature: undefined,
|
|
112
62
|
* client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
|
|
113
63
|
* enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
|
|
114
|
-
*
|
|
64
|
+
* ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
|
|
115
65
|
* eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
|
|
116
66
|
* }
|
|
117
67
|
* ```
|
|
@@ -153,31 +103,23 @@ export function cryptobox_decrypt(ct: CryptoBoxCt, my_sk: PrivateEncKey, their_p
|
|
|
153
103
|
*
|
|
154
104
|
* * `verify` - Whether to perform signature verification for the response.
|
|
155
105
|
* It is insecure if `verify = false`!
|
|
156
|
-
* @param {Client} client
|
|
157
|
-
* @param {any} request
|
|
158
|
-
* @param {any} eip712_domain
|
|
159
|
-
* @param {any} agg_resp
|
|
160
|
-
* @param {PublicEncKey} enc_pk
|
|
161
|
-
* @param {PrivateEncKey} enc_sk
|
|
162
|
-
* @param {boolean} verify
|
|
163
|
-
* @returns {Uint8Array}
|
|
164
106
|
*/
|
|
165
|
-
export function
|
|
107
|
+
export function process_user_decryption_resp_from_js(client: Client, request: any, eip712_domain: any, agg_resp: any, enc_pk: PublicEncKeyMlKem512, enc_sk: PrivateEncKeyMlKem512, verify: boolean): TypedPlaintext[];
|
|
166
108
|
/**
|
|
167
|
-
* Process the
|
|
168
|
-
* Consider using [
|
|
109
|
+
* Process the user_decryption response from Rust objects.
|
|
110
|
+
* Consider using [process_user_decryption_resp_from_js]
|
|
169
111
|
* when using the JS API.
|
|
170
112
|
* The result is a byte array representing a plaintext of any length.
|
|
171
113
|
*
|
|
172
|
-
* * `client` - client that wants to perform
|
|
114
|
+
* * `client` - client that wants to perform user_decryption.
|
|
173
115
|
*
|
|
174
|
-
* * `request` - the initial
|
|
116
|
+
* * `request` - the initial user_decryption request.
|
|
175
117
|
* Must be given if `verify` is true.
|
|
176
118
|
*
|
|
177
119
|
* * `eip712_domain` - the EIP-712 domain.
|
|
178
120
|
* Must be given if `verify` is true.
|
|
179
121
|
*
|
|
180
|
-
* * `agg_resp` - the vector of
|
|
122
|
+
* * `agg_resp` - the vector of user_decryption responses.
|
|
181
123
|
*
|
|
182
124
|
* * `enc_pk` - The ephemeral public key.
|
|
183
125
|
*
|
|
@@ -185,32 +127,11 @@ export function process_reencryption_resp_from_js(client: Client, request: any,
|
|
|
185
127
|
*
|
|
186
128
|
* * `verify` - Whether to perform signature verification for the response.
|
|
187
129
|
* It is insecure if `verify = false`!
|
|
188
|
-
* @param {Client} client
|
|
189
|
-
* @param {ParsedReencryptionRequest | undefined} request
|
|
190
|
-
* @param {Eip712DomainMsg | undefined} eip712_domain
|
|
191
|
-
* @param {(ReencryptionResponse)[]} agg_resp
|
|
192
|
-
* @param {PublicEncKey} enc_pk
|
|
193
|
-
* @param {PrivateEncKey} enc_sk
|
|
194
|
-
* @param {boolean} verify
|
|
195
|
-
* @returns {Uint8Array}
|
|
196
|
-
*/
|
|
197
|
-
export function process_reencryption_resp(client: Client, request: ParsedReencryptionRequest | undefined, eip712_domain: Eip712DomainMsg | undefined, agg_resp: (ReencryptionResponse)[], enc_pk: PublicEncKey, enc_sk: PrivateEncKey, verify: boolean): Uint8Array;
|
|
198
|
-
/**
|
|
199
|
-
* The plaintext types that can be encrypted in a fhevm ciphertext.
|
|
200
130
|
*/
|
|
201
|
-
export
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
Euint16 = 3,
|
|
206
|
-
Euint32 = 4,
|
|
207
|
-
Euint64 = 5,
|
|
208
|
-
Euint128 = 6,
|
|
209
|
-
Euint160 = 7,
|
|
210
|
-
Euint256 = 8,
|
|
211
|
-
Euint512 = 9,
|
|
212
|
-
Euint1024 = 10,
|
|
213
|
-
Euint2048 = 11,
|
|
131
|
+
export function process_user_decryption_resp(client: Client, request: ParsedUserDecryptionRequest | null | undefined, eip712_domain: Eip712DomainMsg | null | undefined, agg_resp: UserDecryptionResponse[], enc_pk: PublicEncKeyMlKem512, enc_sk: PrivateEncKeyMlKem512, verify: boolean): TypedPlaintext[];
|
|
132
|
+
export class CiphertextHandle {
|
|
133
|
+
private constructor();
|
|
134
|
+
free(): void;
|
|
214
135
|
}
|
|
215
136
|
/**
|
|
216
137
|
* Core Client
|
|
@@ -220,145 +141,215 @@ export enum FheType {
|
|
|
220
141
|
* distributed across the aggregator/proxy and smart contracts.
|
|
221
142
|
*/
|
|
222
143
|
export class Client {
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
export class CryptoBoxCt {
|
|
144
|
+
private constructor();
|
|
226
145
|
free(): void;
|
|
227
146
|
}
|
|
228
147
|
/**
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
148
|
+
* Eip712 domain information.
|
|
149
|
+
* Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) _must_ be fulfilled.
|
|
150
|
+
* Furthermore, be aware that all parameters will eventually be parsed into Solidity types.
|
|
232
151
|
*/
|
|
233
152
|
export class Eip712DomainMsg {
|
|
153
|
+
private constructor();
|
|
234
154
|
free(): void;
|
|
235
|
-
chain_id: Uint8Array;
|
|
236
155
|
name: string;
|
|
237
|
-
salt?: Uint8Array;
|
|
238
|
-
verifying_contract: string;
|
|
239
156
|
version: string;
|
|
157
|
+
chain_id: Uint8Array;
|
|
158
|
+
verifying_contract: string;
|
|
159
|
+
get salt(): Uint8Array | undefined;
|
|
160
|
+
set salt(value: Uint8Array | null | undefined);
|
|
240
161
|
}
|
|
241
162
|
/**
|
|
242
163
|
* Validity of this struct is not checked.
|
|
243
164
|
*/
|
|
244
|
-
export class
|
|
165
|
+
export class ParsedUserDecryptionRequest {
|
|
166
|
+
private constructor();
|
|
245
167
|
free(): void;
|
|
246
168
|
}
|
|
247
|
-
export class
|
|
169
|
+
export class PrivateEncKeyMlKem512 {
|
|
170
|
+
private constructor();
|
|
248
171
|
free(): void;
|
|
249
172
|
}
|
|
250
173
|
export class PrivateSigKey {
|
|
174
|
+
private constructor();
|
|
251
175
|
free(): void;
|
|
252
176
|
}
|
|
253
|
-
export class
|
|
177
|
+
export class PublicEncKeyMlKem512 {
|
|
178
|
+
private constructor();
|
|
254
179
|
free(): void;
|
|
255
180
|
}
|
|
256
181
|
export class PublicSigKey {
|
|
182
|
+
private constructor();
|
|
257
183
|
free(): void;
|
|
258
184
|
}
|
|
259
|
-
export class ReencryptionRequest {
|
|
260
|
-
free(): void;
|
|
261
|
-
domain?: Eip712DomainMsg;
|
|
262
|
-
payload?: ReencryptionRequestPayload;
|
|
263
185
|
/**
|
|
264
|
-
*
|
|
265
|
-
*
|
|
186
|
+
* / A unique 32 Byte / 256 Bit ID, to be used to identify a request and
|
|
187
|
+
* / for retrieving the computed result later on.
|
|
188
|
+
* / Must be encoded in lower-case hex. The string must NOT contain a `0x` prefix.
|
|
266
189
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
signature: Uint8Array;
|
|
190
|
+
export class RequestId {
|
|
191
|
+
private constructor();
|
|
192
|
+
free(): void;
|
|
193
|
+
request_id: string;
|
|
272
194
|
}
|
|
273
|
-
export class
|
|
195
|
+
export class ServerIdAddr {
|
|
196
|
+
private constructor();
|
|
274
197
|
free(): void;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
* The client's (blockchain wallet) address,
|
|
288
|
-
* encoded using EIP-55.
|
|
289
|
-
*/
|
|
290
|
-
client_address: string;
|
|
291
|
-
/**
|
|
292
|
-
* Encoding of the user's public encryption key for this request.
|
|
293
|
-
* Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
|
|
294
|
-
* Montgomery point.
|
|
295
|
-
*/
|
|
296
|
-
enc_key: Uint8Array;
|
|
297
|
-
/**
|
|
298
|
-
* The type of plaintext encrypted.
|
|
299
|
-
*/
|
|
198
|
+
}
|
|
199
|
+
export class TypedCiphertext {
|
|
200
|
+
private constructor();
|
|
201
|
+
free(): void;
|
|
202
|
+
/**
|
|
203
|
+
* The actual ciphertext to decrypt, taken directly from fhevm.
|
|
204
|
+
*/
|
|
205
|
+
ciphertext: Uint8Array;
|
|
206
|
+
/**
|
|
207
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
208
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
209
|
+
*/
|
|
300
210
|
fhe_type: number;
|
|
301
|
-
/**
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
211
|
+
/**
|
|
212
|
+
* The external handle of the ciphertext (the handle used in the copro).
|
|
213
|
+
*/
|
|
214
|
+
external_handle: Uint8Array;
|
|
215
|
+
/**
|
|
216
|
+
* The ciphertext format, see CiphertextFormat documentation for details.
|
|
217
|
+
* CiphertextFormat::default() is used if unspecified.
|
|
218
|
+
*/
|
|
219
|
+
ciphertext_format: number;
|
|
310
220
|
}
|
|
311
|
-
export class
|
|
221
|
+
export class TypedPlaintext {
|
|
222
|
+
private constructor();
|
|
312
223
|
free(): void;
|
|
313
|
-
/**
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
224
|
+
/**
|
|
225
|
+
* The actual plaintext in bytes.
|
|
226
|
+
*/
|
|
227
|
+
bytes: Uint8Array;
|
|
228
|
+
/**
|
|
229
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
230
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
231
|
+
*/
|
|
232
|
+
fhe_type: number;
|
|
318
233
|
}
|
|
319
|
-
export class
|
|
234
|
+
export class TypedSigncryptedCiphertext {
|
|
235
|
+
private constructor();
|
|
320
236
|
free(): void;
|
|
321
|
-
/**
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* The concatenation of two digests:
|
|
327
|
-
* (eip712_signing_hash(pk, domain) || ciphertext digest).
|
|
328
|
-
* This is needed to ensure the response corresponds to the request.
|
|
329
|
-
*/
|
|
330
|
-
digest: Uint8Array;
|
|
331
|
-
/**
|
|
332
|
-
* The type of plaintext encrypted.
|
|
333
|
-
*/
|
|
237
|
+
/**
|
|
238
|
+
* The type of plaintext encrypted. The type should match FheType from tfhe-rs:
|
|
239
|
+
* <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
|
|
240
|
+
*/
|
|
334
241
|
fhe_type: number;
|
|
335
|
-
/**
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
party_id: number;
|
|
340
|
-
/**
|
|
341
|
-
* The signcrypted payload, using a hybrid encryption approach in
|
|
342
|
-
* sign-then-encrypt.
|
|
343
|
-
*/
|
|
242
|
+
/**
|
|
243
|
+
* The signcrypted payload, using a hybrid encryption approach in
|
|
244
|
+
* sign-then-encrypt.
|
|
245
|
+
*/
|
|
344
246
|
signcrypted_ciphertext: Uint8Array;
|
|
345
|
-
/**
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
*/
|
|
355
|
-
version: number;
|
|
247
|
+
/**
|
|
248
|
+
* The external handles that were originally in the request.
|
|
249
|
+
*/
|
|
250
|
+
external_handle: Uint8Array;
|
|
251
|
+
/**
|
|
252
|
+
* The packing factor determines whether the decrypted plaintext
|
|
253
|
+
* has a different way of packing compared to what is specified in the plaintext modulus.
|
|
254
|
+
*/
|
|
255
|
+
packing_factor: number;
|
|
356
256
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
* later on.
|
|
360
|
-
*/
|
|
361
|
-
export class RequestId {
|
|
257
|
+
export class UserDecryptionRequest {
|
|
258
|
+
private constructor();
|
|
362
259
|
free(): void;
|
|
363
|
-
|
|
260
|
+
/**
|
|
261
|
+
* The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
|
|
262
|
+
* prefix. Future queries for the result must use this request ID.
|
|
263
|
+
*/
|
|
264
|
+
get request_id(): RequestId | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
|
|
267
|
+
* prefix. Future queries for the result must use this request ID.
|
|
268
|
+
*/
|
|
269
|
+
set request_id(value: RequestId | null | undefined);
|
|
270
|
+
/**
|
|
271
|
+
* The list of ciphertexts to decrypt for the user.
|
|
272
|
+
*/
|
|
273
|
+
typed_ciphertexts: TypedCiphertext[];
|
|
274
|
+
/**
|
|
275
|
+
* The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
|
|
276
|
+
* used for key generation
|
|
277
|
+
*/
|
|
278
|
+
get key_id(): RequestId | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
|
|
281
|
+
* used for key generation
|
|
282
|
+
*/
|
|
283
|
+
set key_id(value: RequestId | null | undefined);
|
|
284
|
+
/**
|
|
285
|
+
* The client's (blockchain wallet) address, encoded using EIP-55. I.e. including `0x`.
|
|
286
|
+
*/
|
|
287
|
+
client_address: string;
|
|
288
|
+
/**
|
|
289
|
+
* Encoding of the user's public encryption key for this request.
|
|
290
|
+
* This must be a bincode (v.1) encoded ML-KEM 512 key.
|
|
291
|
+
*/
|
|
292
|
+
enc_key: Uint8Array;
|
|
293
|
+
/**
|
|
294
|
+
* The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
|
|
295
|
+
*/
|
|
296
|
+
get domain(): Eip712DomainMsg | undefined;
|
|
297
|
+
/**
|
|
298
|
+
* The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
|
|
299
|
+
*/
|
|
300
|
+
set domain(value: Eip712DomainMsg | null | undefined);
|
|
301
|
+
}
|
|
302
|
+
export class UserDecryptionResponse {
|
|
303
|
+
private constructor();
|
|
304
|
+
free(): void;
|
|
305
|
+
signature: Uint8Array;
|
|
306
|
+
/**
|
|
307
|
+
* This is the external signature created from the Eip712 domain
|
|
308
|
+
* on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
|
|
309
|
+
* struct UserDecryptResponseVerification {
|
|
310
|
+
* bytes publicKey;
|
|
311
|
+
* uint256\[\] ctHandles;
|
|
312
|
+
* bytes userDecryptedShare;
|
|
313
|
+
* }
|
|
314
|
+
*/
|
|
315
|
+
external_signature: Uint8Array;
|
|
316
|
+
/**
|
|
317
|
+
* The actual \[UserDecryptionResponsePayload\].
|
|
318
|
+
*/
|
|
319
|
+
get payload(): UserDecryptionResponsePayload | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* The actual \[UserDecryptionResponsePayload\].
|
|
322
|
+
*/
|
|
323
|
+
set payload(value: UserDecryptionResponsePayload | null | undefined);
|
|
324
|
+
}
|
|
325
|
+
export class UserDecryptionResponsePayload {
|
|
326
|
+
private constructor();
|
|
327
|
+
free(): void;
|
|
328
|
+
/**
|
|
329
|
+
* The server's signature verification key, Encoded using SEC1.
|
|
330
|
+
* Needed to validate the response, but MUST also be linked to a list of
|
|
331
|
+
* trusted keys.
|
|
332
|
+
*/
|
|
333
|
+
verification_key: Uint8Array;
|
|
334
|
+
/**
|
|
335
|
+
* This is needed to ensure the response corresponds to the request.
|
|
336
|
+
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
337
|
+
* under the given domain in the request.
|
|
338
|
+
*/
|
|
339
|
+
digest: Uint8Array;
|
|
340
|
+
/**
|
|
341
|
+
* The resulting signcrypted ciphertexts, each ciphertext
|
|
342
|
+
* must be decrypted and then reconstructed with the other shares
|
|
343
|
+
* to produce the final plaintext.
|
|
344
|
+
*/
|
|
345
|
+
signcrypted_ciphertexts: TypedSigncryptedCiphertext[];
|
|
346
|
+
/**
|
|
347
|
+
* The ID of the MPC party doing the user decryption. Used for polynomial
|
|
348
|
+
* reconstruction.
|
|
349
|
+
*/
|
|
350
|
+
party_id: number;
|
|
351
|
+
/**
|
|
352
|
+
* The degree of the sharing scheme used.
|
|
353
|
+
*/
|
|
354
|
+
degree: number;
|
|
364
355
|
}
|