@cofhe/sdk 0.2.0 → 0.2.1

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 (57) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/chains/defineChain.ts +2 -2
  3. package/chains/types.ts +3 -3
  4. package/core/client.test.ts +111 -0
  5. package/core/client.ts +22 -2
  6. package/core/clientTypes.ts +7 -1
  7. package/core/config.test.ts +8 -0
  8. package/core/config.ts +10 -4
  9. package/core/consts.ts +18 -0
  10. package/core/decrypt/cofheMocksSealOutput.ts +2 -4
  11. package/core/encrypt/cofheMocksZkVerifySign.ts +4 -11
  12. package/core/index.ts +9 -1
  13. package/core/permits.test.ts +5 -6
  14. package/core/permits.ts +5 -4
  15. package/dist/chains.cjs +4 -7
  16. package/dist/chains.d.cts +12 -12
  17. package/dist/chains.d.ts +12 -12
  18. package/dist/chains.js +1 -1
  19. package/dist/{chunk-WGCRJCBR.js → chunk-I5WFEYXX.js} +33 -19
  20. package/dist/{chunk-UGBVZNRT.js → chunk-R3B5TMVX.js} +308 -189
  21. package/dist/{chunk-WEAZ25JO.js → chunk-TBLR7NNE.js} +4 -7
  22. package/dist/{clientTypes-Es7fyi65.d.ts → clientTypes-RqkgkV2i.d.ts} +34 -93
  23. package/dist/{clientTypes-5_1nwtUe.d.cts → clientTypes-e4filDzK.d.cts} +34 -93
  24. package/dist/core.cjs +343 -208
  25. package/dist/core.d.cts +17 -6
  26. package/dist/core.d.ts +17 -6
  27. package/dist/core.js +3 -3
  28. package/dist/node.cjs +337 -208
  29. package/dist/node.d.cts +3 -3
  30. package/dist/node.d.ts +3 -3
  31. package/dist/node.js +3 -3
  32. package/dist/{permit-fUSe6KKq.d.cts → permit-MZ502UBl.d.cts} +30 -33
  33. package/dist/{permit-fUSe6KKq.d.ts → permit-MZ502UBl.d.ts} +30 -33
  34. package/dist/permits.cjs +305 -187
  35. package/dist/permits.d.cts +111 -812
  36. package/dist/permits.d.ts +111 -812
  37. package/dist/permits.js +1 -1
  38. package/dist/types-YiAC4gig.d.cts +33 -0
  39. package/dist/types-YiAC4gig.d.ts +33 -0
  40. package/dist/web.cjs +337 -208
  41. package/dist/web.d.cts +3 -3
  42. package/dist/web.d.ts +3 -3
  43. package/dist/web.js +3 -3
  44. package/package.json +3 -3
  45. package/permits/localstorage.test.ts +9 -13
  46. package/permits/onchain-utils.ts +221 -0
  47. package/permits/permit.test.ts +51 -5
  48. package/permits/permit.ts +28 -74
  49. package/permits/store.test.ts +10 -50
  50. package/permits/store.ts +4 -14
  51. package/permits/test-utils.ts +10 -2
  52. package/permits/types.ts +22 -9
  53. package/permits/utils.ts +0 -4
  54. package/permits/validation.test.ts +29 -32
  55. package/permits/validation.ts +112 -194
  56. package/dist/types-KImPrEIe.d.cts +0 -48
  57. package/dist/types-KImPrEIe.d.ts +0 -48
@@ -10,21 +10,18 @@ var CofheChainSchema = z.object({
10
10
  /** Network identifier */
11
11
  network: z.string().min(1),
12
12
  /** coFhe service URL */
13
- coFheUrl: z.string().url(),
13
+ coFheUrl: z.url(),
14
14
  /** Verifier service URL */
15
- verifierUrl: z.string().url(),
15
+ verifierUrl: z.url(),
16
16
  /** Threshold network service URL */
17
- thresholdNetworkUrl: z.string().url(),
17
+ thresholdNetworkUrl: z.url(),
18
18
  /** Environment type */
19
19
  environment: EnvironmentSchema
20
20
  });
21
-
22
- // chains/defineChain.ts
23
21
  function defineChain(chainConfig) {
24
22
  const result = CofheChainSchema.safeParse(chainConfig);
25
23
  if (!result.success) {
26
- const errorMessages = result.error.errors.map((err) => `${err.path.join(".")}: ${err.message}`);
27
- throw new Error(`Invalid chain configuration: ${errorMessages.join(", ")}`);
24
+ throw new Error(`Invalid chain configuration: ${z.prettifyError(result.error)}`, { cause: result.error });
28
25
  }
29
26
  return result.data;
30
27
  }
