@cofhe/sdk 0.5.1 → 0.5.2

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/dist/web.cjs CHANGED
@@ -2844,6 +2844,96 @@ function computeMinuteRampPollIntervalMs(elapsedMs, params) {
2844
2844
  return Math.min(params.maxIntervalMs, Math.max(params.minIntervalMs, intervalMs));
2845
2845
  }
2846
2846
 
2847
+ // core/decrypt/submitRetry.ts
2848
+ var DEFAULT_404_RETRY_TIMEOUT_MS = 1e4;
2849
+ function isRetryableSubmitStatus(status) {
2850
+ return status === 204 || status === 404;
2851
+ }
2852
+ function normalize404RetryTimeoutMs(params) {
2853
+ const { timeoutMs, operationLabel, errorCode } = params;
2854
+ if (timeoutMs === void 0)
2855
+ return DEFAULT_404_RETRY_TIMEOUT_MS;
2856
+ if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
2857
+ throw new CofheError({
2858
+ code: errorCode,
2859
+ message: `${operationLabel} submit 404 retry timeout must be a finite number greater than or equal to 0`,
2860
+ context: {
2861
+ timeoutMs
2862
+ }
2863
+ });
2864
+ }
2865
+ return timeoutMs;
2866
+ }
2867
+ async function classifySubmitResponse(params) {
2868
+ const { response, extractErrorMessage } = params;
2869
+ if (isRetryableSubmitStatus(response.status)) {
2870
+ return { kind: "retryable", status: response.status };
2871
+ }
2872
+ if (response.ok) {
2873
+ return { kind: "parse-json" };
2874
+ }
2875
+ let errorMessage = `HTTP ${response.status}`;
2876
+ try {
2877
+ const errorBody = await response.json();
2878
+ const maybeErrorMessage = extractErrorMessage?.(errorBody);
2879
+ if (typeof maybeErrorMessage === "string" && maybeErrorMessage.length > 0) {
2880
+ errorMessage = maybeErrorMessage;
2881
+ } else if (errorBody && typeof errorBody === "object") {
2882
+ const defaultMessage = errorBody.error_message;
2883
+ const fallbackMessage = errorBody.message;
2884
+ if (typeof defaultMessage === "string" && defaultMessage.length > 0) {
2885
+ errorMessage = defaultMessage;
2886
+ } else if (typeof fallbackMessage === "string" && fallbackMessage.length > 0) {
2887
+ errorMessage = fallbackMessage;
2888
+ }
2889
+ }
2890
+ } catch {
2891
+ errorMessage = response.statusText || errorMessage;
2892
+ }
2893
+ return { kind: "fatal-http", errorMessage };
2894
+ }
2895
+ function throwIfSubmitRetryTimedOut(params) {
2896
+ const {
2897
+ operationLabel,
2898
+ errorCode,
2899
+ status,
2900
+ elapsedMs,
2901
+ retry404TimeoutMs,
2902
+ overallTimeoutMs,
2903
+ thresholdNetworkUrl,
2904
+ body,
2905
+ attemptIndex
2906
+ } = params;
2907
+ if (status === 404 && elapsedMs > retry404TimeoutMs) {
2908
+ throw new CofheError({
2909
+ code: errorCode,
2910
+ message: `${operationLabel} submit retried 404 responses without receiving request_id for ${retry404TimeoutMs}ms`,
2911
+ hint: "The ciphertext may not be indexed yet. Increase set404RetryTimeout(...) if the backend is slow to index ciphertexts.",
2912
+ context: {
2913
+ thresholdNetworkUrl,
2914
+ body,
2915
+ attemptIndex,
2916
+ timeoutMs: retry404TimeoutMs,
2917
+ status
2918
+ }
2919
+ });
2920
+ }
2921
+ if (elapsedMs > overallTimeoutMs) {
2922
+ throw new CofheError({
2923
+ code: errorCode,
2924
+ message: `${operationLabel} submit retried without receiving request_id for ${overallTimeoutMs}ms`,
2925
+ hint: "The ciphertext may still be propagating. Try again later.",
2926
+ context: {
2927
+ thresholdNetworkUrl,
2928
+ body,
2929
+ attemptIndex,
2930
+ timeoutMs: overallTimeoutMs,
2931
+ status
2932
+ }
2933
+ });
2934
+ }
2935
+ }
2936
+
2847
2937
  // core/decrypt/tnSealOutputV2.ts
