tkms 0.11.0-rc3 → 0.11.0-rc5

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 CHANGED
@@ -39,12 +39,13 @@ export function cryptobox_decrypt(ct: CryptoBoxCt, my_sk: PrivateEncKey, their_p
39
39
  * It can be set to null if `verify` is false.
40
40
  * Otherwise the caller needs to give the following JS object.
41
41
  * Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
42
+ * The signature field is not needed.
42
43
  * ```
43
44
  * {
44
- * signature: '15a4f9a8eb61459cfba7d103d8f911fb04ce91ecf841b34c49c0d56a70b896d20cbc31986188f91efc3842b7df215cee8acb40178daedb8b63d0ba5d199bce121c',
45
+ * signature: undefined,
45
46
  * client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
46
47
  * enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
47
- * ciphertext_handle: '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358',
48
+ * ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
48
49
  * eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
49
50
  * }
50
51
  * ```
@@ -113,7 +114,7 @@ export function process_reencryption_resp_from_js(client: Client, request: any,
113
114
  */
114
115
  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): (TypedPlaintext)[];
115
116
  /**
116
- * The plaintext types that can be encrypted in a fhevm ciphertext.
117
+ * The plaintext types that can be encrypted in a HTTPZ ciphertext.
117
118
  */
118
119
  export enum FheType {
119
120
  Ebool = 0,
@@ -188,17 +189,20 @@ export class PublicSigKey {
188
189
  export class ReencryptionRequest {
189
190
  private constructor();
190
191
  free(): void;
191
- payload?: ReencryptionRequestPayload;
192
- domain?: Eip712DomainMsg;
193
192
  /**
194
- * The ID that identifies this request.
193
+ * The 32 Byte / 256 Bit ID of the user decryption request, without `0x` prefix.
195
194
  * Future queries for the result must use this request ID.
196
195
  */
197
196
  request_id?: RequestId;
198
- }
199
- export class ReencryptionRequestPayload {
200
- private constructor();
201
- free(): void;
197
+ /**
198
+ * The list of ciphertexts to reencrypt.
199
+ */
200
+ typed_ciphertexts: (TypedCiphertext)[];
201
+ /**
202
+ * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id used for key
203
+ * generation
204
+ */
205
+ key_id?: RequestId;
202
206
  /**
203
207
  * The client's (blockchain wallet) address,
204
208
  * encoded using EIP-55.
@@ -210,22 +214,24 @@ export class ReencryptionRequestPayload {
210
214
  * Montgomery point.
211
215
  */
212
216
  enc_key: Uint8Array;
213
- /**
214
- * The key id to use for decryption. Will be the request_id used during key
215
- * generation
216
- */
217
- key_id?: RequestId;
218
- /**
219
- * The list of ciphertexts to reencrypt.
220
- */
221
- typed_ciphertexts: (TypedCiphertext)[];
217
+ domain?: Eip712DomainMsg;
222
218
  }
223
219
  export class ReencryptionResponse {
224
220
  private constructor();
225
221
  free(): void;
226
222
  signature: Uint8Array;
227
223
  /**
228
- * Signature of the serialization of \[ReencryptionResponsePayload\].
224
+ * This is the external signature created from the Eip712 domain
225
+ * on the structure, where reencryptedShare is bincode::serialize(&payload)
226
+ * struct UserDecryptResponseVerification {
227
+ * bytes publicKey;
228
+ * uint256\[\] ctHandles;
229
+ * bytes reencryptedShare;
230
+ * }
231
+ */
232
+ external_signature: Uint8Array;
233
+ /**
234
+ * The actual \[ReencryptionResponsePayload\].
229
235
  */
230
236
  payload?: ReencryptionResponsePayload;
231
237
  }
@@ -233,18 +239,22 @@ export class ReencryptionResponsePayload {
233
239
  private constructor();
234
240
  free(): void;
235
241
  /**
236
- * The server's signature verification key.
237
- * Encoded using SEC1.
242
+ * The server's signature verification key, Encoded using SEC1.
238
243
  * Needed to validate the response, but MUST also be linked to a list of
239
244
  * trusted keys.
240
245
  */
241
246
  verification_key: Uint8Array;
242
247
  /**
243
- * The concatenation of two digests:
244
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
245
248
  * This is needed to ensure the response corresponds to the request.
249
+ * It is the digest of UserDecryptionLinker hashed using EIP712
250
+ * under the given domain in the request.
246
251
  */
247
252
  digest: Uint8Array;
253
+ /**
254
+ * The resulting signcrypted ciphertexts, each ciphertext
255
+ * must be decrypted and then reconstructed with the other shares
256
+ * to produce the final plaintext.
257
+ */
248
258
  signcrypted_ciphertexts: (TypedSigncryptedCiphertext)[];
249
259
  /**
250
260
  * The ID of the MPC party doing the reencryption. Used for polynomial
@@ -255,20 +265,10 @@ export class ReencryptionResponsePayload {
255
265
  * The degree of the sharing scheme used.
256
266
  */
257
267
  degree: number;
258
- /**
259
- * This is the external signature created from the Eip712 domain
260
- * on the structure, where reencryptedShare is bincode::serialize(&signcrypted_ciphertexts)
261
- * struct UserDecryptionResult {
262
- * bytes publicKey;
263
- * uint256\[\] handles;
264
- * bytes reencryptedShare;
265
- * }
266
- */
267
- external_signature: Uint8Array;
268
268
  }
269
269
  /**
270
- * Simple response to return an ID, to be used to retrieve the computed result
271
- * later on.
270
+ * Simple response to return a 32 Byte / 256 Bit ID, to be used to retrieve the computed result
271
+ * later on. This string does NOT contain a `0x` prefix.
272
272
  */
273
273
  export class RequestId {
274
274
  private constructor();
@@ -279,7 +279,7 @@ export class TypedCiphertext {
279
279
  private constructor();
280
280
  free(): void;
281
281
  /**
282
- * The actual ciphertext to decrypt, taken directly from the fhevm.
282
+ * The actual ciphertext to decrypt, taken directly from HTTPZ.
283
283
  */
284
284
  ciphertext: Uint8Array;
285
285
  /**
@@ -290,6 +290,11 @@ export class TypedCiphertext {
290
290
  * The external handle of the ciphertext (the handle used in the copro).
291
291
  */
292
292
  external_handle: Uint8Array;
293
+ /**
294
+ * The ciphertext format, see CiphertextFormat documentation for details.
295
+ * CiphertextFormat::default() is used if unspecified.
296
+ */
297
+ ciphertext_format: number;
293
298
  }
294
299
  /**
295
300
  * The typed plaintext type, which is the result of decryption.
@@ -331,6 +336,10 @@ export interface InitOutput {
331
336
  readonly __wbg_client_free: (a: number, b: number) => void;
332
337
  readonly __wbg_ciphertexthandle_free: (a: number, b: number) => void;
333
338
  readonly __wbg_parsedreencryptionrequest_free: (a: number, b: number) => void;
339
+ readonly __wbg_publicenckey_free: (a: number, b: number) => void;
340
+ readonly __wbg_privateenckey_free: (a: number, b: number) => void;
341
+ readonly __wbg_publicsigkey_free: (a: number, b: number) => void;
342
+ readonly __wbg_privatesigkey_free: (a: number, b: number) => void;
334
343
  readonly public_sig_key_to_u8vec: (a: number) => [number, number];
335
344
  readonly u8vec_to_public_sig_key: (a: number, b: number) => [number, number, number];
336
345
  readonly private_sig_key_to_u8vec: (a: number) => [number, number, number, number];
@@ -350,23 +359,15 @@ export interface InitOutput {
350
359
  readonly cryptobox_decrypt: (a: number, b: number, c: number) => [number, number];
351
360
  readonly process_reencryption_resp_from_js: (a: number, b: any, c: any, d: any, e: number, f: number, g: number) => [number, number, number, number];
352
361
  readonly process_reencryption_resp: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
353
- readonly __wbg_publicenckey_free: (a: number, b: number) => void;
354
- readonly __wbg_privateenckey_free: (a: number, b: number) => void;
355
- readonly __wbg_publicsigkey_free: (a: number, b: number) => void;
356
- readonly __wbg_privatesigkey_free: (a: number, b: number) => void;
357
362
  readonly __wbg_requestid_free: (a: number, b: number) => void;
358
363
  readonly __wbg_typedciphertext_free: (a: number, b: number) => void;
359
364
  readonly __wbg_get_typedciphertext_fhe_type: (a: number) => number;
360
365
  readonly __wbg_set_typedciphertext_fhe_type: (a: number, b: number) => void;
366
+ readonly __wbg_get_typedciphertext_ciphertext_format: (a: number) => number;
367
+ readonly __wbg_set_typedciphertext_ciphertext_format: (a: number, b: number) => void;
361
368
  readonly __wbg_typedplaintext_free: (a: number, b: number) => void;
362
369
  readonly __wbg_get_typedplaintext_fhe_type: (a: number) => number;
363
370
  readonly __wbg_set_typedplaintext_fhe_type: (a: number, b: number) => void;
364
- readonly __wbg_reencryptionrequestpayload_free: (a: number, b: number) => void;
365
- readonly __wbg_get_reencryptionrequestpayload_enc_key: (a: number) => [number, number];
366
- readonly __wbg_get_reencryptionrequestpayload_key_id: (a: number) => number;
367
- readonly __wbg_set_reencryptionrequestpayload_key_id: (a: number, b: number) => void;
368
- readonly __wbg_get_reencryptionrequestpayload_typed_ciphertexts: (a: number) => [number, number];
369
- readonly __wbg_set_reencryptionrequestpayload_typed_ciphertexts: (a: number, b: number, c: number) => void;
370
371
  readonly __wbg_eip712domainmsg_free: (a: number, b: number) => void;
371
372
  readonly __wbg_get_eip712domainmsg_name: (a: number) => [number, number];
372
373
  readonly __wbg_set_eip712domainmsg_name: (a: number, b: number, c: number) => void;
@@ -379,14 +380,17 @@ export interface InitOutput {
379
380
  readonly __wbg_get_eip712domainmsg_salt: (a: number) => [number, number];
380
381
  readonly __wbg_set_eip712domainmsg_salt: (a: number, b: number, c: number) => void;
381
382
  readonly __wbg_reencryptionrequest_free: (a: number, b: number) => void;
382
- readonly __wbg_get_reencryptionrequest_payload: (a: number) => number;
383
- readonly __wbg_set_reencryptionrequest_payload: (a: number, b: number) => void;
384
- readonly __wbg_get_reencryptionrequest_domain: (a: number) => number;
385
- readonly __wbg_set_reencryptionrequest_domain: (a: number, b: number) => void;
386
383
  readonly __wbg_get_reencryptionrequest_request_id: (a: number) => number;
387
384
  readonly __wbg_set_reencryptionrequest_request_id: (a: number, b: number) => void;
385
+ readonly __wbg_get_reencryptionrequest_typed_ciphertexts: (a: number) => [number, number];
386
+ readonly __wbg_set_reencryptionrequest_typed_ciphertexts: (a: number, b: number, c: number) => void;
387
+ readonly __wbg_get_reencryptionrequest_key_id: (a: number) => number;
388
+ readonly __wbg_set_reencryptionrequest_key_id: (a: number, b: number) => void;
389
+ readonly __wbg_get_reencryptionrequest_domain: (a: number) => number;
390
+ readonly __wbg_set_reencryptionrequest_domain: (a: number, b: number) => void;
388
391
  readonly __wbg_reencryptionresponse_free: (a: number, b: number) => void;
389
392
  readonly __wbg_get_reencryptionresponse_signature: (a: number) => [number, number];
393
+ readonly __wbg_get_reencryptionresponse_external_signature: (a: number) => [number, number];
390
394
  readonly __wbg_get_reencryptionresponse_payload: (a: number) => number;
391
395
  readonly __wbg_set_reencryptionresponse_payload: (a: number, b: number) => void;
392
396
  readonly __wbg_reencryptionresponsepayload_free: (a: number, b: number) => void;
@@ -396,26 +400,26 @@ export interface InitOutput {
396
400
  readonly __wbg_set_reencryptionresponsepayload_party_id: (a: number, b: number) => void;
397
401
  readonly __wbg_get_reencryptionresponsepayload_degree: (a: number) => number;
398
402
  readonly __wbg_set_reencryptionresponsepayload_degree: (a: number, b: number) => void;
399
- readonly __wbg_get_reencryptionresponsepayload_external_signature: (a: number) => [number, number];
400
403
  readonly __wbg_typedsigncryptedciphertext_free: (a: number, b: number) => void;
401
404
  readonly __wbg_get_typedsigncryptedciphertext_fhe_type: (a: number) => number;
402
405
  readonly __wbg_set_typedciphertext_ciphertext: (a: number, b: number, c: number) => void;
403
406
  readonly __wbg_set_typedplaintext_bytes: (a: number, b: number, c: number) => void;
404
407
  readonly __wbg_set_requestid_request_id: (a: number, b: number, c: number) => void;
405
408
  readonly __wbg_set_typedciphertext_external_handle: (a: number, b: number, c: number) => void;
406
- readonly __wbg_set_reencryptionrequestpayload_client_address: (a: number, b: number, c: number) => void;
407
- readonly __wbg_set_reencryptionrequestpayload_enc_key: (a: number, b: number, c: number) => void;
409
+ readonly __wbg_set_reencryptionrequest_client_address: (a: number, b: number, c: number) => void;
410
+ readonly __wbg_set_reencryptionrequest_enc_key: (a: number, b: number, c: number) => void;
408
411
  readonly __wbg_set_reencryptionresponse_signature: (a: number, b: number, c: number) => void;
412
+ readonly __wbg_set_reencryptionresponse_external_signature: (a: number, b: number, c: number) => void;
409
413
  readonly __wbg_set_reencryptionresponsepayload_verification_key: (a: number, b: number, c: number) => void;
410
414
  readonly __wbg_set_reencryptionresponsepayload_digest: (a: number, b: number, c: number) => void;
411
- readonly __wbg_set_reencryptionresponsepayload_external_signature: (a: number, b: number, c: number) => void;
412
415
  readonly __wbg_set_typedsigncryptedciphertext_signcrypted_ciphertext: (a: number, b: number, c: number) => void;
413
416
  readonly __wbg_set_typedsigncryptedciphertext_external_handle: (a: number, b: number, c: number) => void;
414
417
  readonly __wbg_get_requestid_request_id: (a: number) => [number, number];
415
- readonly __wbg_get_reencryptionrequestpayload_client_address: (a: number) => [number, number];
418
+ readonly __wbg_get_reencryptionrequest_client_address: (a: number) => [number, number];
416
419
  readonly __wbg_get_typedplaintext_bytes: (a: number) => [number, number];
417
- readonly __wbg_get_typedciphertext_external_handle: (a: number) => [number, number];
420
+ readonly __wbg_get_reencryptionrequest_enc_key: (a: number) => [number, number];
418
421
  readonly __wbg_get_typedciphertext_ciphertext: (a: number) => [number, number];
422
+ readonly __wbg_get_typedciphertext_external_handle: (a: number) => [number, number];
419
423
  readonly __wbg_get_reencryptionresponsepayload_verification_key: (a: number) => [number, number];
420
424
  readonly __wbg_get_reencryptionresponsepayload_digest: (a: number) => [number, number];
421
425
  readonly __wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext: (a: number) => [number, number];
package/kms_lib.js CHANGED
@@ -451,12 +451,13 @@ export function cryptobox_decrypt(ct, my_sk, their_pk) {
451
451
  * It can be set to null if `verify` is false.
452
452
  * Otherwise the caller needs to give the following JS object.
453
453
  * Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
454
+ * The signature field is not needed.
454
455
  * ```
455
456
  * {
456
- * signature: '15a4f9a8eb61459cfba7d103d8f911fb04ce91ecf841b34c49c0d56a70b896d20cbc31986188f91efc3842b7df215cee8acb40178daedb8b63d0ba5d199bce121c',
457
+ * signature: undefined,
457
458
  * client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
458
459
  * enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
459
- * ciphertext_handle: '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358',
460
+ * ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
460
461
  * eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
461
462
  * }
462
463
  * ```
@@ -577,7 +578,7 @@ export function process_reencryption_resp(client, request, eip712_domain, agg_re
577
578
  }
578
579
 
579
580
  /**
580
- * The plaintext types that can be encrypted in a fhevm ciphertext.
581
+ * The plaintext types that can be encrypted in a HTTPZ ciphertext.
581
582
  * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11}
582
583
  */
583
584
  export const FheType = Object.freeze({
@@ -958,89 +959,67 @@ export class ReencryptionRequest {
958
959
  wasm.__wbg_reencryptionrequest_free(ptr, 0);
959
960
  }
960
961
  /**
961
- * @returns {ReencryptionRequestPayload | undefined}
962
+ * The 32 Byte / 256 Bit ID of the user decryption request, without `0x` prefix.
963
+ * Future queries for the result must use this request ID.
964
+ * @returns {RequestId | undefined}
962
965
  */
963
- get payload() {
964
- const ret = wasm.__wbg_get_reencryptionrequest_payload(this.__wbg_ptr);
965
- return ret === 0 ? undefined : ReencryptionRequestPayload.__wrap(ret);
966
+ get request_id() {
967
+ const ret = wasm.__wbg_get_reencryptionrequest_request_id(this.__wbg_ptr);
968
+ return ret === 0 ? undefined : RequestId.__wrap(ret);
966
969
  }
967
970
  /**
968
- * @param {ReencryptionRequestPayload | undefined} [arg0]
971
+ * The 32 Byte / 256 Bit ID of the user decryption request, without `0x` prefix.
972
+ * Future queries for the result must use this request ID.
973
+ * @param {RequestId | undefined} [arg0]
969
974
  */
970
- set payload(arg0) {
975
+ set request_id(arg0) {
971
976
  let ptr0 = 0;
972
977
  if (!isLikeNone(arg0)) {
973
- _assertClass(arg0, ReencryptionRequestPayload);
978
+ _assertClass(arg0, RequestId);
974
979
  ptr0 = arg0.__destroy_into_raw();
975
980
  }
976
- wasm.__wbg_set_reencryptionrequest_payload(this.__wbg_ptr, ptr0);
981
+ wasm.__wbg_set_reencryptionrequest_request_id(this.__wbg_ptr, ptr0);
977
982
  }
978
983
  /**
979
- * @returns {Eip712DomainMsg | undefined}
984
+ * The list of ciphertexts to reencrypt.
985
+ * @returns {(TypedCiphertext)[]}
980
986
  */
981
- get domain() {
982
- const ret = wasm.__wbg_get_reencryptionrequest_domain(this.__wbg_ptr);
983
- return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
987
+ get typed_ciphertexts() {
988
+ const ret = wasm.__wbg_get_reencryptionrequest_typed_ciphertexts(this.__wbg_ptr);
989
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
990
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
991
+ return v1;
984
992
  }
985
993
  /**
986
- * @param {Eip712DomainMsg | undefined} [arg0]
994
+ * The list of ciphertexts to reencrypt.
995
+ * @param {(TypedCiphertext)[]} arg0
987
996
  */
988
- set domain(arg0) {
989
- let ptr0 = 0;
990
- if (!isLikeNone(arg0)) {
991
- _assertClass(arg0, Eip712DomainMsg);
992
- ptr0 = arg0.__destroy_into_raw();
993
- }
994
- wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
997
+ set typed_ciphertexts(arg0) {
998
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
999
+ const len0 = WASM_VECTOR_LEN;
1000
+ wasm.__wbg_set_reencryptionrequest_typed_ciphertexts(this.__wbg_ptr, ptr0, len0);
995
1001
  }
996
1002
  /**
997
- * The ID that identifies this request.
998
- * Future queries for the result must use this request ID.
1003
+ * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id used for key
1004
+ * generation
999
1005
  * @returns {RequestId | undefined}
1000
1006
  */
1001
- get request_id() {
1002
- const ret = wasm.__wbg_get_reencryptionrequest_request_id(this.__wbg_ptr);
1007
+ get key_id() {
1008
+ const ret = wasm.__wbg_get_reencryptionrequest_key_id(this.__wbg_ptr);
1003
1009
  return ret === 0 ? undefined : RequestId.__wrap(ret);
1004
1010
  }
1005
1011
  /**
1006
- * The ID that identifies this request.
1007
- * Future queries for the result must use this request ID.
1012
+ * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id used for key
1013
+ * generation
1008
1014
  * @param {RequestId | undefined} [arg0]
1009
1015
  */
1010
- set request_id(arg0) {
1016
+ set key_id(arg0) {
1011
1017
  let ptr0 = 0;
1012
1018
  if (!isLikeNone(arg0)) {
1013
1019
  _assertClass(arg0, RequestId);
1014
1020
  ptr0 = arg0.__destroy_into_raw();
1015
1021
  }
1016
- wasm.__wbg_set_reencryptionrequest_request_id(this.__wbg_ptr, ptr0);
1017
- }
1018
- }
1019
-
1020
- const ReencryptionRequestPayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1021
- ? { register: () => {}, unregister: () => {} }
1022
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequestpayload_free(ptr >>> 0, 1));
1023
-
1024
- export class ReencryptionRequestPayload {
1025
-
1026
- static __wrap(ptr) {
1027
- ptr = ptr >>> 0;
1028
- const obj = Object.create(ReencryptionRequestPayload.prototype);
1029
- obj.__wbg_ptr = ptr;
1030
- ReencryptionRequestPayloadFinalization.register(obj, obj.__wbg_ptr, obj);
1031
- return obj;
1032
- }
1033
-
1034
- __destroy_into_raw() {
1035
- const ptr = this.__wbg_ptr;
1036
- this.__wbg_ptr = 0;
1037
- ReencryptionRequestPayloadFinalization.unregister(this);
1038
- return ptr;
1039
- }
1040
-
1041
- free() {
1042
- const ptr = this.__destroy_into_raw();
1043
- wasm.__wbg_reencryptionrequestpayload_free(ptr, 0);
1022
+ wasm.__wbg_set_reencryptionrequest_key_id(this.__wbg_ptr, ptr0);
1044
1023
  }
1045
1024
  /**
1046
1025
  * The client's (blockchain wallet) address,
@@ -1051,7 +1030,7 @@ export class ReencryptionRequestPayload {
1051
1030
  let deferred1_0;
1052
1031
  let deferred1_1;
1053
1032
  try {
1054
- const ret = wasm.__wbg_get_reencryptionrequestpayload_client_address(this.__wbg_ptr);
1033
+ const ret = wasm.__wbg_get_reencryptionrequest_client_address(this.__wbg_ptr);
1055
1034
  deferred1_0 = ret[0];
1056
1035
  deferred1_1 = ret[1];
1057
1036
  return getStringFromWasm0(ret[0], ret[1]);
@@ -1067,7 +1046,7 @@ export class ReencryptionRequestPayload {
1067
1046
  set client_address(arg0) {
1068
1047
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1069
1048
  const len0 = WASM_VECTOR_LEN;
1070
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1049
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1071
1050
  }
1072
1051
  /**
1073
1052
  * Encoding of the user's public encryption key for this request.
@@ -1076,7 +1055,7 @@ export class ReencryptionRequestPayload {
1076
1055
  * @returns {Uint8Array}
1077
1056
  */
1078
1057
  get enc_key() {
1079
- const ret = wasm.__wbg_get_reencryptionrequestpayload_enc_key(this.__wbg_ptr);
1058
+ const ret = wasm.__wbg_get_reencryptionrequest_enc_key(this.__wbg_ptr);
1080
1059
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1081
1060
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1082
1061
  return v1;
@@ -1090,48 +1069,25 @@ export class ReencryptionRequestPayload {
1090
1069
  set enc_key(arg0) {
1091
1070
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1092
1071
  const len0 = WASM_VECTOR_LEN;
1093
- wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1072
+ wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
1094
1073
  }
1095
1074
  /**
1096
- * The key id to use for decryption. Will be the request_id used during key
1097
- * generation
1098
- * @returns {RequestId | undefined}
1075
+ * @returns {Eip712DomainMsg | undefined}
1099
1076
  */
1100
- get key_id() {
1101
- const ret = wasm.__wbg_get_reencryptionrequestpayload_key_id(this.__wbg_ptr);
1102
- return ret === 0 ? undefined : RequestId.__wrap(ret);
1077
+ get domain() {
1078
+ const ret = wasm.__wbg_get_reencryptionrequest_domain(this.__wbg_ptr);
1079
+ return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
1103
1080
  }
1104
1081
  /**
1105
- * The key id to use for decryption. Will be the request_id used during key
1106
- * generation
1107
- * @param {RequestId | undefined} [arg0]
1082
+ * @param {Eip712DomainMsg | undefined} [arg0]
1108
1083
  */
1109
- set key_id(arg0) {
1084
+ set domain(arg0) {
1110
1085
  let ptr0 = 0;
1111
1086
  if (!isLikeNone(arg0)) {
1112
- _assertClass(arg0, RequestId);
1087
+ _assertClass(arg0, Eip712DomainMsg);
1113
1088
  ptr0 = arg0.__destroy_into_raw();
1114
1089
  }
1115
- wasm.__wbg_set_reencryptionrequestpayload_key_id(this.__wbg_ptr, ptr0);
1116
- }
1117
- /**
1118
- * The list of ciphertexts to reencrypt.
1119
- * @returns {(TypedCiphertext)[]}
1120
- */
1121
- get typed_ciphertexts() {
1122
- const ret = wasm.__wbg_get_reencryptionrequestpayload_typed_ciphertexts(this.__wbg_ptr);
1123
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1124
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1125
- return v1;
1126
- }
1127
- /**
1128
- * The list of ciphertexts to reencrypt.
1129
- * @param {(TypedCiphertext)[]} arg0
1130
- */
1131
- set typed_ciphertexts(arg0) {
1132
- const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
1133
- const len0 = WASM_VECTOR_LEN;
1134
- wasm.__wbg_set_reencryptionrequestpayload_typed_ciphertexts(this.__wbg_ptr, ptr0, len0);
1090
+ wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
1135
1091
  }
1136
1092
  }
1137
1093
 
@@ -1177,7 +1133,38 @@ export class ReencryptionResponse {
1177
1133
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1178
1134
  }
1179
1135
  /**
1180
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1136
+ * This is the external signature created from the Eip712 domain
1137
+ * on the structure, where reencryptedShare is bincode::serialize(&payload)
1138
+ * struct UserDecryptResponseVerification {
1139
+ * bytes publicKey;
1140
+ * uint256\[\] ctHandles;
1141
+ * bytes reencryptedShare;
1142
+ * }
1143
+ * @returns {Uint8Array}
1144
+ */
1145
+ get external_signature() {
1146
+ const ret = wasm.__wbg_get_reencryptionresponse_external_signature(this.__wbg_ptr);
1147
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1148
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1149
+ return v1;
1150
+ }
1151
+ /**
1152
+ * This is the external signature created from the Eip712 domain
1153
+ * on the structure, where reencryptedShare is bincode::serialize(&payload)
1154
+ * struct UserDecryptResponseVerification {
1155
+ * bytes publicKey;
1156
+ * uint256\[\] ctHandles;
1157
+ * bytes reencryptedShare;
1158
+ * }
1159
+ * @param {Uint8Array} arg0
1160
+ */
1161
+ set external_signature(arg0) {
1162
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1163
+ const len0 = WASM_VECTOR_LEN;
1164
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1165
+ }
1166
+ /**
1167
+ * The actual \[ReencryptionResponsePayload\].
1181
1168
  * @returns {ReencryptionResponsePayload | undefined}
1182
1169
  */
1183
1170
  get payload() {
@@ -1185,7 +1172,7 @@ export class ReencryptionResponse {
1185
1172
  return ret === 0 ? undefined : ReencryptionResponsePayload.__wrap(ret);
1186
1173
  }
1187
1174
  /**
1188
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1175
+ * The actual \[ReencryptionResponsePayload\].
1189
1176
  * @param {ReencryptionResponsePayload | undefined} [arg0]
1190
1177
  */
1191
1178
  set payload(arg0) {
@@ -1224,8 +1211,7 @@ export class ReencryptionResponsePayload {
1224
1211
  wasm.__wbg_reencryptionresponsepayload_free(ptr, 0);
1225
1212
  }
1226
1213
  /**
1227
- * The server's signature verification key.
1228
- * Encoded using SEC1.
1214
+ * The server's signature verification key, Encoded using SEC1.
1229
1215
  * Needed to validate the response, but MUST also be linked to a list of
1230
1216
  * trusted keys.
1231
1217
  * @returns {Uint8Array}
@@ -1237,8 +1223,7 @@ export class ReencryptionResponsePayload {
1237
1223
  return v1;
1238
1224
  }
1239
1225
  /**
1240
- * The server's signature verification key.
1241
- * Encoded using SEC1.
1226
+ * The server's signature verification key, Encoded using SEC1.
1242
1227
  * Needed to validate the response, but MUST also be linked to a list of
1243
1228
  * trusted keys.
1244
1229
  * @param {Uint8Array} arg0
@@ -1249,9 +1234,9 @@ export class ReencryptionResponsePayload {
1249
1234
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1250
1235
  }
1251
1236
  /**
1252
- * The concatenation of two digests:
1253
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1254
1237
  * This is needed to ensure the response corresponds to the request.
1238
+ * It is the digest of UserDecryptionLinker hashed using EIP712
1239
+ * under the given domain in the request.
1255
1240
  * @returns {Uint8Array}
1256
1241
  */
1257
1242
  get digest() {
@@ -1261,9 +1246,9 @@ export class ReencryptionResponsePayload {
1261
1246
  return v1;
1262
1247
  }
1263
1248
  /**
1264
- * The concatenation of two digests:
1265
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1266
1249
  * This is needed to ensure the response corresponds to the request.
1250
+ * It is the digest of UserDecryptionLinker hashed using EIP712
1251
+ * under the given domain in the request.
1267
1252
  * @param {Uint8Array} arg0
1268
1253
  */
1269
1254
  set digest(arg0) {
@@ -1272,6 +1257,9 @@ export class ReencryptionResponsePayload {
1272
1257
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1273
1258
  }
1274
1259
  /**
1260
+ * The resulting signcrypted ciphertexts, each ciphertext
1261
+ * must be decrypted and then reconstructed with the other shares
1262
+ * to produce the final plaintext.
1275
1263
  * @returns {(TypedSigncryptedCiphertext)[]}
1276
1264
  */
1277
1265
  get signcrypted_ciphertexts() {
@@ -1281,6 +1269,9 @@ export class ReencryptionResponsePayload {
1281
1269
  return v1;
1282
1270
  }
1283
1271
  /**
1272
+ * The resulting signcrypted ciphertexts, each ciphertext
1273
+ * must be decrypted and then reconstructed with the other shares
1274
+ * to produce the final plaintext.
1284
1275
  * @param {(TypedSigncryptedCiphertext)[]} arg0
1285
1276
  */
1286
1277
  set signcrypted_ciphertexts(arg0) {
@@ -1320,45 +1311,14 @@ export class ReencryptionResponsePayload {
1320
1311
  set degree(arg0) {
1321
1312
  wasm.__wbg_set_reencryptionresponsepayload_degree(this.__wbg_ptr, arg0);
1322
1313
  }
1323
- /**
1324
- * This is the external signature created from the Eip712 domain
1325
- * on the structure, where reencryptedShare is bincode::serialize(&signcrypted_ciphertexts)
1326
- * struct UserDecryptionResult {
1327
- * bytes publicKey;
1328
- * uint256\[\] handles;
1329
- * bytes reencryptedShare;
1330
- * }
1331
- * @returns {Uint8Array}
1332
- */
1333
- get external_signature() {
1334
- const ret = wasm.__wbg_get_reencryptionresponsepayload_external_signature(this.__wbg_ptr);
1335
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1336
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1337
- return v1;
1338
- }
1339
- /**
1340
- * This is the external signature created from the Eip712 domain
1341
- * on the structure, where reencryptedShare is bincode::serialize(&signcrypted_ciphertexts)
1342
- * struct UserDecryptionResult {
1343
- * bytes publicKey;
1344
- * uint256\[\] handles;
1345
- * bytes reencryptedShare;
1346
- * }
1347
- * @param {Uint8Array} arg0
1348
- */
1349
- set external_signature(arg0) {
1350
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1351
- const len0 = WASM_VECTOR_LEN;
1352
- wasm.__wbg_set_eip712domainmsg_verifying_contract(this.__wbg_ptr, ptr0, len0);
1353
- }
1354
1314
  }
1355
1315
 
1356
1316
  const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
1357
1317
  ? { register: () => {}, unregister: () => {} }
1358
1318
  : new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
1359
1319
  /**
1360
- * Simple response to return an ID, to be used to retrieve the computed result
1361
- * later on.
1320
+ * Simple response to return a 32 Byte / 256 Bit ID, to be used to retrieve the computed result
1321
+ * later on. This string does NOT contain a `0x` prefix.
1362
1322
  */
1363
1323
  export class RequestId {
1364
1324
 
@@ -1439,7 +1399,7 @@ export class TypedCiphertext {
1439
1399
  wasm.__wbg_typedciphertext_free(ptr, 0);
1440
1400
  }
1441
1401
  /**
1442
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1402
+ * The actual ciphertext to decrypt, taken directly from HTTPZ.
1443
1403
  * @returns {Uint8Array}
1444
1404
  */
1445
1405
  get ciphertext() {
@@ -1449,7 +1409,7 @@ export class TypedCiphertext {
1449
1409
  return v1;
1450
1410
  }
1451
1411
  /**
1452
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1412
+ * The actual ciphertext to decrypt, taken directly from HTTPZ.
1453
1413
  * @param {Uint8Array} arg0
1454
1414
  */
1455
1415
  set ciphertext(arg0) {
@@ -1491,6 +1451,23 @@ export class TypedCiphertext {
1491
1451
  const len0 = WASM_VECTOR_LEN;
1492
1452
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1493
1453
  }
1454
+ /**
1455
+ * The ciphertext format, see CiphertextFormat documentation for details.
1456
+ * CiphertextFormat::default() is used if unspecified.
1457
+ * @returns {number}
1458
+ */
1459
+ get ciphertext_format() {
1460
+ const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
1461
+ return ret;
1462
+ }
1463
+ /**
1464
+ * The ciphertext format, see CiphertextFormat documentation for details.
1465
+ * CiphertextFormat::default() is used if unspecified.
1466
+ * @param {number} arg0
1467
+ */
1468
+ set ciphertext_format(arg0) {
1469
+ wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
1470
+ }
1494
1471
  }
1495
1472
 
1496
1473
  const TypedPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
package/kms_lib_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Zama"
6
6
  ],
7
- "version": "0.11.0-rc3",
7
+ "version": "0.11.0-rc5",
8
8
  "license": "BSD-3-Clause-Clear",
9
9
  "files": [
10
10
  "kms_lib_bg.wasm",
package/LICENSE DELETED
@@ -1,28 +0,0 @@
1
- BSD 3-Clause Clear License
2
-
3
- Copyright © 2024 ZAMA.
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without modification,
7
- are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice, this
13
- list of conditions and the following disclaimer in the documentation and/or other
14
- materials provided with the distribution.
15
-
16
- 3. Neither the name of ZAMA nor the names of its contributors may be used to endorse
17
- or promote products derived from this software without specific prior written permission.
18
-
19
- NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
20
- THIS SOFTWARE IS PROVIDED BY THE ZAMA AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
21
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23
- ZAMA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.