@@ -1,7 +1,7 @@
1
1
  import { WalletClient, PublicClient } from 'viem';
2
- import { C as CofheChain } from './types-KImPrEIe.js';
2
+ import { C as CofheChain } from './types-YiAC4gig.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, g as PermitUtils } from './permit-fUSe6KKq.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-MZ502UBl.js';
5
5
  import { StoreApi } from 'zustand/vanilla';
6
6
 
7
7
  type TfheInitializer = () => Promise<boolean>;
@@ -214,113 +214,48 @@ type CofhesdkInternalConfig = {
214
214
  * Zod schema for configuration validation
215
215
  */
216
216
  declare const CofhesdkConfigSchema: z.ZodObject<{
217
- /** Environment that the SDK is running in */
218
- environment: z.ZodDefault<z.ZodOptional<z.ZodEnum<["node", "hardhat", "web", "react"]>>>;
219
- /** List of supported chain configurations */
220
- supportedChains: z.ZodArray<z.ZodType<{
221
- name: string;
217
+ environment: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
218
+ hardhat: "hardhat";
219
+ node: "node";
220
+ web: "web";
221
+ react: "react";
222
+ }>>>;
223
+ supportedChains: z.ZodArray<z.ZodCustom<{
222
224
  id: number;
225
+ name: string;
223
226
  network: string;
224
227
  coFheUrl: string;
225
228
  verifierUrl: string;
226
229
  thresholdNetworkUrl: string;
227
230
  environment: "MOCK" | "TESTNET" | "MAINNET";
228
- }, z.ZodTypeDef, {
229
- name: string;
231
+ }, {
230
232
  id: number;
233
+ name: string;
231
234
  network: string;
232
235
  coFheUrl: string;
233
236
  verifierUrl: string;
234
237
  thresholdNetworkUrl: string;
235
238
  environment: "MOCK" | "TESTNET" | "MAINNET";
236
- }>, "many">;
237
- /** How permits are generated */
238
- permitGeneration: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ON_CONNECT", "ON_DECRYPT_HANDLES", "MANUAL"]>>>;
239
- /** Default permit expiration in seconds, default is 30 days */
239
+ }>>;
240
+ permitGeneration: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
241
+ ON_CONNECT: "ON_CONNECT";
242
+ ON_DECRYPT_HANDLES: "ON_DECRYPT_HANDLES";
243
+ MANUAL: "MANUAL";
244
+ }>>>;
240
245
  defaultPermitExpiration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
241
- /** Storage method for fhe keys (defaults to indexedDB on web, filesystem on node) */
242
246
  fheKeyStorage: z.ZodDefault<z.ZodUnion<[z.ZodObject<{
243
- getItem: z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodAny>>;
244
- setItem: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodAny], z.ZodUnknown>, z.ZodPromise<z.ZodVoid>>;
245
- removeItem: z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodVoid>>;
246
- }, "strip", z.ZodTypeAny, {
247
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
248
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
249
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
250
- }, {
251
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
252
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
253
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
254
- }>, z.ZodNull]>>;
255
- /** Whether to use Web Workers for ZK proof generation (web platform only) */
247
+ getItem: z.ZodCustom<(name: string) => Promise<any>, (name: string) => Promise<any>>;
248
+ setItem: z.ZodCustom<(name: string, value: any) => Promise<void>, (name: string, value: any) => Promise<void>>;
249
+ removeItem: z.ZodCustom<(name: string) => Promise<void>, (name: string) => Promise<void>>;
250
+ }, z.core.$strip>, z.ZodNull]>>;
256
251
  useWorkers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
257
- /** Mocks configs */
258
252
  mocks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
259
253
  sealOutputDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
