@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.
- package/CHANGELOG.md +38 -0
- package/adapters/{ethers5.test.ts → test/ethers5.test.ts} +2 -2
- package/adapters/{ethers6.test.ts → test/ethers6.test.ts} +2 -2
- package/adapters/{hardhat.hh2.test.ts → test/hardhat.hh2.test.ts} +2 -2
- package/adapters/{index.test.ts → test/index.test.ts} +1 -1
- package/adapters/{wagmi.test.ts → test/wagmi.test.ts} +1 -1
- package/chains/{chains.test.ts → test/chains.test.ts} +1 -1
- package/core/client.ts +15 -5
- package/core/clientTypes.ts +7 -5
- package/core/consts.ts +9 -0
- package/core/decrypt/cofheMocksDecryptForTx.ts +14 -3
- package/core/decrypt/decryptForTxBuilder.ts +24 -10
- package/core/decrypt/decryptForViewBuilder.ts +14 -7
- package/core/decrypt/polling.ts +14 -0
- package/core/decrypt/tnDecryptUtils.ts +65 -0
- package/core/decrypt/{tnDecrypt.ts → tnDecryptV1.ts} +7 -70
- package/core/decrypt/tnDecryptV2.ts +483 -0
- package/core/decrypt/tnSealOutputV2.ts +245 -104
- package/core/decrypt/verifyDecryptResult.ts +65 -0
- package/core/encrypt/cofheMocksZkVerifySign.ts +6 -6
- package/core/encrypt/zkPackProveVerify.ts +10 -19
- package/core/fetchKeys.ts +0 -2
- package/core/index.ts +9 -1
- package/core/keyStore.ts +5 -2
- package/core/permits.ts +8 -3
- package/core/{client.test.ts → test/client.test.ts} +7 -7
- package/core/{config.test.ts → test/config.test.ts} +1 -1
- package/core/test/decrypt.test.ts +252 -0
- package/core/test/decryptBuilders.test.ts +390 -0
- package/core/{encrypt → test}/encryptInputsBuilder.test.ts +61 -6
- package/core/{fetchKeys.test.ts → test/fetchKeys.test.ts} +3 -3
- package/core/{keyStore.test.ts → test/keyStore.test.ts} +5 -3
- package/core/{permits.test.ts → test/permits.test.ts} +42 -1
- package/core/test/pollCallbacks.test.ts +563 -0
- package/core/types.ts +21 -0
- package/dist/chains.d.cts +2 -2
- package/dist/chains.d.ts +2 -2
- package/dist/chunk-4FP4V35O.js +13 -0
- package/dist/{chunk-NWDKXBIP.js → chunk-MRCKUMOS.js} +62 -22
- package/dist/{chunk-LWMRB6SD.js → chunk-S7OKGLFD.js} +615 -198
- package/dist/{clientTypes-Y43CKbOz.d.cts → clientTypes-BSbwairE.d.cts} +38 -13
- package/dist/{clientTypes-PQha8zes.d.ts → clientTypes-DDmcgZ0a.d.ts} +38 -13
- package/dist/core.cjs +691 -235
- package/dist/core.d.cts +24 -6
- package/dist/core.d.ts +24 -6
- package/dist/core.js +3 -2
- package/dist/node.cjs +696 -237
- package/dist/node.d.cts +3 -3
- package/dist/node.d.ts +3 -3
- package/dist/node.js +14 -7
- package/dist/{permit-MZ502UBl.d.ts → permit-DnVMDT5h.d.cts} +34 -4
- package/dist/{permit-MZ502UBl.d.cts → permit-DnVMDT5h.d.ts} +34 -4
- package/dist/permits.cjs +66 -29
- package/dist/permits.d.cts +18 -13
- package/dist/permits.d.ts +18 -13
- package/dist/permits.js +2 -1
- package/dist/web.cjs +718 -242
- package/dist/web.d.cts +8 -4
- package/dist/web.d.ts +8 -4
- package/dist/web.js +34 -11
- package/dist/zkProve.worker.cjs +6 -3
- package/dist/zkProve.worker.js +5 -3
- package/node/index.ts +13 -4
- package/node/test/client.test.ts +25 -0
- package/node/test/config.test.ts +16 -0
- package/node/test/inherited.test.ts +244 -0
- package/node/test/tfheinit.test.ts +56 -0
- package/package.json +24 -22
- package/permits/permit.ts +31 -5
- package/permits/sealing.ts +1 -1
- package/permits/{localstorage.test.ts → test/localstorage.test.ts} +2 -2
- package/permits/{permit.test.ts → test/permit.test.ts} +35 -1
- package/permits/{sealing.test.ts → test/sealing.test.ts} +1 -1
- package/permits/{store.test.ts → test/store.test.ts} +2 -2
- package/permits/{validation.test.ts → test/validation.test.ts} +82 -6
- package/permits/types.ts +1 -1
- package/permits/validation.ts +42 -2
- package/web/const.ts +2 -0
- package/web/index.ts +20 -6
- package/web/storage.ts +18 -3
- package/web/{client.web.test.ts → test/client.web.test.ts} +13 -1
- package/web/test/config.web.test.ts +16 -0
- package/web/test/inherited.web.test.ts +245 -0
- package/web/test/tfheinit.web.test.ts +62 -0
- package/web/{worker.config.web.test.ts → test/worker.config.web.test.ts} +1 -1
- package/web/{worker.output.web.test.ts → test/worker.output.web.test.ts} +1 -1
- package/web/{workerManager.test.ts → test/workerManager.test.ts} +1 -1
- package/web/{workerManager.web.test.ts → test/workerManager.web.test.ts} +1 -1
- package/web/zkProve.worker.ts +4 -3
- package/node/client.test.ts +0 -147
- package/node/config.test.ts +0 -68
- package/node/encryptInputs.test.ts +0 -155
- package/web/config.web.test.ts +0 -69
- package/web/encryptInputs.web.test.ts +0 -172
- package/web/worker.builder.web.test.ts +0 -148
- /package/dist/{types-YiAC4gig.d.cts → types-C07FK-cL.d.cts} +0 -0
- /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-
|
|
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-
|
|
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
|
-
|
|
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) =>
|
|
898
|
-
getPermits: (chainId: number, account: string) =>
|
|
899
|
-
getActivePermit: (chainId: number, account: string) =>
|
|
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) =>
|
|
953
|
-
getPermits: (chainId?: number, account?: string) =>
|
|
954
|
-
getActivePermit: (chainId?: number, account?: string) =>
|
|
955
|
-
getActivePermitHash: (chainId?: number, account?: string) =>
|
|
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 {
|
|
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-
|
|
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-
|
|
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
|
-
|
|
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) =>
|
|
898
|
-
getPermits: (chainId: number, account: string) =>
|
|
899
|
-
getActivePermit: (chainId: number, account: string) =>
|
|
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) =>
|
|
953
|
-
getPermits: (chainId?: number, account?: string) =>
|
|
954
|
-
getActivePermit: (chainId?: number, account?: string) =>
|
|
955
|
-
getActivePermitHash: (chainId?: number, account?: string) =>
|
|
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 {
|
|
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 };
|