@cofhe/sdk 0.3.2 → 0.5.0

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/adapters/{ethers5.test.ts → test/ethers5.test.ts} +2 -2
  3. package/adapters/{ethers6.test.ts → test/ethers6.test.ts} +2 -2
  4. package/adapters/{hardhat.hh2.test.ts → test/hardhat.hh2.test.ts} +2 -2
  5. package/adapters/{index.test.ts → test/index.test.ts} +1 -1
  6. package/adapters/{wagmi.test.ts → test/wagmi.test.ts} +1 -1
  7. package/chains/{chains.test.ts → test/chains.test.ts} +1 -1
  8. package/core/client.ts +15 -5
  9. package/core/clientTypes.ts +7 -5
  10. package/core/consts.ts +9 -0
  11. package/core/decrypt/cofheMocksDecryptForTx.ts +14 -3
  12. package/core/decrypt/decryptForTxBuilder.ts +24 -10
  13. package/core/decrypt/decryptForViewBuilder.ts +14 -7
  14. package/core/decrypt/polling.ts +14 -0
  15. package/core/decrypt/tnDecryptUtils.ts +65 -0
  16. package/core/decrypt/{tnDecrypt.ts → tnDecryptV1.ts} +7 -70
  17. package/core/decrypt/tnDecryptV2.ts +483 -0
  18. package/core/decrypt/tnSealOutputV2.ts +245 -104
  19. package/core/decrypt/verifyDecryptResult.ts +65 -0
  20. package/core/encrypt/cofheMocksZkVerifySign.ts +6 -6
  21. package/core/encrypt/zkPackProveVerify.ts +10 -19
  22. package/core/fetchKeys.ts +0 -2
  23. package/core/index.ts +9 -1
  24. package/core/keyStore.ts +5 -2
  25. package/core/permits.ts +8 -3
  26. package/core/{client.test.ts → test/client.test.ts} +7 -7
  27. package/core/{config.test.ts → test/config.test.ts} +1 -1
  28. package/core/test/decrypt.test.ts +252 -0
  29. package/core/test/decryptBuilders.test.ts +390 -0
  30. package/core/{encrypt → test}/encryptInputsBuilder.test.ts +61 -6
  31. package/core/{fetchKeys.test.ts → test/fetchKeys.test.ts} +3 -3
  32. package/core/{keyStore.test.ts → test/keyStore.test.ts} +5 -3
  33. package/core/{permits.test.ts → test/permits.test.ts} +42 -1
  34. package/core/test/pollCallbacks.test.ts +563 -0
  35. package/core/types.ts +21 -0
  36. package/dist/chains.d.cts +2 -2
  37. package/dist/chains.d.ts +2 -2
  38. package/dist/chunk-4FP4V35O.js +13 -0
  39. package/dist/{chunk-NWDKXBIP.js → chunk-MRCKUMOS.js} +62 -22
  40. package/dist/{chunk-LWMRB6SD.js → chunk-S7OKGLFD.js} +615 -198
  41. package/dist/{clientTypes-Y43CKbOz.d.cts → clientTypes-BSbwairE.d.cts} +38 -13
  42. package/dist/{clientTypes-PQha8zes.d.ts → clientTypes-DDmcgZ0a.d.ts} +38 -13
  43. package/dist/core.cjs +691 -235
  44. package/dist/core.d.cts +24 -6
  45. package/dist/core.d.ts +24 -6
  46. package/dist/core.js +3 -2
  47. package/dist/node.cjs +696 -237
  48. package/dist/node.d.cts +3 -3
  49. package/dist/node.d.ts +3 -3
  50. package/dist/node.js +14 -7
  51. package/dist/{permit-MZ502UBl.d.ts → permit-DnVMDT5h.d.cts} +34 -4
  52. package/dist/{permit-MZ502UBl.d.cts → permit-DnVMDT5h.d.ts} +34 -4
  53. package/dist/permits.cjs +66 -29
  54. package/dist/permits.d.cts +18 -13
  55. package/dist/permits.d.ts +18 -13
  56. package/dist/permits.js +2 -1
  57. package/dist/web.cjs +718 -242
  58. package/dist/web.d.cts +8 -4
  59. package/dist/web.d.ts +8 -4
  60. package/dist/web.js +34 -11
  61. package/dist/zkProve.worker.cjs +6 -3
  62. package/dist/zkProve.worker.js +5 -3
  63. package/node/index.ts +13 -4
  64. package/node/test/client.test.ts +25 -0
  65. package/node/test/config.test.ts +16 -0
  66. package/node/test/inherited.test.ts +244 -0
  67. package/node/test/tfheinit.test.ts +56 -0
  68. package/package.json +24 -22
  69. package/permits/permit.ts +31 -5
  70. package/permits/sealing.ts +1 -1
  71. package/permits/{localstorage.test.ts → test/localstorage.test.ts} +2 -2
  72. package/permits/{permit.test.ts → test/permit.test.ts} +35 -1
  73. package/permits/{sealing.test.ts → test/sealing.test.ts} +1 -1
  74. package/permits/{store.test.ts → test/store.test.ts} +2 -2
  75. package/permits/{validation.test.ts → test/validation.test.ts} +82 -6
  76. package/permits/types.ts +1 -1
  77. package/permits/validation.ts +42 -2
  78. package/web/const.ts +2 -0
  79. package/web/index.ts +20 -6
  80. package/web/storage.ts +18 -3
  81. package/web/{client.web.test.ts → test/client.web.test.ts} +13 -1
  82. package/web/test/config.web.test.ts +16 -0
  83. package/web/test/inherited.web.test.ts +245 -0
  84. package/web/test/tfheinit.web.test.ts +62 -0
  85. package/web/{worker.config.web.test.ts → test/worker.config.web.test.ts} +1 -1
  86. package/web/{worker.output.web.test.ts → test/worker.output.web.test.ts} +1 -1
  87. package/web/{workerManager.test.ts → test/workerManager.test.ts} +1 -1
  88. package/web/{workerManager.web.test.ts → test/workerManager.web.test.ts} +1 -1
  89. package/web/zkProve.worker.ts +4 -3
  90. package/node/client.test.ts +0 -147
  91. package/node/config.test.ts +0 -68
  92. package/node/encryptInputs.test.ts +0 -155
  93. package/web/config.web.test.ts +0 -69
  94. package/web/encryptInputs.web.test.ts +0 -172
  95. package/web/worker.builder.web.test.ts +0 -148
  96. /package/dist/{types-YiAC4gig.d.cts → types-C07FK-cL.d.cts} +0 -0
  97. /package/dist/{types-YiAC4gig.d.ts → types-C07FK-cL.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
- import { WalletClient, PublicClient } from 'viem';
2
- import { C as CofheChain } from './types-YiAC4gig.cjs';
1
+ import { WalletClient, PublicClient, Hex } from 'viem';
2
+ import { C as CofheChain } from './types-C07FK-cL.cjs';
3
3
  import { z } from 'zod';
4
- import { P as Permit, S as SerializedPermit, C as CreateSelfPermitOptions, m as SelfPermit, d as CreateSharingPermitOptions, n as SharingPermit, I as ImportSharedPermitOptions, R as RecipientPermit, o as PermitHashFields, g as PermitUtils } from './permit-MZ502UBl.cjs';
4
+ import { P as Permit, S as SerializedPermit, C as CreateSelfPermitOptions, m as SelfPermit, d as CreateSharingPermitOptions, n as SharingPermit, I as ImportSharedPermitOptions, R as RecipientPermit, o as PermitHashFields, g as PermitUtils } from './permit-DnVMDT5h.cjs';
5
5
  import { StoreApi } from 'zustand/vanilla';
6
6
 
7
7
  type TfheInitializer = () => Promise<boolean>;
@@ -165,6 +165,24 @@ type EncryptStepCallbackContext = Record<string, any> & {
165
165
  duration: number;
166
166
  };
167
167
  type EncryptStepCallbackFunction = (state: EncryptStep, context?: EncryptStepCallbackContext) => void;
168
+ type DecryptEndpoint = 'decrypt' | 'sealoutput';
169
+ type DecryptPollCallbackContext = {
170
+ operation: DecryptEndpoint;
171
+ requestId: string;
172
+ attemptIndex: number;
173
+ elapsedMs: number;
174
+ intervalMs: number;
175
+ timeoutMs: number;
176
+ };
177
+ type DecryptPollCallbackFunction = (context: DecryptPollCallbackContext) => void;
178
+ /**
179
+ * Decrypted plaintext value returned by view-decryption helpers.
180
+ *
181
+ * This is a scalar JS value (not a wrapper object):
182
+ * - `boolean` for `FheTypes.Bool`
183
+ * - checksummed address `string` for `FheTypes.Uint160`
184
+ * - `bigint` for supported integer utypes
185
+ */
168
186
  type UnsealedItem<U extends FheTypes> = U extends FheTypes.Bool ? boolean : U extends FheTypes.Uint160 ? string : U extends FheUintUTypesType ? bigint : never;
169
187
 
170
188
  /**
@@ -352,6 +370,7 @@ declare class DecryptForViewBuilder<U extends FheTypes> extends BaseBuilder {
352
370
  private utype;
353
371
  private permitHash?;
354
372
  private permit?;
373
+ private pollCallback?;
355
374
  constructor(params: DecryptForViewBuilderParams<U>);
356
375
  /**
357
376
  * @param chainId - Chain to decrypt values from. Used to fetch the threshold network URL and use the correct permit.
@@ -385,6 +404,7 @@ declare class DecryptForViewBuilder<U extends FheTypes> extends BaseBuilder {
385
404
  */
386
405
  setAccount(account: string): DecryptForViewBuilder<U>;
387
406
  getAccount(): string | undefined;
407
+ onPoll(callback: DecryptPollCallbackFunction): DecryptForViewBuilder<U>;
388
408
  /**
389
409
  * Select "use permit" mode (optional).
390
410
  *
@@ -486,6 +506,7 @@ declare class DecryptForTxBuilder extends BaseBuilder {
486
506
  private permitHash?;
487
507
  private permit?;
488
508
  private permitSelection;
509
+ private pollCallback?;
489
510
  constructor(params: DecryptForTxBuilderParams);
490
511
  /**
491
512
  * @param chainId - Chain to decrypt values from. Used to fetch the threshold network URL and use the correct permit.
@@ -521,6 +542,8 @@ declare class DecryptForTxBuilder extends BaseBuilder {
521
542
  setAccount(this: DecryptForTxBuilderUnset, account: string): DecryptForTxBuilderUnset;
522
543
  setAccount(this: DecryptForTxBuilderSelected, account: string): DecryptForTxBuilderSelected;
523
544
  getAccount(): string | undefined;
545
+ onPoll(this: DecryptForTxBuilderUnset, callback: DecryptPollCallbackFunction): DecryptForTxBuilderUnset;
546
+ onPoll(this: DecryptForTxBuilderSelected, callback: DecryptPollCallbackFunction): DecryptForTxBuilderSelected;
524
547
  /**
525
548
  * Select "use permit" mode.
526
549
  *
@@ -590,11 +613,10 @@ interface ZkProveWorkerResponse {
590
613
  error?: string;
591
614
  }
592
615
  type ZkProvenCiphertextList = {
593
- serialize(): Uint8Array;
616
+ safe_serialize(serialized_size_limit: bigint): Uint8Array;
594
617
  };
595
618
  type ZkCompactPkeCrs = {
596
619
  free(): void;
597
- serialize(compress: boolean): Uint8Array;
598
620
  safe_serialize(serialized_size_limit: bigint): Uint8Array;
599
621
  };
600
622
  type ZkCiphertextListBuilder = {
@@ -892,11 +914,12 @@ declare const permits: {
892
914
  getOrCreateSelfPermit: (publicClient: PublicClient, walletClient: WalletClient, chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
893
915
  getOrCreateSharingPermit: (publicClient: PublicClient, walletClient: WalletClient, options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
894
916
  getHash: (permit: PermitHashFields) => string;
917
+ export: (permit: Permit) => string;
895
918
  serialize: (permit: Permit) => SerializedPermit;
896
919
  deserialize: (serialized: SerializedPermit) => Permit;
897
- getPermit: (chainId: number, account: string, hash: string) => Promise<Permit | undefined>;
898
- getPermits: (chainId: number, account: string) => Promise<Record<string, Permit>>;
899
- getActivePermit: (chainId: number, account: string) => Promise<Permit | undefined>;
920
+ getPermit: (chainId: number, account: string, hash: string) => Permit | undefined;
921
+ getPermits: (chainId: number, account: string) => Record<string, Permit>;
922
+ getActivePermit: (chainId: number, account: string) => Permit | undefined;
900
923
  getActivePermitHash: (chainId: number, account: string) => string | undefined;
901
924
  removePermit: (chainId: number, account: string, hash: string) => Promise<void>;
902
925
  selectActivePermit: (chainId: number, account: string, hash: string) => void;
@@ -927,6 +950,7 @@ type CofheClient<TConfig extends CofheConfig = CofheConfig> = {
927
950
  decryptHandle<U extends FheTypes>(ctHash: bigint | string, utype: U): DecryptForViewBuilder<U>;
928
951
  decryptForView<U extends FheTypes>(ctHash: bigint | string, utype: U): DecryptForViewBuilder<U>;
929
952
  decryptForTx(ctHash: bigint | string): DecryptForTxBuilderUnset;
953
+ verifyDecryptResult(handle: bigint | string, cleartext: bigint, signature: Hex): Promise<boolean>;
930
954
  permits: CofheClientPermits;
931
955
  };
932
956
  type CofheClientConnectionState = {
@@ -949,16 +973,17 @@ type CofheClientPermits = {
949
973
  createSelf: (options: CreateSelfPermitOptions, clients?: CofheClientPermitsClients) => Promise<SelfPermit>;
950
974
  createSharing: (options: CreateSharingPermitOptions, clients?: CofheClientPermitsClients) => Promise<SharingPermit>;
951
975
  importShared: (options: ImportSharedPermitOptions | string, clients?: CofheClientPermitsClients) => Promise<RecipientPermit>;
952
- getPermit: (hash: string, chainId?: number, account?: string) => Promise<Permit | undefined>;
953
- getPermits: (chainId?: number, account?: string) => Promise<Record<string, Permit>>;
954
- getActivePermit: (chainId?: number, account?: string) => Promise<Permit | undefined>;
955
- getActivePermitHash: (chainId?: number, account?: string) => Promise<string | undefined>;
976
+ getPermit: (hash: string, chainId?: number, account?: string) => Permit | undefined;
977
+ getPermits: (chainId?: number, account?: string) => Record<string, Permit>;
978
+ getActivePermit: (chainId?: number, account?: string) => Permit | undefined;
979
+ getActivePermitHash: (chainId?: number, account?: string) => string | undefined;
956
980
  getOrCreateSelfPermit: (chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
957
981
  getOrCreateSharingPermit: (options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
958
982
  selectActivePermit: (hash: string, chainId?: number, account?: string) => void;
959
983
  removePermit: (hash: string, chainId?: number, account?: string) => void;
960
984
  removeActivePermit: (chainId?: number, account?: string) => void;
961
985
  getHash: typeof PermitUtils.getHash;
986
+ export: typeof PermitUtils.export;
962
987
  serialize: typeof PermitUtils.serialize;
963
988
  deserialize: typeof PermitUtils.deserialize;
964
989
  };
@@ -971,4 +996,4 @@ type CofheClientParams<TConfig extends CofheConfig> = {
971
996
  zkProveWorkerFn?: ZkProveWorkerFunction;
972
997
  };
973
998
 
974
- export { type ZkProveWorkerFunction as $, type FheTypeValue as A, type EncryptStepCallbackFunction as B, type CofheInputConfig as C, type EncryptStepCallbackContext as D, type EncryptableItem as E, FheTypes as F, FheUintUTypes as G, FheAllUTypes as H, type IStorage as I, Encryptable as J, isEncryptableItem as K, type LiteralToPrimitive as L, EncryptStep as M, isLastEncryptionStep as N, assertCorrectEncryptedItemInput as O, type Primitive as P, fetchKeys as Q, type FheKeyDeserializer as R, createKeysStore as S, type KeysStorage as T, type UnsealedItem as U, type KeysStore as V, EncryptInputsBuilder as W, DecryptForViewBuilder as X, DecryptForTxBuilder as Y, type DecryptForTxResult as Z, type ZkBuilderAndCrsGenerator as _, type CofheConfig as a, type ZkProveWorkerRequest as a0, type ZkProveWorkerResponse as a1, zkProveWithWorker as a2, type CofheClient as b, type CofheClientConnectionState as c, type CofheClientParams as d, createCofheConfigBase as e, type CofheInternalConfig as f, getCofheConfigItem as g, type CofheClientPermits as h, type EncryptableBool as i, type EncryptableUint8 as j, type EncryptableUint16 as k, type EncryptableUint32 as l, type EncryptableUint64 as m, type EncryptableUint128 as n, type EncryptableAddress as o, type EncryptedNumber as p, type EncryptedItemInput as q, type EncryptedBoolInput as r, type EncryptedUint8Input as s, type EncryptedUint16Input as t, type EncryptedUint32Input as u, type EncryptedUint64Input as v, type EncryptedUint128Input as w, type EncryptedAddressInput as x, type EncryptedItemInputs as y, type EncryptableToEncryptedItemInputMap as z };
999
+ export { DecryptForTxBuilder as $, type FheTypeValue as A, type DecryptPollCallbackContext as B, type CofheInputConfig as C, type DecryptPollCallbackFunction as D, type EncryptableItem as E, FheTypes as F, type DecryptEndpoint as G, type EncryptStepCallbackFunction as H, type IStorage as I, type EncryptStepCallbackContext as J, FheUintUTypes as K, type LiteralToPrimitive as L, FheAllUTypes as M, Encryptable as N, isEncryptableItem as O, type Primitive as P, EncryptStep as Q, isLastEncryptionStep as R, assertCorrectEncryptedItemInput as S, fetchKeys as T, type UnsealedItem as U, type FheKeyDeserializer as V, createKeysStore as W, type KeysStorage as X, type KeysStore as Y, EncryptInputsBuilder as Z, DecryptForViewBuilder as _, type CofheConfig as a, type DecryptForTxResult as a0, type ZkBuilderAndCrsGenerator as a1, type ZkProveWorkerFunction as a2, type ZkProveWorkerRequest as a3, type ZkProveWorkerResponse as a4, zkProveWithWorker as a5, type CofheClient as b, type CofheClientParams as c, type CofheClientConnectionState as d, createCofheConfigBase as e, type CofheInternalConfig as f, getCofheConfigItem as g, type CofheClientPermits as h, type EncryptableBool as i, type EncryptableUint8 as j, type EncryptableUint16 as k, type EncryptableUint32 as l, type EncryptableUint64 as m, type EncryptableUint128 as n, type EncryptableAddress as o, type EncryptedNumber as p, type EncryptedItemInput as q, type EncryptedBoolInput as r, type EncryptedUint8Input as s, type EncryptedUint16Input as t, type EncryptedUint32Input as u, type EncryptedUint64Input as v, type EncryptedUint128Input as w, type EncryptedAddressInput as x, type EncryptedItemInputs as y, type EncryptableToEncryptedItemInputMap as z };
@@ -1,7 +1,7 @@
1
- import { WalletClient, PublicClient } from 'viem';
2
- import { C as CofheChain } from './types-YiAC4gig.js';
1
+ import { WalletClient, PublicClient, Hex } from 'viem';
2
+ import { C as CofheChain } from './types-C07FK-cL.js';
3
3
  import { z } from 'zod';
4
- import { P as Permit, S as SerializedPermit, C as CreateSelfPermitOptions, m as SelfPermit, d as CreateSharingPermitOptions, n as SharingPermit, I as ImportSharedPermitOptions, R as RecipientPermit, o as PermitHashFields, g as PermitUtils } from './permit-MZ502UBl.js';
4
+ import { P as Permit, S as SerializedPermit, C as CreateSelfPermitOptions, m as SelfPermit, d as CreateSharingPermitOptions, n as SharingPermit, I as ImportSharedPermitOptions, R as RecipientPermit, o as PermitHashFields, g as PermitUtils } from './permit-DnVMDT5h.js';
5
5
  import { StoreApi } from 'zustand/vanilla';
6
6
 
7
7
  type TfheInitializer = () => Promise<boolean>;
@@ -165,6 +165,24 @@ type EncryptStepCallbackContext = Record<string, any> & {
165
165
  duration: number;
166
166
  };
167
167
  type EncryptStepCallbackFunction = (state: EncryptStep, context?: EncryptStepCallbackContext) => void;
168
+ type DecryptEndpoint = 'decrypt' | 'sealoutput';
169
+ type DecryptPollCallbackContext = {
170
+ operation: DecryptEndpoint;
171
+ requestId: string;
172
+ attemptIndex: number;
173
+ elapsedMs: number;
174
+ intervalMs: number;
175
+ timeoutMs: number;
176
+ };
177
+ type DecryptPollCallbackFunction = (context: DecryptPollCallbackContext) => void;
178
+ /**
179
+ * Decrypted plaintext value returned by view-decryption helpers.
180
+ *
181
+ * This is a scalar JS value (not a wrapper object):
182
+ * - `boolean` for `FheTypes.Bool`
183
+ * - checksummed address `string` for `FheTypes.Uint160`
184
+ * - `bigint` for supported integer utypes
185
+ */
168
186
  type UnsealedItem<U extends FheTypes> = U extends FheTypes.Bool ? boolean : U extends FheTypes.Uint160 ? string : U extends FheUintUTypesType ? bigint : never;
169
187
 
170
188
  /**
@@ -352,6 +370,7 @@ declare class DecryptForViewBuilder<U extends FheTypes> extends BaseBuilder {
352
370
  private utype;
353
371
  private permitHash?;
354
372
  private permit?;
373
+ private pollCallback?;
355
374
  constructor(params: DecryptForViewBuilderParams<U>);
356
375
  /**
357
376
  * @param chainId - Chain to decrypt values from. Used to fetch the threshold network URL and use the correct permit.
@@ -385,6 +404,7 @@ declare class DecryptForViewBuilder<U extends FheTypes> extends BaseBuilder {
385
404
  */
386
405
  setAccount(account: string): DecryptForViewBuilder<U>;
387
406
  getAccount(): string | undefined;
407
+ onPoll(callback: DecryptPollCallbackFunction): DecryptForViewBuilder<U>;
388
408
  /**
389
409
  * Select "use permit" mode (optional).
390
410
  *
@@ -486,6 +506,7 @@ declare class DecryptForTxBuilder extends BaseBuilder {
486
506
  private permitHash?;
487
507
  private permit?;
488
508
  private permitSelection;
509
+ private pollCallback?;
489
510
  constructor(params: DecryptForTxBuilderParams);
490
511
  /**
491
512
  * @param chainId - Chain to decrypt values from. Used to fetch the threshold network URL and use the correct permit.
@@ -521,6 +542,8 @@ declare class DecryptForTxBuilder extends BaseBuilder {
521
542
  setAccount(this: DecryptForTxBuilderUnset, account: string): DecryptForTxBuilderUnset;
522
543
  setAccount(this: DecryptForTxBuilderSelected, account: string): DecryptForTxBuilderSelected;
523
544
  getAccount(): string | undefined;
545
+ onPoll(this: DecryptForTxBuilderUnset, callback: DecryptPollCallbackFunction): DecryptForTxBuilderUnset;
546
+ onPoll(this: DecryptForTxBuilderSelected, callback: DecryptPollCallbackFunction): DecryptForTxBuilderSelected;
524
547
  /**
525
548
  * Select "use permit" mode.
526
549
  *
@@ -590,11 +613,10 @@ interface ZkProveWorkerResponse {
590
613
  error?: string;
591
614
  }
592
615
  type ZkProvenCiphertextList = {
593
- serialize(): Uint8Array;
616
+ safe_serialize(serialized_size_limit: bigint): Uint8Array;
594
617
  };
595
618
  type ZkCompactPkeCrs = {
596
619
  free(): void;
597
- serialize(compress: boolean): Uint8Array;
598
620
  safe_serialize(serialized_size_limit: bigint): Uint8Array;
599
621
  };
600
622
  type ZkCiphertextListBuilder = {
@@ -892,11 +914,12 @@ declare const permits: {
892
914
  getOrCreateSelfPermit: (publicClient: PublicClient, walletClient: WalletClient, chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
893
915
  getOrCreateSharingPermit: (publicClient: PublicClient, walletClient: WalletClient, options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
894
916
  getHash: (permit: PermitHashFields) => string;
917
+ export: (permit: Permit) => string;
895
918
  serialize: (permit: Permit) => SerializedPermit;
896
919
  deserialize: (serialized: SerializedPermit) => Permit;
897
- getPermit: (chainId: number, account: string, hash: string) => Promise<Permit | undefined>;
898
- getPermits: (chainId: number, account: string) => Promise<Record<string, Permit>>;
899
- getActivePermit: (chainId: number, account: string) => Promise<Permit | undefined>;
920
+ getPermit: (chainId: number, account: string, hash: string) => Permit | undefined;
921
+ getPermits: (chainId: number, account: string) => Record<string, Permit>;
922
+ getActivePermit: (chainId: number, account: string) => Permit | undefined;
900
923
  getActivePermitHash: (chainId: number, account: string) => string | undefined;
901
924
  removePermit: (chainId: number, account: string, hash: string) => Promise<void>;
902
925
  selectActivePermit: (chainId: number, account: string, hash: string) => void;
@@ -927,6 +950,7 @@ type CofheClient<TConfig extends CofheConfig = CofheConfig> = {
927
950
  decryptHandle<U extends FheTypes>(ctHash: bigint | string, utype: U): DecryptForViewBuilder<U>;
928
951
  decryptForView<U extends FheTypes>(ctHash: bigint | string, utype: U): DecryptForViewBuilder<U>;
929
952
  decryptForTx(ctHash: bigint | string): DecryptForTxBuilderUnset;
953
+ verifyDecryptResult(handle: bigint | string, cleartext: bigint, signature: Hex): Promise<boolean>;
930
954
  permits: CofheClientPermits;
931
955
  };
932
956
  type CofheClientConnectionState = {
@@ -949,16 +973,17 @@ type CofheClientPermits = {
949
973
  createSelf: (options: CreateSelfPermitOptions, clients?: CofheClientPermitsClients) => Promise<SelfPermit>;
950
974
  createSharing: (options: CreateSharingPermitOptions, clients?: CofheClientPermitsClients) => Promise<SharingPermit>;
951
975
  importShared: (options: ImportSharedPermitOptions | string, clients?: CofheClientPermitsClients) => Promise<RecipientPermit>;
952
- getPermit: (hash: string, chainId?: number, account?: string) => Promise<Permit | undefined>;
953
- getPermits: (chainId?: number, account?: string) => Promise<Record<string, Permit>>;
954
- getActivePermit: (chainId?: number, account?: string) => Promise<Permit | undefined>;
955
- getActivePermitHash: (chainId?: number, account?: string) => Promise<string | undefined>;
976
+ getPermit: (hash: string, chainId?: number, account?: string) => Permit | undefined;
977
+ getPermits: (chainId?: number, account?: string) => Record<string, Permit>;
978
+ getActivePermit: (chainId?: number, account?: string) => Permit | undefined;
979
+ getActivePermitHash: (chainId?: number, account?: string) => string | undefined;
956
980
  getOrCreateSelfPermit: (chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
957
981
  getOrCreateSharingPermit: (options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
958
982
  selectActivePermit: (hash: string, chainId?: number, account?: string) => void;
959
983
  removePermit: (hash: string, chainId?: number, account?: string) => void;
960
984
  removeActivePermit: (chainId?: number, account?: string) => void;
961
985
  getHash: typeof PermitUtils.getHash;
986
+ export: typeof PermitUtils.export;
962
987
  serialize: typeof PermitUtils.serialize;
963
988
  deserialize: typeof PermitUtils.deserialize;
964
989
  };
@@ -971,4 +996,4 @@ type CofheClientParams<TConfig extends CofheConfig> = {
971
996
  zkProveWorkerFn?: ZkProveWorkerFunction;
972
997
  };
973
998
 
974
- export { type ZkProveWorkerFunction as $, type FheTypeValue as A, type EncryptStepCallbackFunction as B, type CofheInputConfig as C, type EncryptStepCallbackContext as D, type EncryptableItem as E, FheTypes as F, FheUintUTypes as G, FheAllUTypes as H, type IStorage as I, Encryptable as J, isEncryptableItem as K, type LiteralToPrimitive as L, EncryptStep as M, isLastEncryptionStep as N, assertCorrectEncryptedItemInput as O, type Primitive as P, fetchKeys as Q, type FheKeyDeserializer as R, createKeysStore as S, type KeysStorage as T, type UnsealedItem as U, type KeysStore as V, EncryptInputsBuilder as W, DecryptForViewBuilder as X, DecryptForTxBuilder as Y, type DecryptForTxResult as Z, type ZkBuilderAndCrsGenerator as _, type CofheConfig as a, type ZkProveWorkerRequest as a0, type ZkProveWorkerResponse as a1, zkProveWithWorker as a2, type CofheClient as b, type CofheClientConnectionState as c, type CofheClientParams as d, createCofheConfigBase as e, type CofheInternalConfig as f, getCofheConfigItem as g, type CofheClientPermits as h, type EncryptableBool as i, type EncryptableUint8 as j, type EncryptableUint16 as k, type EncryptableUint32 as l, type EncryptableUint64 as m, type EncryptableUint128 as n, type EncryptableAddress as o, type EncryptedNumber as p, type EncryptedItemInput as q, type EncryptedBoolInput as r, type EncryptedUint8Input as s, type EncryptedUint16Input as t, type EncryptedUint32Input as u, type EncryptedUint64Input as v, type EncryptedUint128Input as w, type EncryptedAddressInput as x, type EncryptedItemInputs as y, type EncryptableToEncryptedItemInputMap as z };
999
+ export { DecryptForTxBuilder as $, type FheTypeValue as A, type DecryptPollCallbackContext as B, type CofheInputConfig as C, type DecryptPollCallbackFunction as D, type EncryptableItem as E, FheTypes as F, type DecryptEndpoint as G, type EncryptStepCallbackFunction as H, type IStorage as I, type EncryptStepCallbackContext as J, FheUintUTypes as K, type LiteralToPrimitive as L, FheAllUTypes as M, Encryptable as N, isEncryptableItem as O, type Primitive as P, EncryptStep as Q, isLastEncryptionStep as R, assertCorrectEncryptedItemInput as S, fetchKeys as T, type UnsealedItem as U, type FheKeyDeserializer as V, createKeysStore as W, type KeysStorage as X, type KeysStore as Y, EncryptInputsBuilder as Z, DecryptForViewBuilder as _, type CofheConfig as a, type DecryptForTxResult as a0, type ZkBuilderAndCrsGenerator as a1, type ZkProveWorkerFunction as a2, type ZkProveWorkerRequest as a3, type ZkProveWorkerResponse as a4, zkProveWithWorker as a5, type CofheClient as b, type CofheClientParams as c, type CofheClientConnectionState as d, createCofheConfigBase as e, type CofheInternalConfig as f, getCofheConfigItem as g, type CofheClientPermits as h, type EncryptableBool as i, type EncryptableUint8 as j, type EncryptableUint16 as k, type EncryptableUint32 as l, type EncryptableUint64 as m, type EncryptableUint128 as n, type EncryptableAddress as o, type EncryptedNumber as p, type EncryptedItemInput as q, type EncryptedBoolInput as r, type EncryptedUint8Input as s, type EncryptedUint16Input as t, type EncryptedUint32Input as u, type EncryptedUint64Input as v, type EncryptedUint128Input as w, type EncryptedAddressInput as x, type EncryptedItemInputs as y, type EncryptableToEncryptedItemInputMap as z };