260
- }, "strip", z.ZodTypeAny, {
261
- sealOutputDelay: number;
262
- }, {
263
- sealOutputDelay?: number | undefined;
264
- }>>>;
265
- /** Internal configuration */
254
+ }, z.core.$strip>>>;
266
255
  _internal: z.ZodOptional<z.ZodObject<{
267
256
  zkvWalletClient: z.ZodOptional<z.ZodAny>;
268
- }, "strip", z.ZodTypeAny, {
269
- zkvWalletClient?: any;
270
- }, {
271
- zkvWalletClient?: any;
272
- }>>;
273
- }, "strip", z.ZodTypeAny, {
274
- environment: "hardhat" | "node" | "web" | "react";
275
- supportedChains: {
276
- name: string;
277
- id: number;
278
- network: string;
279
- coFheUrl: string;
280
- verifierUrl: string;
281
- thresholdNetworkUrl: string;
282
- environment: "MOCK" | "TESTNET" | "MAINNET";
283
- }[];
284
- permitGeneration: "ON_CONNECT" | "ON_DECRYPT_HANDLES" | "MANUAL";
285
- defaultPermitExpiration: number;
286
- fheKeyStorage: {
287
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
288
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
289
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
290
- } | null;
291
- useWorkers: boolean;
292
- mocks: {
293
- sealOutputDelay: number;
294
- };
295
- _internal?: {
296
- zkvWalletClient?: any;
297
- } | undefined;
298
- }, {
299
- supportedChains: {
300
- name: string;
301
- id: number;
302
- network: string;
303
- coFheUrl: string;
304
- verifierUrl: string;
305
- thresholdNetworkUrl: string;
306
- environment: "MOCK" | "TESTNET" | "MAINNET";
307
- }[];
308
- environment?: "hardhat" | "node" | "web" | "react" | undefined;
309
- permitGeneration?: "ON_CONNECT" | "ON_DECRYPT_HANDLES" | "MANUAL" | undefined;
310
- defaultPermitExpiration?: number | undefined;
311
- fheKeyStorage?: {
312
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
313
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
314
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
315
- } | null | undefined;
316
- useWorkers?: boolean | undefined;
317
- mocks?: {
318
- sealOutputDelay?: number | undefined;
319
- } | undefined;
320
- _internal?: {
321
- zkvWalletClient?: any;
322
- } | undefined;
323
- }>;
257
+ }, z.core.$strip>>;
258
+ }, z.core.$strip>;
324
259
  /**
325
260
  * Input config type inferred from the schema
326
261
  */
