tkms 0.13.10 → 0.13.20

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
@@ -22,7 +22,7 @@ export class Client {
22
22
 
23
23
  /**
24
24
  * Eip712 domain information.
25
- * Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) _must_ be fulfilled.
25
+ * Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) *must* be fulfilled.
26
26
  * Furthermore, be aware that all parameters will eventually be parsed into Solidity types.
27
27
  */
28
28
  export class Eip712DomainMsg {
@@ -196,7 +196,7 @@ export class UserDecryptionRequest {
196
196
  */
197
197
  set epoch_id(value: RequestId | null | undefined);
198
198
  /**
199
- * Extra data from the gateway.
199
+ * Extra data used in the EIP712 signature - external_signature.
200
200
  */
201
201
  extra_data: Uint8Array;
202
202
  /**
@@ -233,10 +233,10 @@ export class UserDecryptionResponse {
233
233
  * This is the external signature created from the Eip712 domain
234
234
  * on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
235
235
  * struct UserDecryptResponseVerification {
236
- * bytes publicKey;
237
- * uint256\[\] ctHandles;
238
- * bytes userDecryptedShare; // serialization of payload
239
- * bytes extraData;
236
+ * bytes publicKey;
237
+ * uint256\[\] ctHandles;
238
+ * bytes userDecryptedShare; // serialization of payload
239
+ * bytes extraData;
240
240
  * }
241
241
  */
242
242
  external_signature: Uint8Array;
@@ -361,10 +361,13 @@ export function private_sig_key_to_u8vec(sk: PrivateSigKey): Uint8Array;
361
361
  *
362
362
  * * `enc_sk` - The ephemeral secret key.
363
363
  *
364
+ * * `threshold` - Optional threshold override for reconstruction.
365
+ * If not provided, it is computed from the number of server addresses as `(n - 1) / 3`.
366
+ *
364
367
  * * `verify` - Whether to perform signature verification for the response.
365
368
  * It is insecure if `verify = false`!
366
369
  */
367
- 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[];
370
+ 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, threshold: number | null | undefined, verify: boolean): TypedPlaintext[];
368
371
 
369
372
  /**
370
373
  * Process the user_decryption response from JavaScript objects.
@@ -424,10 +427,15 @@ export function process_user_decryption_resp(client: Client, request: ParsedUser
424
427
  *
425
428
  * * `enc_sk` - The ephemeral secret key.
426
429
  *
430
+ * * `threshold` - Optional expected threshold/degree used during response validation.
431
+ * Validation requires at least `threshold + 1` matching responses, and the selected pivot
432
+ * response must have `degree == threshold`. If not provided, it is computed from the number
433
+ * of server addresses as `(n - 1) / 3`.
434
+ *
427
435
  * * `verify` - Whether to perform signature verification for the response.
428
436
  * It is insecure if `verify = false`!
429
437
  */
430
- 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[];
438
+ export function process_user_decryption_resp_from_js(client: Client, request: any, eip712_domain: any, agg_resp: any, enc_pk: PublicEncKeyMlKem512, enc_sk: PrivateEncKeyMlKem512, threshold: number | null | undefined, verify: boolean): TypedPlaintext[];
431
439
 
432
440
  export function public_sig_key_to_u8vec(pk: PublicSigKey): Uint8Array;
433
441
 
@@ -443,11 +451,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
443
451
 
444
452
  export interface InitOutput {
445
453
  readonly memory: WebAssembly.Memory;
446
- readonly __wbg_privatesigkey_free: (a: number, b: number) => void;
447
- readonly __wbg_publicsigkey_free: (a: number, b: number) => void;
448
454
  readonly __wbg_client_free: (a: number, b: number) => void;
449
- readonly __wbg_ciphertexthandle_free: (a: number, b: number) => void;
450
- readonly __wbg_parseduserdecryptionrequest_free: (a: number, b: number) => void;
451
455
  readonly __wbg_privateenckeymlkem512_free: (a: number, b: number) => void;
452
456
  readonly __wbg_publicenckeymlkem512_free: (a: number, b: number) => void;
453
457
  readonly __wbg_serveridaddr_free: (a: number, b: number) => void;
@@ -465,13 +469,17 @@ export interface InitOutput {
465
469
  readonly new_client: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
466
470
  readonly new_server_id_addr: (a: number, b: number, c: number) => [number, number, number];
467
471
  readonly private_sig_key_to_u8vec: (a: number) => [number, number, number, number];
468
- readonly process_user_decryption_resp: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
469
- readonly process_user_decryption_resp_from_js: (a: number, b: any, c: any, d: any, e: number, f: number, g: number) => [number, number, number, number];
472
+ readonly process_user_decryption_resp: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
473
+ readonly process_user_decryption_resp_from_js: (a: number, b: any, c: any, d: any, e: number, f: number, g: number, h: number) => [number, number, number, number];
470
474
  readonly public_sig_key_to_u8vec: (a: number) => [number, number];
471
475
  readonly u8vec_to_ml_kem_pke_pk: (a: number, b: number) => [number, number, number];
472
476
  readonly u8vec_to_ml_kem_pke_sk: (a: number, b: number) => [number, number, number];
473
477
  readonly u8vec_to_private_sig_key: (a: number, b: number) => [number, number, number];
474
478
  readonly u8vec_to_public_sig_key: (a: number, b: number) => [number, number, number];
479
+ readonly __wbg_privatesigkey_free: (a: number, b: number) => void;
480
+ readonly __wbg_publicsigkey_free: (a: number, b: number) => void;
481
+ readonly __wbg_ciphertexthandle_free: (a: number, b: number) => void;
482
+ readonly __wbg_parseduserdecryptionrequest_free: (a: number, b: number) => void;
475
483
  readonly __wbg_eip712domainmsg_free: (a: number, b: number) => void;
476
484
  readonly __wbg_get_eip712domainmsg_chain_id: (a: number) => [number, number];
477
485
  readonly __wbg_get_eip712domainmsg_name: (a: number) => [number, number];
@@ -523,6 +531,17 @@ export interface InitOutput {
523
531
  readonly __wbg_get_userdecryptionrequest_client_address: (a: number) => [number, number];
524
532
  readonly __wbg_set_typedsigncryptedciphertext_fhe_type: (a: number, b: number) => void;
525
533
  readonly __wbg_set_typedsigncryptedciphertext_packing_factor: (a: number, b: number) => void;
534
+ readonly __wbg_get_typedsigncryptedciphertext_fhe_type: (a: number) => number;
535
+ readonly __wbg_get_typedsigncryptedciphertext_packing_factor: (a: number) => number;
536
+ readonly __wbg_get_typedplaintext_bytes: (a: number) => [number, number];
537
+ readonly __wbg_get_typedsigncryptedciphertext_external_handle: (a: number) => [number, number];
538
+ readonly __wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext: (a: number) => [number, number];
539
+ readonly __wbg_get_userdecryptionrequest_enc_key: (a: number) => [number, number];
540
+ readonly __wbg_get_userdecryptionresponse_external_signature: (a: number) => [number, number];
541
+ readonly __wbg_get_userdecryptionresponse_extra_data: (a: number) => [number, number];
542
+ readonly __wbg_get_userdecryptionresponse_signature: (a: number) => [number, number];
543
+ readonly __wbg_get_userdecryptionresponsepayload_digest: (a: number) => [number, number];
544
+ readonly __wbg_get_userdecryptionresponsepayload_verification_key: (a: number) => [number, number];
526
545
  readonly __wbg_set_requestid_request_id: (a: number, b: number, c: number) => void;
527
546
  readonly __wbg_set_typedciphertext_ciphertext: (a: number, b: number, c: number) => void;
528
547
  readonly __wbg_set_typedciphertext_external_handle: (a: number, b: number, c: number) => void;
@@ -537,17 +556,6 @@ export interface InitOutput {
537
556
  readonly __wbg_set_userdecryptionresponse_signature: (a: number, b: number, c: number) => void;
538
557
  readonly __wbg_set_userdecryptionresponsepayload_digest: (a: number, b: number, c: number) => void;
539
558
  readonly __wbg_set_userdecryptionresponsepayload_verification_key: (a: number, b: number, c: number) => void;
540
- readonly __wbg_get_typedplaintext_bytes: (a: number) => [number, number];
541
- readonly __wbg_get_typedsigncryptedciphertext_external_handle: (a: number) => [number, number];
542
- readonly __wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext: (a: number) => [number, number];
543
- readonly __wbg_get_userdecryptionrequest_enc_key: (a: number) => [number, number];
544
- readonly __wbg_get_userdecryptionresponse_external_signature: (a: number) => [number, number];
545
- readonly __wbg_get_userdecryptionresponse_extra_data: (a: number) => [number, number];
546
- readonly __wbg_get_userdecryptionresponse_signature: (a: number) => [number, number];
547
- readonly __wbg_get_userdecryptionresponsepayload_digest: (a: number) => [number, number];
548
- readonly __wbg_get_userdecryptionresponsepayload_verification_key: (a: number) => [number, number];
549
- readonly __wbg_get_typedsigncryptedciphertext_fhe_type: (a: number) => number;
550
- readonly __wbg_get_typedsigncryptedciphertext_packing_factor: (a: number) => number;
551
559
  readonly __wbindgen_malloc: (a: number, b: number) => number;
552
560
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
553
561
  readonly __wbindgen_exn_store: (a: number) => void;
package/kms_lib.js CHANGED
@@ -44,7 +44,7 @@ if (Symbol.dispose) Client.prototype[Symbol.dispose] = Client.prototype.free;
44
44
 
45
45
  /**
46
46
  * Eip712 domain information.
47
- * Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) _must_ be fulfilled.
47
+ * Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) *must* be fulfilled.
48
48
  * Furthermore, be aware that all parameters will eventually be parsed into Solidity types.
49
49
  */
50
50
  export class Eip712DomainMsg {
@@ -319,7 +319,7 @@ export class RequestId {
319
319
  set request_id(arg0) {
320
320
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
321
  const len0 = WASM_VECTOR_LEN;
322
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
322
+ wasm.__wbg_set_requestid_request_id(this.__wbg_ptr, ptr0, len0);
323
323
  }
324
324
  }
325
325
  if (Symbol.dispose) RequestId.prototype[Symbol.dispose] = RequestId.prototype.free;
@@ -428,7 +428,7 @@ export class TypedCiphertext {
428
428
  set ciphertext(arg0) {
429
429
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
430
430
  const len0 = WASM_VECTOR_LEN;
431
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
431
+ wasm.__wbg_set_typedciphertext_ciphertext(this.__wbg_ptr, ptr0, len0);
432
432
  }
433
433
  /**
434
434
  * The external handle of the ciphertext (the handle used in the copro).
@@ -437,7 +437,7 @@ export class TypedCiphertext {
437
437
  set external_handle(arg0) {
438
438
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
439
439
  const len0 = WASM_VECTOR_LEN;
440
- wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
440
+ wasm.__wbg_set_typedciphertext_external_handle(this.__wbg_ptr, ptr0, len0);
441
441
  }
442
442
  /**
443
443
  * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
@@ -494,7 +494,7 @@ export class TypedPlaintext {
494
494
  set bytes(arg0) {
495
495
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
496
496
  const len0 = WASM_VECTOR_LEN;
497
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
497
+ wasm.__wbg_set_typedplaintext_bytes(this.__wbg_ptr, ptr0, len0);
498
498
  }
499
499
  /**
500
500
  * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
@@ -547,7 +547,7 @@ export class TypedSigncryptedCiphertext {
547
547
  * @returns {number}
548
548
  */
549
549
  get fhe_type() {
550
- const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
550
+ const ret = wasm.__wbg_get_typedsigncryptedciphertext_fhe_type(this.__wbg_ptr);
551
551
  return ret;
552
552
  }
553
553
  /**
@@ -556,7 +556,7 @@ export class TypedSigncryptedCiphertext {
556
556
  * @returns {number}
557
557
  */
558
558
  get packing_factor() {
559
- const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
559
+ const ret = wasm.__wbg_get_typedsigncryptedciphertext_packing_factor(this.__wbg_ptr);
560
560
  return ret >>> 0;
561
561
  }
562
562
  /**
@@ -577,7 +577,7 @@ export class TypedSigncryptedCiphertext {
577
577
  set external_handle(arg0) {
578
578
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
579
579
  const len0 = WASM_VECTOR_LEN;
580
- wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
580
+ wasm.__wbg_set_typedsigncryptedciphertext_external_handle(this.__wbg_ptr, ptr0, len0);
581
581
  }
582
582
  /**
583
583
  * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
@@ -585,7 +585,7 @@ export class TypedSigncryptedCiphertext {
585
585
  * @param {number} arg0
586
586
  */
587
587
  set fhe_type(arg0) {
588
- wasm.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr, arg0);
588
+ wasm.__wbg_set_typedsigncryptedciphertext_fhe_type(this.__wbg_ptr, arg0);
589
589
  }
590
590
  /**
591
591
  * The packing factor determines whether the decrypted plaintext
@@ -593,7 +593,7 @@ export class TypedSigncryptedCiphertext {
593
593
  * @param {number} arg0
594
594
  */
595
595
  set packing_factor(arg0) {
596
- wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
596
+ wasm.__wbg_set_typedsigncryptedciphertext_packing_factor(this.__wbg_ptr, arg0);
597
597
  }
598
598
  /**
599
599
  * The signcrypted payload, using a hybrid encryption approach in
@@ -603,7 +603,7 @@ export class TypedSigncryptedCiphertext {
603
603
  set signcrypted_ciphertext(arg0) {
604
604
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
605
605
  const len0 = WASM_VECTOR_LEN;
606
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
606
+ wasm.__wbg_set_typedsigncryptedciphertext_signcrypted_ciphertext(this.__wbg_ptr, ptr0, len0);
607
607
  }
608
608
  }
609
609
  if (Symbol.dispose) TypedSigncryptedCiphertext.prototype[Symbol.dispose] = TypedSigncryptedCiphertext.prototype.free;
@@ -674,7 +674,7 @@ export class UserDecryptionRequest {
674
674
  return ret === 0 ? undefined : RequestId.__wrap(ret);
675
675
  }
676
676
  /**
677
- * Extra data from the gateway.
677
+ * Extra data used in the EIP712 signature - external_signature.
678
678
  * @returns {Uint8Array}
679
679
  */
680
680
  get extra_data() {
@@ -718,7 +718,7 @@ export class UserDecryptionRequest {
718
718
  set client_address(arg0) {
719
719
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
720
720
  const len0 = WASM_VECTOR_LEN;
721
- wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
721
+ wasm.__wbg_set_userdecryptionrequest_client_address(this.__wbg_ptr, ptr0, len0);
722
722
  }
723
723
  /**
724
724
  * MPC context ID which is used to identify the context to use for this request.
@@ -755,7 +755,7 @@ export class UserDecryptionRequest {
755
755
  set enc_key(arg0) {
756
756
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
757
757
  const len0 = WASM_VECTOR_LEN;
758
- wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
758
+ wasm.__wbg_set_userdecryptionrequest_enc_key(this.__wbg_ptr, ptr0, len0);
759
759
  }
760
760
  /**
761
761
  * The epoch number placeholder (zama-ai/kms-internal#2743).
@@ -770,13 +770,13 @@ export class UserDecryptionRequest {
770
770
  wasm.__wbg_set_userdecryptionrequest_epoch_id(this.__wbg_ptr, ptr0);
771
771
  }
772
772
  /**
773
- * Extra data from the gateway.
773
+ * Extra data used in the EIP712 signature - external_signature.
774
774
  * @param {Uint8Array} arg0
775
775
  */
776
776
  set extra_data(arg0) {
777
777
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
778
778
  const len0 = WASM_VECTOR_LEN;
779
- wasm.__wbg_set_eip712domainmsg_verifying_contract(this.__wbg_ptr, ptr0, len0);
779
+ wasm.__wbg_set_userdecryptionrequest_extra_data(this.__wbg_ptr, ptr0, len0);
780
780
  }
781
781
  /**
782
782
  * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
@@ -837,10 +837,10 @@ export class UserDecryptionResponse {
837
837
  * This is the external signature created from the Eip712 domain
838
838
  * on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
839
839
  * struct UserDecryptResponseVerification {
840
- * bytes publicKey;
841
- * uint256\[\] ctHandles;
842
- * bytes userDecryptedShare; // serialization of payload
843
- * bytes extraData;
840
+ * bytes publicKey;
841
+ * uint256\[\] ctHandles;
842
+ * bytes userDecryptedShare; // serialization of payload
843
+ * bytes extraData;
844
844
  * }
845
845
  * @returns {Uint8Array}
846
846
  */
@@ -881,17 +881,17 @@ export class UserDecryptionResponse {
881
881
  * This is the external signature created from the Eip712 domain
882
882
  * on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
883
883
  * struct UserDecryptResponseVerification {
884
- * bytes publicKey;
885
- * uint256\[\] ctHandles;
886
- * bytes userDecryptedShare; // serialization of payload
887
- * bytes extraData;
884
+ * bytes publicKey;
885
+ * uint256\[\] ctHandles;
886
+ * bytes userDecryptedShare; // serialization of payload
887
+ * bytes extraData;
888
888
  * }
889
889
  * @param {Uint8Array} arg0
890
890
  */
891
891
  set external_signature(arg0) {
892
892
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
893
893
  const len0 = WASM_VECTOR_LEN;
894
- wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
894
+ wasm.__wbg_set_userdecryptionresponse_external_signature(this.__wbg_ptr, ptr0, len0);
895
895
  }
896
896
  /**
897
897
  * Extra data used in the EIP712 signature - external_signature.
@@ -900,7 +900,7 @@ export class UserDecryptionResponse {
900
900
  set extra_data(arg0) {
901
901
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
902
902
  const len0 = WASM_VECTOR_LEN;
903
- wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
903
+ wasm.__wbg_set_userdecryptionresponse_extra_data(this.__wbg_ptr, ptr0, len0);
904
904
  }
905
905
  /**
906
906
  * The actual \[UserDecryptionResponsePayload\].
@@ -920,7 +920,7 @@ export class UserDecryptionResponse {
920
920
  set signature(arg0) {
921
921
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
922
922
  const len0 = WASM_VECTOR_LEN;
923
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
923
+ wasm.__wbg_set_userdecryptionresponse_signature(this.__wbg_ptr, ptr0, len0);
924
924
  }
925
925
  }
926
926
  if (Symbol.dispose) UserDecryptionResponse.prototype[Symbol.dispose] = UserDecryptionResponse.prototype.free;
@@ -1012,7 +1012,7 @@ export class UserDecryptionResponsePayload {
1012
1012
  set digest(arg0) {
1013
1013
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1014
1014
  const len0 = WASM_VECTOR_LEN;
1015
- wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1015
+ wasm.__wbg_set_userdecryptionresponsepayload_digest(this.__wbg_ptr, ptr0, len0);
1016
1016
  }
1017
1017
  /**
1018
1018
  * The ID of the MPC party doing the user decryption. Used for polynomial
@@ -1042,7 +1042,7 @@ export class UserDecryptionResponsePayload {
1042
1042
  set verification_key(arg0) {
1043
1043
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1044
1044
  const len0 = WASM_VECTOR_LEN;
1045
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1045
+ wasm.__wbg_set_userdecryptionresponsepayload_verification_key(this.__wbg_ptr, ptr0, len0);
1046
1046
  }
1047
1047
  }
1048
1048
  if (Symbol.dispose) UserDecryptionResponsePayload.prototype[Symbol.dispose] = UserDecryptionResponsePayload.prototype.free;
@@ -1268,6 +1268,9 @@ export function private_sig_key_to_u8vec(sk) {
1268
1268
  *
1269
1269
  * * `enc_sk` - The ephemeral secret key.
1270
1270
  *
1271
+ * * `threshold` - Optional threshold override for reconstruction.
1272
+ * If not provided, it is computed from the number of server addresses as `(n - 1) / 3`.
1273
+ *
1271
1274
  * * `verify` - Whether to perform signature verification for the response.
1272
1275
  * It is insecure if `verify = false`!
1273
1276
  * @param {Client} client
@@ -1276,10 +1279,11 @@ export function private_sig_key_to_u8vec(sk) {
1276
1279
  * @param {UserDecryptionResponse[]} agg_resp
1277
1280
  * @param {PublicEncKeyMlKem512} enc_pk
1278
1281
  * @param {PrivateEncKeyMlKem512} enc_sk
1282
+ * @param {number | null | undefined} threshold
1279
1283
  * @param {boolean} verify
1280
1284
  * @returns {TypedPlaintext[]}
1281
1285
  */
1282
- export function process_user_decryption_resp(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
1286
+ export function process_user_decryption_resp(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, threshold, verify) {
1283
1287
  _assertClass(client, Client);
1284
1288
  let ptr0 = 0;
1285
1289
  if (!isLikeNone(request)) {
@@ -1295,7 +1299,7 @@ export function process_user_decryption_resp(client, request, eip712_domain, agg
1295
1299
  const len2 = WASM_VECTOR_LEN;
1296
1300
  _assertClass(enc_pk, PublicEncKeyMlKem512);
1297
1301
  _assertClass(enc_sk, PrivateEncKeyMlKem512);
1298
- const ret = wasm.process_user_decryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
1302
+ const ret = wasm.process_user_decryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, isLikeNone(threshold) ? 0x100000001 : (threshold) >>> 0, verify);
1299
1303
  if (ret[3]) {
1300
1304
  throw takeFromExternrefTable0(ret[2]);
1301
1305
  }
@@ -1362,6 +1366,11 @@ export function process_user_decryption_resp(client, request, eip712_domain, agg
1362
1366
  *
1363
1367
  * * `enc_sk` - The ephemeral secret key.
1364
1368
  *
1369
+ * * `threshold` - Optional expected threshold/degree used during response validation.
1370
+ * Validation requires at least `threshold + 1` matching responses, and the selected pivot
1371
+ * response must have `degree == threshold`. If not provided, it is computed from the number
1372
+ * of server addresses as `(n - 1) / 3`.
1373
+ *
1365
1374
  * * `verify` - Whether to perform signature verification for the response.
1366
1375
  * It is insecure if `verify = false`!
1367
1376
  * @param {Client} client
@@ -1370,14 +1379,15 @@ export function process_user_decryption_resp(client, request, eip712_domain, agg
1370
1379
  * @param {any} agg_resp
1371
1380
  * @param {PublicEncKeyMlKem512} enc_pk
1372
1381
  * @param {PrivateEncKeyMlKem512} enc_sk
1382
+ * @param {number | null | undefined} threshold
1373
1383
  * @param {boolean} verify
1374
1384
  * @returns {TypedPlaintext[]}
1375
1385
  */
1376
- export function process_user_decryption_resp_from_js(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
1386
+ export function process_user_decryption_resp_from_js(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, threshold, verify) {
1377
1387
  _assertClass(client, Client);
1378
1388
  _assertClass(enc_pk, PublicEncKeyMlKem512);
1379
1389
  _assertClass(enc_sk, PrivateEncKeyMlKem512);
1380
- const ret = wasm.process_user_decryption_resp_from_js(client.__wbg_ptr, request, eip712_domain, agg_resp, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
1390
+ 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, isLikeNone(threshold) ? 0x100000001 : (threshold) >>> 0, verify);
1381
1391
  if (ret[3]) {
1382
1392
  throw takeFromExternrefTable0(ret[2]);
1383
1393
  }
@@ -1457,69 +1467,69 @@ export function u8vec_to_public_sig_key(v) {
1457
1467
  function __wbg_get_imports() {
1458
1468
  const import0 = {
1459
1469
  __proto__: null,
1460
- __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
1470
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
1461
1471
  const ret = Error(getStringFromWasm0(arg0, arg1));
1462
1472
  return ret;
1463
1473
  },
1464
- __wbg_Number_04624de7d0e8332d: function(arg0) {
1474
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
1465
1475
  const ret = Number(arg0);
1466
1476
  return ret;
1467
1477
  },
1468
- __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
1478
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
1469
1479
  const ret = String(arg1);
1470
1480
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1471
1481
  const len1 = WASM_VECTOR_LEN;
1472
1482
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1473
1483
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1474
1484
  },
1475
- __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
1485
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
1476
1486
  const v = arg0;
1477
1487
  const ret = typeof(v) === 'boolean' ? v : undefined;
1478
1488
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1479
1489
  },
1480
- __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
1490
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
1481
1491
  const ret = debugString(arg1);
1482
1492
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1483
1493
  const len1 = WASM_VECTOR_LEN;
1484
1494
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1485
1495
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1486
1496
  },
1487
- __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
1497
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
1488
1498
  const ret = arg0 in arg1;
1489
1499
  return ret;
1490
1500
  },
1491
- __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
1501
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
1492
1502
  const ret = typeof(arg0) === 'function';
1493
1503
  return ret;
1494
1504
  },
1495
- __wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {
1505
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
1496
1506
  const ret = arg0 === null;
1497
1507
  return ret;
1498
1508
  },
1499
- __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
1509
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
1500
1510
  const val = arg0;
1501
1511
  const ret = typeof(val) === 'object' && val !== null;
1502
1512
  return ret;
1503
1513
  },
1504
- __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
1514
+ __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
1505
1515
  const ret = typeof(arg0) === 'string';
1506
1516
  return ret;
1507
1517
  },
1508
- __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
1518
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
1509
1519
  const ret = arg0 === undefined;
1510
1520
  return ret;
1511
1521
  },
1512
- __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
1522
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
1513
1523
  const ret = arg0 == arg1;
1514
1524
  return ret;
1515
1525
  },
1516
- __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
1526
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
1517
1527
  const obj = arg1;
1518
1528
  const ret = typeof(obj) === 'number' ? obj : undefined;
1519
1529
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1520
1530
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1521
1531
  },
1522
- __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
1532
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
1523
1533
  const obj = arg1;
1524
1534
  const ret = typeof(obj) === 'string' ? obj : undefined;
1525
1535
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1527,26 +1537,26 @@ function __wbg_get_imports() {
1527
1537
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1528
1538
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1529
1539
  },
1530
- __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
1540
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
1531
1541
  throw new Error(getStringFromWasm0(arg0, arg1));
1532
1542
  },
1533
- __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
1534
- const ret = arg0.call(arg1);
1543
+ __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
1544
+ const ret = arg0.call(arg1, arg2);
1535
1545
  return ret;
1536
1546
  }, arguments); },
1537
- __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
1538
- const ret = arg0.call(arg1, arg2);
1547
+ __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
1548
+ const ret = arg0.call(arg1);
1539
1549
  return ret;
1540
1550
  }, arguments); },
1541
- __wbg_crypto_ed58b8e10a292839: function(arg0) {
1551
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
1542
1552
  const ret = arg0.crypto;
1543
1553
  return ret;
1544
1554
  },
1545
- __wbg_done_57b39ecd9addfe81: function(arg0) {
1555
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
1546
1556
  const ret = arg0.done;
1547
1557
  return ret;
1548
1558
  },
1549
- __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
1559
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
1550
1560
  let deferred0_0;
1551
1561
  let deferred0_1;
1552
1562
  try {
@@ -1557,22 +1567,22 @@ function __wbg_get_imports() {
1557
1567
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1558
1568
  }
1559
1569
  },
1560
- __wbg_getRandomValues_bcb4912f16000dc4: function() { return handleError(function (arg0, arg1) {
1570
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
1561
1571
  arg0.getRandomValues(arg1);
1562
1572
  }, arguments); },
1563
- __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
1564
- const ret = arg0[arg1 >>> 0];
1565
- return ret;
1566
- },
1567
- __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
1573
+ __wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
1568
1574
  const ret = Reflect.get(arg0, arg1);
1569
1575
  return ret;
1570
1576
  }, arguments); },