2848
2938
  var POLL_INTERVAL_MS = 1e3;
2849
2939
  var POLL_MAX_INTERVAL_MS = 1e4;
@@ -2905,7 +2995,7 @@ function parseCompletedSealOutputResponse(params) {
2905
2995
  }
2906
2996
  return convertSealedData(sealed);
2907
2997
  }
2908
- async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, permission, overallStartTime, onPoll) {
2998
+ async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, permission, overallStartTime, retry404TimeoutMs, onPoll) {
2909
2999
  const body = {
2910
3000
  ct_tempkey: BigInt(ctHash).toString(16).padStart(64, "0"),
2911
3001
  host_chain_id: chainId,
@@ -2935,17 +3025,11 @@ async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, per
2935
3025
  }
2936
3026
  });
2937
3027
  }
2938
- if (!response.ok) {
2939
- let errorMessage = `HTTP ${response.status}`;
2940
- try {
2941
- const errorBody = await response.json();
2942
- errorMessage = errorBody.error_message || errorBody.message || errorMessage;
2943
- } catch {
2944
- errorMessage = response.statusText || errorMessage;
2945
- }
3028
+ const responseClassification = await classifySubmitResponse({ response });
3029
+ if (responseClassification.kind === "fatal-http") {
2946
3030
  throw new CofheError({
2947
3031
  code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
2948
- message: `sealOutput request failed: ${errorMessage}`,
3032
+ message: `sealOutput request failed: ${responseClassification.errorMessage}`,
2949
3033
  hint: "Check the threshold network URL and request parameters.",
2950
3034
  context: {
2951
3035
  thresholdNetworkUrl,
@@ -2956,8 +3040,8 @@ async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, per
2956
3040
  }
2957
3041
  });
2958
3042
  }
2959
- let submitResponse;
2960
- if (response.status !== 204) {
3043
+ if (responseClassification.kind === "parse-json") {
3044
+ let submitResponse;
2961
3045
  try {
2962
3046
  submitResponse = await response.json();
2963
3047
  } catch (e) {
@@ -2985,46 +3069,39 @@ async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, per
2985
3069
  if (submitResponse.request_id) {
2986
3070
  return { kind: "request_id", requestId: submitResponse.request_id };
2987
3071
  }
2988
- }
2989
- if (response.status === 204) {
2990
- const elapsedMs = Date.now() - overallStartTime;
2991
- if (elapsedMs > SEAL_OUTPUT_TIMEOUT_MS) {
2992
- throw new CofheError({
2993
- code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
2994
- message: `sealOutput submit retried without receiving request_id for ${SEAL_OUTPUT_TIMEOUT_MS}ms`,
2995
- hint: "The ciphertext may still be propagating. Try again later.",
2996
- context: {
2997
- thresholdNetworkUrl,
2998
- body,
2999
- attemptIndex,
3000
- timeoutMs: SEAL_OUTPUT_TIMEOUT_MS,
3001
- submitResponse,
3002
- status: response.status
3003
- }
3004
- });
3005
- }
3006
- onPoll?.({
3007
- operation: "sealoutput",
3008
- requestId: "",
3009
- attemptIndex,
3010
- elapsedMs,
3011
- intervalMs: SUBMIT_RETRY_INTERVAL_MS,
3012
- timeoutMs: SEAL_OUTPUT_TIMEOUT_MS
3072
+ throw new CofheError({
3073
+ code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
3074
+ message: `sealOutput submit response missing request_id`,
3075
+ context: {
3076
+ thresholdNetworkUrl,
3077
+ body,
3078
+ submitResponse,
3079
+ attemptIndex
3080
+ }
3013
3081
  });
3014
- await new Promise((resolve) => setTimeout(resolve, SUBMIT_RETRY_INTERVAL_MS));
3015
- attemptIndex += 1;
3016
- continue;
3017
3082
  }
3018
- throw new CofheError({
3019
- code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
3020
- message: `sealOutput submit response missing request_id`,
3021
- context: {
3022
- thresholdNetworkUrl,
3023
- body,
3024
- submitResponse,
3025
- attemptIndex
3026
- }
3083
+ const elapsedMs = Date.now() - overallStartTime;
3084
+ throwIfSubmitRetryTimedOut({
3085
+ operationLabel: "sealOutput",
3086
+ errorCode: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
3087
+ status: responseClassification.status,
3088
+ elapsedMs,
3089
+ retry404TimeoutMs,
3090
+ overallTimeoutMs: SEAL_OUTPUT_TIMEOUT_MS,
3091
+ thresholdNetworkUrl,
3092
+ body,
3093
+ attemptIndex
3027
3094
  });
3095
+ onPoll?.({
3096
+ operation: "sealoutput",
3097
+ requestId: "",
3098
+ attemptIndex,
3099
+ elapsedMs,
3100
+ intervalMs: SUBMIT_RETRY_INTERVAL_MS,
3101
+ timeoutMs: SEAL_OUTPUT_TIMEOUT_MS
3102
+ });
3103
+ await new Promise((resolve) => setTimeout(resolve, SUBMIT_RETRY_INTERVAL_MS));
3104
+ attemptIndex += 1;
3028
3105
  }
3029
3106
  }
3030
3107
  async function pollSealOutputStatus(thresholdNetworkUrl, requestId, overallStartTime, onPoll) {
@@ -3139,7 +3216,12 @@ async function pollSealOutputStatus(thresholdNetworkUrl, requestId, overallStart
3139
3216
  });
3140
3217
  }
3141
3218
  async function tnSealOutputV2(params) {
3142
- const { thresholdNetworkUrl, ctHash, chainId, permission, onPoll } = params;
3219
+ const { thresholdNetworkUrl, ctHash, chainId, permission, retry404TimeoutMs, onPoll } = params;
3220
+ const normalized404RetryTimeoutMs = normalize404RetryTimeoutMs({
3221
+ timeoutMs: retry404TimeoutMs,
3222
+ operationLabel: "sealOutput",
3223
+ errorCode: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */
3224
+ });
3143
3225
  const overallStartTime = Date.now();
3144
3226
  const submitResult = await submitSealOutputRequest(
3145
3227
  thresholdNetworkUrl,
@@ -3147,6 +3229,7 @@ async function tnSealOutputV2(params) {
3147
3229
  chainId,
3148
3230
  permission,
3149
3231
  overallStartTime,
3232
+ normalized404RetryTimeoutMs,
3150
3233
  onPoll
3151
3234
  );
3152
3235
  if (submitResult.kind === "completed") {
@@ -3156,12 +3239,14 @@ async function tnSealOutputV2(params) {
3156
3239
  }
3157
3240
 
3158
3241
  // core/decrypt/decryptForViewBuilder.ts
3242
+ var DEFAULT_404_RETRY_TIMEOUT_MS2 = 1e4;
3159
3243
  var DecryptForViewBuilder = class extends BaseBuilder {
3160
3244
  ctHash;
3161
3245
  utype;
3162
3246
  permitHash;
3163
3247
  permit;
3164
3248
  pollCallback;
3249
+ retry404TimeoutMs = DEFAULT_404_RETRY_TIMEOUT_MS2;
3165
3250
  constructor(params) {
3166
3251
  super({
3167
3252
  config: params.config,
@@ -3222,6 +3307,19 @@ var DecryptForViewBuilder = class extends BaseBuilder {
3222
3307
  this.pollCallback = callback;
3223
3308
  return this;
3224
3309
  }
3310
+ set404RetryTimeout(timeoutMs) {
3311
+ if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
3312
+ throw new CofheError({
3313
+ code: "INTERNAL_ERROR" /* InternalError */,
3314
+ message: "decryptForView: set404RetryTimeout(timeoutMs) expects a finite number greater than or equal to 0.",
3315
+ context: {
3316
+ timeoutMs
3317
+ }
3318
+ });
3319
+ }
3320
+ this.retry404TimeoutMs = timeoutMs;
3321
+ return this;
3322
+ }
3225
3323
  withPermit(permitOrPermitHash) {
3226
3324
  if (typeof permitOrPermitHash === "string") {
3227
3325
  this.permitHash = permitOrPermitHash;
@@ -3350,6 +3448,7 @@ var DecryptForViewBuilder = class extends BaseBuilder {
3350
3448
  chainId: this.chainId,
3351
3449
  permission,
3352
3450
  thresholdNetworkUrl,
3451
+ retry404TimeoutMs: this.retry404TimeoutMs,
3353
3452
  onPoll: this.pollCallback
3354
3453
  });
3355
3454
  return PermitUtils.unseal(permit, sealed);
@@ -3625,7 +3724,7 @@ function assertDecryptStatusResponseV2(value) {
3625
3724
  }
3626
3725
  return value;
3627
3726
  }
3628
- async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, permission, overallStartTime, onPoll) {
3727
+ async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, permission, overallStartTime, retry404TimeoutMs, onPoll) {
3629
3728
  const body = {
3630
3729
  ct_tempkey: BigInt(ctHash).toString(16).padStart(64, "0"),
3631
3730
  host_chain_id: chainId
@@ -3657,19 +3756,11 @@ async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, perm
3657
3756
  }
3658
3757
  });
3659
3758
  }
3660
- if (!response.ok) {
3661
- let errorMessage = `HTTP ${response.status}`;
3662
- try {
3663
- const errorBody = await response.json();
3664
- const maybeMessage = errorBody.error_message || errorBody.message;
3665
- if (typeof maybeMessage === "string" && maybeMessage.length > 0)
3666
- errorMessage = maybeMessage;
3667
- } catch {
3668
- errorMessage = response.statusText || errorMessage;
3669
- }
3759
+ const responseClassification = await classifySubmitResponse({ response });
3760
+ if (responseClassification.kind === "fatal-http") {
3670
3761
  throw new CofheError({
3671
3762
  code: "DECRYPT_FAILED" /* DecryptFailed */,
3672
- message: `decrypt request failed: ${errorMessage}`,
3763
+ message: `decrypt request failed: ${responseClassification.errorMessage}`,
3673
3764
  hint: "Check the threshold network URL and request parameters.",
3674
3765
  context: {
3675
3766
  thresholdNetworkUrl,
@@ -3680,8 +3771,8 @@ async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, perm
3680
3771
  }
3681
3772
  });
3682
3773
  }
3683
- let submitResponse;
3684
- if (response.status !== 204) {
3774
+ if (responseClassification.kind === "parse-json") {
3775
+ let submitResponse;
3685
3776
  let rawJson;
3686
3777
  try {
3687
3778
  rawJson = await response.json();
@@ -3711,46 +3802,39 @@ async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, perm
3711
3802
  if (submitResponse.request_id) {
3712
3803
  return { kind: "request_id", requestId: submitResponse.request_id };
3713
3804
  }
3714
- }
3715
- if (response.status === 204) {
3716
- const elapsedMs = Date.now() - overallStartTime;
3717
- if (elapsedMs > DECRYPT_TIMEOUT_MS) {
3718
- throw new CofheError({
3719
- code: "DECRYPT_FAILED" /* DecryptFailed */,
3720
- message: `decrypt submit retried without receiving request_id for ${DECRYPT_TIMEOUT_MS}ms`,
3721
- hint: "The ciphertext may still be propagating. Try again later.",
3722
- context: {
3723
- thresholdNetworkUrl,
3724
- body,
3725
- attemptIndex,
3726
- timeoutMs: DECRYPT_TIMEOUT_MS,
3727
- submitResponse,
3728
- status: response.status
3729
- }
3730
- });
3731
- }
3732
- onPoll?.({
3733
- operation: "decrypt",
3734
- requestId: "",
3735
- attemptIndex,
3736
- elapsedMs,
3737
- intervalMs: SUBMIT_RETRY_INTERVAL_MS2,
3738
- timeoutMs: DECRYPT_TIMEOUT_MS
3805
+ throw new CofheError({
3806
+ code: "DECRYPT_FAILED" /* DecryptFailed */,
3807
+ message: `decrypt submit response missing request_id`,
3808
+ context: {
3809
+ thresholdNetworkUrl,
3810
+ body,
3811
+ submitResponse,
3812
+ attemptIndex
3813
+ }
3739
3814
  });
3740
- await new Promise((resolve) => setTimeout(resolve, SUBMIT_RETRY_INTERVAL_MS2));
3741
- attemptIndex += 1;
3742
- continue;
3743
3815
  }
3744
- throw new CofheError({
3745
- code: "DECRYPT_FAILED" /* DecryptFailed */,
3746
- message: `decrypt submit response missing request_id`,
3747
- context: {
3748
- thresholdNetworkUrl,
3749
- body,
3750
- submitResponse,
3751
- attemptIndex
3752
- }
3816
+ const elapsedMs = Date.now() - overallStartTime;
3817
+ throwIfSubmitRetryTimedOut({
3818
+ operationLabel: "decrypt",
3819
+ errorCode: "DECRYPT_FAILED" /* DecryptFailed */,
3820
+ status: responseClassification.status,
3821
+ elapsedMs,
3822
+ retry404TimeoutMs,
3823
+ overallTimeoutMs: DECRYPT_TIMEOUT_MS,
3824
+ thresholdNetworkUrl,
3825
+ body,
3826
+ attemptIndex
3753
3827
  });
3828
+ onPoll?.({
3829
+ operation: "decrypt",
3830
+ requestId: "",
3831
+ attemptIndex,
3832
+ elapsedMs,
3833
+ intervalMs: SUBMIT_RETRY_INTERVAL_MS2,
3834
+ timeoutMs: DECRYPT_TIMEOUT_MS
3835
+ });
3836
+ await new Promise((resolve) => setTimeout(resolve, SUBMIT_RETRY_INTERVAL_MS2));
3837
+ attemptIndex += 1;
3754
3838
  }
3755
3839
  }
3756
3840
  async function pollDecryptStatusV2(thresholdNetworkUrl, requestId, overallStartTime, onPoll) {
@@ -3868,7 +3952,12 @@ async function pollDecryptStatusV2(thresholdNetworkUrl, requestId, overallStartT
3868
3952
  });
3869
3953
  }
3870
3954
  async function tnDecryptV2(params) {
3871
- const { thresholdNetworkUrl, ctHash, chainId, permission, onPoll } = params;
3955
+ const { thresholdNetworkUrl, ctHash, chainId, permission, retry404TimeoutMs, onPoll } = params;
3956
+ const normalized404RetryTimeoutMs = normalize404RetryTimeoutMs({
3957
+ timeoutMs: retry404TimeoutMs,
3958
+ operationLabel: "decrypt",
3959
+ errorCode: "DECRYPT_FAILED" /* DecryptFailed */
3960
+ });
3872
3961
  const overallStartTime = Date.now();
3873
3962
  const submitResult = await submitDecryptRequestV2(
3874
3963
  thresholdNetworkUrl,
@@ -3876,6 +3965,7 @@ async function tnDecryptV2(params) {
3876
3965
  chainId,
3877
3966
  permission,
3878
3967
  overallStartTime,
3968
+ normalized404RetryTimeoutMs,
3879
3969
  onPoll
3880
3970
  );
3881
3971
  if (submitResult.kind === "completed") {
@@ -3885,12 +3975,14 @@ async function tnDecryptV2(params) {
3885
3975
  }
3886
3976
 
3887
3977
  // core/decrypt/decryptForTxBuilder.ts
3978
+ var DEFAULT_404_RETRY_TIMEOUT_MS3 = 1e4;
3888
3979
  var DecryptForTxBuilder = class extends BaseBuilder {
3889
3980
  ctHash;
3890
3981
  permitHash;
3891
3982
  permit;
3892
3983
  permitSelection = "unset";
3893
3984
  pollCallback;
3985
+ retry404TimeoutMs = DEFAULT_404_RETRY_TIMEOUT_MS3;
3894
3986
  constructor(params) {
3895
3987
  super({
3896
3988
  config: params.config,
@@ -3920,6 +4012,19 @@ var DecryptForTxBuilder = class extends BaseBuilder {
3920
4012
  this.pollCallback = callback;
3921
4013
  return this;
3922
4014
  }
4015
+ set404RetryTimeout(timeoutMs) {
4016
+ if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
4017
+ throw new CofheError({
4018
+ code: "INTERNAL_ERROR" /* InternalError */,
4019
+ message: "decryptForTx: set404RetryTimeout(timeoutMs) expects a finite number greater than or equal to 0.",
4020
+ context: {
4021
+ timeoutMs
4022
+ }
4023
+ });
4024
+ }
4025
+ this.retry404TimeoutMs = timeoutMs;
4026
+ return this;
4027
+ }
3923
4028
  withPermit(permitOrPermitHash) {
3924
4029
  if (this.permitSelection === "with-permit") {
3925
4030
  throw new CofheError({
@@ -4052,6 +4157,7 @@ var DecryptForTxBuilder = class extends BaseBuilder {
4052
4157
  chainId: this.chainId,
4053
4158
  permission,
4054
4159
  thresholdNetworkUrl,
4160
+ retry404TimeoutMs: this.retry404TimeoutMs,
4055
4161
  onPoll: this.pollCallback
4056
4162
  });
4057
4163
  return {
package/dist/web.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-BSbwairE.cjs';
1
+ import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-BJbFeeno.cjs';
2
2
  import 'viem';
3
3
  import './types-C07FK-cL.cjs';
4
4
  import 'zod';
package/dist/web.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-DDmcgZ0a.js';
1
+ import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-CEno_BEf.js';
2
2
  import 'viem';
3
3
  import './types-C07FK-cL.js';
4
4
  import 'zod';
package/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createCofheConfigBase, createCofheClientBase, fheTypeToString } from './chunk-S7OKGLFD.js';
1
+ import { createCofheConfigBase, createCofheClientBase, fheTypeToString } from './chunk-YDOK4BDL.js';
2
2
  import './chunk-TBLR7NNE.js';
3
3
  import './chunk-MRCKUMOS.js';
4
4
  import { TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT } from './chunk-4FP4V35O.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofhe/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "description": "SDK for Fhenix COFHE coprocessor interaction",
6
6
  "main": "./dist/core.cjs",
@@ -53,10 +53,10 @@ describe('@cofhe/web - TFHE Initialization Browser Tests', () => {
53
53
  await cofheClient.connect(publicClient, walletClient);
54
54
 
55
55
  // First encryption
56
- expect(cofheClient.encryptInputs([Encryptable.uint128(100n)]).execute()).resolves.not.toThrow();
56
+ await expect(cofheClient.encryptInputs([Encryptable.uint128(100n)]).execute()).resolves.not.toThrow();
57
57
 
58
58
  // Second encryption should reuse initialization
59
- expect(cofheClient.encryptInputs([Encryptable.uint64(50n)]).execute()).resolves.not.toThrow();
60
- }, 60000);
59
+ await expect(cofheClient.encryptInputs([Encryptable.uint64(50n)]).execute()).resolves.not.toThrow();
60
+ }, 120000);
61
61
  });
62
62
  });