@@ -843,14 +778,14 @@ declare const permits: {
843
778
  importShared: (options: ImportSharedPermitOptions | string, publicClient: PublicClient, walletClient: WalletClient) => Promise<RecipientPermit>;
844
779
  getOrCreateSelfPermit: (publicClient: PublicClient, walletClient: WalletClient, chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
845
780
  getOrCreateSharingPermit: (publicClient: PublicClient, walletClient: WalletClient, options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
846
- getHash: (permit: Permit) => string;
781
+ getHash: (permit: PermitHashFields) => string;
847
782
  serialize: (permit: Permit) => SerializedPermit;
848
783
  deserialize: (serialized: SerializedPermit) => Permit;
849
784
  getPermit: (chainId: number, account: string, hash: string) => Promise<Permit | undefined>;
850
785
  getPermits: (chainId: number, account: string) => Promise<Record<string, Permit>>;
851
786
  getActivePermit: (chainId: number, account: string) => Promise<Permit | undefined>;
852
787
  getActivePermitHash: (chainId: number, account: string) => string | undefined;
853
- removePermit: (chainId: number, account: string, hash: string, force?: boolean) => Promise<void>;
788
+ removePermit: (chainId: number, account: string, hash: string) => Promise<void>;
854
789
  selectActivePermit: (chainId: number, account: string, hash: string) => void;
855
790
  removeActivePermit: (chainId: number, account: string) => Promise<void>;
856
791
  };
@@ -862,6 +797,12 @@ type CofhesdkClient<TConfig extends CofhesdkConfig = CofhesdkConfig> = {
862
797
  readonly connecting: boolean;
863
798
  readonly config: TConfig;
864
799
  connect(publicClient: PublicClient, walletClient: WalletClient): Promise<void>;
800
+ /**
801
+ * Clears the current connection state (account/chainId/clients) and marks the client as disconnected.
802
+ *
803
+ * This does not delete persisted permits or stored FHE keys; it only resets the in-memory connection.
804
+ */
805
+ disconnect(): void;
865
806
  /**
866
807
  * Types docstring
867
808
  */
@@ -896,7 +837,7 @@ type CofhesdkClientPermits = {
896
837
  getOrCreateSelfPermit: (chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
897
838
  getOrCreateSharingPermit: (options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
898
839
  selectActivePermit: (hash: string, chainId?: number, account?: string) => void;
899
- removePermit: (hash: string, chainId?: number, account?: string, force?: boolean) => void;
840
+ removePermit: (hash: string, chainId?: number, account?: string) => void;
900
841
  removeActivePermit: (chainId?: number, account?: string) => void;
901
842
  getHash: typeof PermitUtils.getHash;
902
843
  serialize: typeof PermitUtils.serialize;
@@ -1,7 +1,7 @@
1
1
  import { WalletClient, PublicClient } from 'viem';
2
- import { C as CofheChain } from './types-KImPrEIe.cjs';
2
+ import { C as CofheChain } from './types-YiAC4gig.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, g as PermitUtils } from './permit-fUSe6KKq.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-MZ502UBl.cjs';
5
5
  import { StoreApi } from 'zustand/vanilla';
6
6
 
7
7
  type TfheInitializer = () => Promise<boolean>;
@@ -214,113 +214,48 @@ type CofhesdkInternalConfig = {
214
214
  * Zod schema for configuration validation
215
215
  */
216
216
  declare const CofhesdkConfigSchema: z.ZodObject<{
217
- /** Environment that the SDK is running in */
218
- environment: z.ZodDefault<z.ZodOptional<z.ZodEnum<["node", "hardhat", "web", "react"]>>>;
219
- /** List of supported chain configurations */
220
- supportedChains: z.ZodArray<z.ZodType<{
221
- name: string;
217
+ environment: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
218
+ hardhat: "hardhat";
219
+ node: "node";
220
+ web: "web";
221
+ react: "react";
222
+ }>>>;
223
+ supportedChains: z.ZodArray<z.ZodCustom<{
222
224
  id: number;
225
+ name: string;
223
226
  network: string;
224
227
  coFheUrl: string;
225
228
  verifierUrl: string;
226
229
  thresholdNetworkUrl: string;
227
230
  environment: "MOCK" | "TESTNET" | "MAINNET";
228
- }, z.ZodTypeDef, {
229
- name: string;
231
+ }, {
230
232
  id: number;
233
+ name: string;
231
234
  network: string;
232
235
  coFheUrl: string;
233
236
  verifierUrl: string;
234
237
  thresholdNetworkUrl: string;
235
238
  environment: "MOCK" | "TESTNET" | "MAINNET";
236
- }>, "many">;
237
- /** How permits are generated */
238
- permitGeneration: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ON_CONNECT", "ON_DECRYPT_HANDLES", "MANUAL"]>>>;
239
- /** Default permit expiration in seconds, default is 30 days */
239
+ }>>;
240
+ permitGeneration: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
241
+ ON_CONNECT: "ON_CONNECT";
242
+ ON_DECRYPT_HANDLES: "ON_DECRYPT_HANDLES";
243
+ MANUAL: "MANUAL";
244
+ }>>>;
240
245
  defaultPermitExpiration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
241
- /** Storage method for fhe keys (defaults to indexedDB on web, filesystem on node) */
242
246
  fheKeyStorage: z.ZodDefault<z.ZodUnion<[z.ZodObject<{
243
- getItem: z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodAny>>;
244
- setItem: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodAny], z.ZodUnknown>, z.ZodPromise<z.ZodVoid>>;
245
- removeItem: z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodVoid>>;
246
- }, "strip", z.ZodTypeAny, {
247
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
248
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
249
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
250
- }, {
251
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
252
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
253
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
254
- }>, z.ZodNull]>>;
255
- /** Whether to use Web Workers for ZK proof generation (web platform only) */
247
+ getItem: z.ZodCustom<(name: string) => Promise<any>, (name: string) => Promise<any>>;
248
+ setItem: z.ZodCustom<(name: string, value: any) => Promise<void>, (name: string, value: any) => Promise<void>>;
249
+ removeItem: z.ZodCustom<(name: string) => Promise<void>, (name: string) => Promise<void>>;
250
+ }, z.core.$strip>, z.ZodNull]>>;
256
251
  useWorkers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
257
- /** Mocks configs */
258
252
  mocks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
259
253
  sealOutputDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
260
- }, "strip", z.ZodTypeAny, {
261
- sealOutputDelay: number;
262
- }, {
263
- sealOutputDelay?: number | undefined;
264
- }>>>;
265
- /** Internal configuration */
254
+ }, z.core.$strip>>>;
266
255
  _internal: z.ZodOptional<z.ZodObject<{
267
256
  zkvWalletClient: z.ZodOptional<z.ZodAny>;
268
- }, "strip", z.ZodTypeAny, {
269
- zkvWalletClient?: any;
270
- }, {
271
- zkvWalletClient?: any;
272
- }>>;
273
- }, "strip", z.ZodTypeAny, {
274
- environment: "hardhat" | "node" | "web" | "react";
275
- supportedChains: {
276
- name: string;
277
- id: number;
278
- network: string;
279
- coFheUrl: string;
280
- verifierUrl: string;
281
- thresholdNetworkUrl: string;
282
- environment: "MOCK" | "TESTNET" | "MAINNET";
283
- }[];
284
- permitGeneration: "ON_CONNECT" | "ON_DECRYPT_HANDLES" | "MANUAL";
285
- defaultPermitExpiration: number;
286
- fheKeyStorage: {
287
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
288
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
289
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
290
- } | null;
291
- useWorkers: boolean;
292
- mocks: {
293
- sealOutputDelay: number;
294
- };
295
- _internal?: {
296
- zkvWalletClient?: any;
297
- } | undefined;
298
- }, {
299
- supportedChains: {
300
- name: string;
301
- id: number;
302
- network: string;
303
- coFheUrl: string;
304
- verifierUrl: string;
305
- thresholdNetworkUrl: string;
306
- environment: "MOCK" | "TESTNET" | "MAINNET";
307
- }[];
308
- environment?: "hardhat" | "node" | "web" | "react" | undefined;
309
- permitGeneration?: "ON_CONNECT" | "ON_DECRYPT_HANDLES" | "MANUAL" | undefined;
310
- defaultPermitExpiration?: number | undefined;
311
- fheKeyStorage?: {
312
- getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
313
- setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
314
- removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
315
- } | null | undefined;
316
- useWorkers?: boolean | undefined;
317
- mocks?: {
318
- sealOutputDelay?: number | undefined;
319
- } | undefined;
320
- _internal?: {
321
- zkvWalletClient?: any;
322
- } | undefined;
323
- }>;
257
+ }, z.core.$strip>>;
258
+ }, z.core.$strip>;
324
259
  /**
325
260
  * Input config type inferred from the schema
326
261
  */