1571
- __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
1577
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
1578
+ const ret = arg0[arg1 >>> 0];
1579
+ return ret;
1580
+ },
1581
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
1572
1582
  const ret = arg0[arg1];
1573
1583
  return ret;
1574
1584
  },
1575
- __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
1585
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
1576
1586
  let result;
1577
1587
  try {
1578
1588
  result = arg0 instanceof ArrayBuffer;
@@ -1582,7 +1592,7 @@ function __wbg_get_imports() {
1582
1592
  const ret = result;
1583
1593
  return ret;
1584
1594
  },
1585
- __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
1595
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
1586
1596
  let result;
1587
1597
  try {
1588
1598
  result = arg0 instanceof Uint8Array;
@@ -1592,69 +1602,65 @@ function __wbg_get_imports() {
1592
1602
  const ret = result;
1593
1603
  return ret;
1594
1604
  },
1595
- __wbg_isArray_d314bb98fcf08331: function(arg0) {
1605
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
1596
1606
  const ret = Array.isArray(arg0);
1597
1607
  return ret;
1598
1608
  },
1599
- __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
1609
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
1600
1610
  const ret = Number.isSafeInteger(arg0);
1601
1611
  return ret;
1602
1612
  },
1603
- __wbg_iterator_6ff6560ca1568e55: function() {
1613
+ __wbg_iterator_d8f549ec8fb061b1: function() {
1604
1614
  const ret = Symbol.iterator;
1605
1615
  return ret;
1606
1616
  },
1607
- __wbg_length_32ed9a279acd054c: function(arg0) {
1617
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
1608
1618
  const ret = arg0.length;
1609
1619
  return ret;
1610
1620
  },
1611
- __wbg_length_35a7bace40f36eac: function(arg0) {
1621
+ __wbg_length_ea16607d7b61445b: function(arg0) {
1612
1622
  const ret = arg0.length;
1613
1623
  return ret;
1614
1624
  },
1615
- __wbg_msCrypto_0a36e2ec3a343d26: function(arg0) {
1625
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
1616
1626
  const ret = arg0.msCrypto;
1617
1627
  return ret;
1618
1628
  },
1619
- __wbg_new_8a6f238a6ece86ea: function() {
1629
+ __wbg_new_227d7c05414eb861: function() {
1620
1630
  const ret = new Error();
1621
1631
  return ret;
1622
1632
  },
1623
- __wbg_new_dd2b680c8bf6ae29: function(arg0) {
1633
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
1624
1634
  const ret = new Uint8Array(arg0);
1625
1635
  return ret;
1626
1636
  },
1627
- __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
1628
- const ret = new Function(getStringFromWasm0(arg0, arg1));
1629
- return ret;
1630
- },
1631
- __wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
1637
+ __wbg_new_with_length_825018a1616e9e55: function(arg0) {
1632
1638
  const ret = new Uint8Array(arg0 >>> 0);
1633
1639
  return ret;
1634
1640
  },
1635
- __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
1641
+ __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
1636
1642
  const ret = arg0.next();
1637
1643
  return ret;
1638
1644
  }, arguments); },
1639
- __wbg_next_418f80d8f5303233: function(arg0) {
1645
+ __wbg_next_e01a967809d1aa68: function(arg0) {
1640
1646
  const ret = arg0.next;
1641
1647
  return ret;
1642
1648
  },
1643
- __wbg_node_02999533c4ea02e3: function(arg0) {
1649
+ __wbg_node_84ea875411254db1: function(arg0) {
1644
1650
  const ret = arg0.node;
1645
1651
  return ret;
1646
1652
  },
1647
- __wbg_process_5c1d670bc53614b8: function(arg0) {
1653
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
1648
1654
  const ret = arg0.process;
1649
1655
  return ret;
1650
1656
  },
1651
- __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
1657
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
1652
1658
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1653
1659
  },
1654
- __wbg_randomFillSync_ab2cfe79ebbf2740: function() { return handleError(function (arg0, arg1) {
1660
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
1655
1661
  arg0.randomFillSync(arg1);
1656
1662
  }, arguments); },
1657
- __wbg_require_79b1e9274cde3c87: function() { return handleError(function () {
1663
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
1658
1664
  const ret = module.require;
1659
1665
  return ret;
1660
1666
  }, arguments); },
@@ -1666,30 +1672,30 @@ function __wbg_get_imports() {
1666
1672
  const ret = ServerIdAddr.__unwrap(arg0);
1667
1673
  return ret;
1668
1674
  },
1669
- __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
1675
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1670
1676
  const ret = arg1.stack;
1671
1677
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1672
1678
  const len1 = WASM_VECTOR_LEN;
1673
1679
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1674
1680
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1675
1681
  },