@@ -843,14 +778,14 @@ declare const permits: {
843
778
  importShared: (options: ImportSharedPermitOptions | string, publicClient: PublicClient, walletClient: WalletClient) => Promise<RecipientPermit>;
844
779
  getOrCreateSelfPermit: (publicClient: PublicClient, walletClient: WalletClient, chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
845
780
  getOrCreateSharingPermit: (publicClient: PublicClient, walletClient: WalletClient, options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
846
- getHash: (permit: Permit) => string;
781
+ getHash: (permit: PermitHashFields) => string;
847
782
  serialize: (permit: Permit) => SerializedPermit;
848
783
  deserialize: (serialized: SerializedPermit) => Permit;
849
784
  getPermit: (chainId: number, account: string, hash: string) => Promise<Permit | undefined>;
850
785
  getPermits: (chainId: number, account: string) => Promise<Record<string, Permit>>;
851
786
  getActivePermit: (chainId: number, account: string) => Promise<Permit | undefined>;
852
787
  getActivePermitHash: (chainId: number, account: string) => string | undefined;
853
- removePermit: (chainId: number, account: string, hash: string, force?: boolean) => Promise<void>;
788
+ removePermit: (chainId: number, account: string, hash: string) => Promise<void>;
854
789
  selectActivePermit: (chainId: number, account: string, hash: string) => void;
855
790
  removeActivePermit: (chainId: number, account: string) => Promise<void>;
856
791
  };
@@ -862,6 +797,12 @@ type CofhesdkClient<TConfig extends CofhesdkConfig = CofhesdkConfig> = {
862
797
  readonly connecting: boolean;
863
798
  readonly config: TConfig;
864
799
  connect(publicClient: PublicClient, walletClient: WalletClient): Promise<void>;
800
+ /**
801
+ * Clears the current connection state (account/chainId/clients) and marks the client as disconnected.
802
+ *
803
+ * This does not delete persisted permits or stored FHE keys; it only resets the in-memory connection.
804
+ */
805
+ disconnect(): void;
865
806
  /**
866
807
  * Types docstring
867
808
  */
@@ -896,7 +837,7 @@ type CofhesdkClientPermits = {
896
837
  getOrCreateSelfPermit: (chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
897
838
  getOrCreateSharingPermit: (options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
898
839
  selectActivePermit: (hash: string, chainId?: number, account?: string) => void;
899
- removePermit: (hash: string, chainId?: number, account?: string, force?: boolean) => void;
840
+ removePermit: (hash: string, chainId?: number, account?: string) => void;
900
841
  removeActivePermit: (chainId?: number, account?: string) => void;
901
842
  getHash: typeof PermitUtils.getHash;
902
843
  serialize: typeof PermitUtils.serialize;