1676
- __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
1682
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
1677
1683
  const ret = typeof global === 'undefined' ? null : global;
1678
1684
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1679
1685
  },
1680
- __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
1686
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
1681
1687
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
1682
1688
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1683
1689
  },
1684
- __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
1690
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
1685
1691
  const ret = typeof self === 'undefined' ? null : self;
1686
1692
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1687
1693
  },
1688
- __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
1694
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
1689
1695
  const ret = typeof window === 'undefined' ? null : window;
1690
1696
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1691
1697
  },
1692
- __wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
1698
+ __wbg_subarray_a068d24e39478a8a: function(arg0, arg1, arg2) {
1693
1699
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1694
1700
  return ret;
1695
1701
  },
@@ -1717,11 +1723,11 @@ function __wbg_get_imports() {
1717
1723
  const ret = UserDecryptionResponse.__unwrap(arg0);
1718
1724
  return ret;
1719
1725
  },
1720
- __wbg_value_0546255b415e96c1: function(arg0) {
1726
+ __wbg_value_21fc78aab0322612: function(arg0) {
1721
1727
  const ret = arg0.value;
1722
1728
  return ret;
1723
1729
  },
1724
- __wbg_versions_c71aa1626a93e0a1: function(arg0) {
1730
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
1725
1731
  const ret = arg0.versions;
1726
1732
  return ret;
1727
1733
  },
package/kms_lib_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Zama"
6
6
  ],
7
7
  "description": "Key Management System for the Zama Protocol.",
8
- "version": "v0.13.10",
8
+ "version": "v0.13.20",
9
9
  "license": "BSD-3-Clause-Clear",
10
10
  "repository": {
11
11
  "type": "git",