@cofhe/sdk 0.6.0 → 0.7.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 +49 -0
- package/acps/acp.ts +411 -0
- package/acps/index.ts +70 -0
- package/{permits → acps}/onchain-utils.ts +49 -24
- package/acps/sealing.ts +90 -0
- package/acps/signature.ts +89 -0
- package/acps/store.ts +172 -0
- package/acps/test/acp.test.ts +615 -0
- package/acps/test/localstorage.test.ts +105 -0
- package/acps/test/sealing.test.ts +77 -0
- package/acps/test/store.test.ts +88 -0
- package/acps/test/validation.test.ts +361 -0
- package/acps/test-utils.ts +32 -0
- package/acps/types.ts +252 -0
- package/acps/validation.ts +392 -0
- package/adapters/test/ethers5.test.ts +4 -1
- package/adapters/test/ethers6.test.ts +4 -1
- package/adapters/test/wagmi.test.ts +5 -2
- package/chains/chains/stagingCofhe.ts +21 -0
- package/chains/index.ts +3 -1
- package/chains/test/chains.test.ts +2 -1
- package/core/acps.ts +625 -0
- package/core/client.ts +136 -39
- package/core/clientTypes.ts +52 -41
- package/core/config.ts +66 -5
- package/core/debug.ts +72 -0
- package/core/decrypt/MockThresholdNetworkAbi.ts +20 -11
- package/core/decrypt/apiError.ts +104 -0
- package/core/decrypt/cofheMocksDecryptForTx.ts +11 -11
- package/core/decrypt/cofheMocksDecryptForView.ts +7 -7
- package/core/decrypt/decryptForTxBuilder.ts +102 -102
- package/core/decrypt/decryptForViewBuilder.ts +90 -90
- package/core/decrypt/submitRetry.ts +38 -30
- package/core/decrypt/tnDecryptV1.ts +5 -5
- package/core/decrypt/tnDecryptV2.ts +45 -34
- package/core/decrypt/tnSealOutputV1.ts +4 -3
- package/core/decrypt/tnSealOutputV2.ts +44 -31
- package/core/encrypt/cofheMocksZkVerifySign.ts +59 -74
- package/core/encrypt/encryptInputsBuilder.ts +86 -52
- package/core/encrypt/zkPackProveVerify.ts +25 -18
- package/core/error.ts +34 -6
- package/core/index.ts +14 -14
- package/core/test/acpDefaults.test.ts +52 -0
- package/core/test/acps.test.ts +596 -0
- package/core/test/apiError.test.ts +130 -0
- package/core/test/client.test.ts +22 -19
- package/core/test/config.test.ts +25 -5
- package/core/test/decrypt.test.ts +40 -35
- package/core/test/decryptBuilders.test.ts +68 -68
- package/core/test/decryptErrorCodes.test.ts +217 -0
- package/core/test/encryptInputsBuilder.test.ts +72 -41
- package/core/test/pollCallbacks.test.ts +89 -18
- package/core/test/stagingRedirect.ts +18 -0
- package/core/test/submitRetry.test.ts +182 -0
- package/core/types.ts +9 -69
- package/dist/acp-Wi6isVQI.d.cts +407 -0
- package/dist/acp-Wi6isVQI.d.ts +407 -0
- package/dist/acps.cjs +1081 -0
- package/dist/acps.d.cts +480 -0
- package/dist/acps.d.ts +480 -0
- package/dist/acps.js +2 -0
- package/dist/chains.cjs +14 -1
- package/dist/chains.d.cts +30 -1
- package/dist/chains.d.ts +30 -1
- package/dist/chains.js +1 -1
- package/dist/{chunk-PE5V5CCV.js → chunk-43USWPEH.js} +1000 -604
- package/dist/{chunk-MTRAXQXC.js → chunk-N6IDQRRU.js} +14 -2
- package/dist/chunk-Q7CBWGQX.js +1029 -0
- package/dist/{clientTypes-CyUvRRzA.d.ts → clientTypes-BN3nbzYM.d.ts} +342 -165
- package/dist/{clientTypes-BDy1qIBu.d.cts → clientTypes-CYZjFznO.d.cts} +342 -165
- package/dist/core.cjs +1431 -1026
- package/dist/core.d.cts +55 -10
- package/dist/core.d.ts +55 -10
- package/dist/core.js +3 -3
- package/dist/node.cjs +1356 -976
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +3 -3
- package/dist/web.cjs +1356 -976
- package/dist/web.d.cts +2 -2
- package/dist/web.d.ts +2 -2
- package/dist/web.js +3 -3
- package/node/test/inherited.test.ts +75 -65
- package/node/test/tfheinit.test.ts +23 -8
- package/package.json +6 -6
- package/web/test/client.web.test.ts +5 -1
- package/web/test/inherited.web.test.ts +75 -65
- package/web/test/tfheinit.web.test.ts +14 -5
- package/web/test/worker.config.web.test.ts +38 -23
- package/web/test/worker.output.web.test.ts +25 -24
- package/core/encrypt/encryptUtils.ts +0 -67
- package/core/permits.ts +0 -206
- package/core/test/permits.test.ts +0 -534
- package/dist/chunk-VB62WYPL.js +0 -978
- package/dist/permit-DnVMDT5h.d.cts +0 -376
- package/dist/permit-DnVMDT5h.d.ts +0 -376
- package/dist/permits.cjs +0 -1026
- package/dist/permits.d.cts +0 -353
- package/dist/permits.d.ts +0 -353
- package/dist/permits.js +0 -2
- package/permits/index.ts +0 -68
- package/permits/permit.ts +0 -385
- package/permits/sealing.ts +0 -131
- package/permits/signature.ts +0 -79
- package/permits/store.ts +0 -157
- package/permits/test/localstorage.test.ts +0 -113
- package/permits/test/permit.test.ts +0 -557
- package/permits/test/sealing.test.ts +0 -84
- package/permits/test/store.test.ts +0 -88
- package/permits/test/validation.test.ts +0 -361
- package/permits/test-utils.ts +0 -28
- package/permits/types.ts +0 -204
- package/permits/validation.ts +0 -327
- /package/{permits → acps}/utils.ts +0 -0
package/dist/core.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-
|
|
2
|
-
export {
|
|
1
|
+
import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-CYZjFznO.cjs';
|
|
2
|
+
export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a2 as DecryptForTxBuilder, a3 as DecryptForTxResult, a1 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, $ as EncryptInputsBuilder, a0 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, T as EncryptStep, N as EncryptStepCallbackContext, R as Encryptable, p as EncryptableAddress, j as EncryptableBool, E as EncryptableItem, B as EncryptableToExternalHashMap, o as EncryptableUint128, l as EncryptableUint16, m as EncryptableUint32, n as EncryptableUint64, k as EncryptableUint8, q as EncryptedNumber, y as ExternalAddressHash, s as ExternalBoolHash, z as ExternalHashProof, D as ExternalItemHashes, x as ExternalUint128Hash, u as ExternalUint16Hash, v as ExternalUint32Hash, w as ExternalUint64Hash, t as ExternalUint8Hash, Q as FheAllUTypes, X as FheKeyDeserializer, r as FheTypeValue, O as FheUintUTypes, H as HashPlusProofResult, I as IStorage, Z as KeysStorage, _ as KeysStore, L as LiteralToPrimitive, P as Primitive, U as UnsealedItem, a4 as ZkBuilderAndCrsGenerator, a5 as ZkProveWorkerFunction, a6 as ZkProveWorkerRequest, a7 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, Y as createKeysStore, W as fetchKeys, g as getCofheConfigItem, S as isEncryptableItem, V as isLastEncryptionStep, a8 as zkProveWithWorker } from './clientTypes-CYZjFznO.cjs';
|
|
3
3
|
import { Hex, PublicClient } from 'viem';
|
|
4
4
|
import './types-C07FK-cL.cjs';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './
|
|
6
|
+
import './acp-Wi6isVQI.cjs';
|
|
7
7
|
import 'zustand/vanilla';
|
|
8
8
|
|
|
9
9
|
declare const InitialConnectStore: CofheClientConnectionState;
|
|
@@ -14,6 +14,29 @@ declare const InitialConnectStore: CofheClientConnectionState;
|
|
|
14
14
|
*/
|
|
15
15
|
declare function createCofheClientBase<TConfig extends CofheConfig>(opts: CofheClientParams<TConfig>): CofheClient<TConfig>;
|
|
16
16
|
|
|
17
|
+
interface CofheRequestContext {
|
|
18
|
+
/** Coarse label for the call site, e.g. 'decrypt' | 'sealoutput' | 'fetchKeys'. */
|
|
19
|
+
op: string;
|
|
20
|
+
}
|
|
21
|
+
interface CofheRequestOverride {
|
|
22
|
+
url?: string;
|
|
23
|
+
init?: RequestInit;
|
|
24
|
+
}
|
|
25
|
+
type CofheOnRequest = (url: string, init: RequestInit | undefined, ctx: CofheRequestContext) => CofheRequestOverride | void | Promise<CofheRequestOverride | void>;
|
|
26
|
+
type CofheOnResponse = (response: Response, ctx: CofheRequestContext) => Response | void | Promise<Response | void>;
|
|
27
|
+
interface CofheDebugInterceptors {
|
|
28
|
+
onRequest?: CofheOnRequest;
|
|
29
|
+
onResponse?: CofheOnResponse;
|
|
30
|
+
}
|
|
31
|
+
/** Register (or clear, with null) the debug interceptors. */
|
|
32
|
+
declare function setCofheDebugInterceptors(next: CofheDebugInterceptors | null): void;
|
|
33
|
+
declare function getCofheDebugInterceptors(): CofheDebugInterceptors;
|
|
34
|
+
/**
|
|
35
|
+
* fetch() wrapper used by all low-level SDK network ops. Applies the registered
|
|
36
|
+
* debug interceptors when present; otherwise behaves exactly like fetch().
|
|
37
|
+
*/
|
|
38
|
+
declare function cofheFetch(url: string, init?: RequestInit, ctx?: CofheRequestContext): Promise<Response>;
|
|
39
|
+
|
|
17
40
|
declare enum CofheErrorCode {
|
|
18
41
|
InternalError = "INTERNAL_ERROR",
|
|
19
42
|
UnknownEnvironment = "UNKNOWN_ENVIRONMENT",
|
|
@@ -25,12 +48,13 @@ declare enum CofheErrorCode {
|
|
|
25
48
|
MissingWalletClient = "MISSING_WALLET_CLIENT",
|
|
26
49
|
MissingProviderParam = "MISSING_PROVIDER_PARAM",
|
|
27
50
|
EmptySecurityZonesParam = "EMPTY_SECURITY_ZONES_PARAM",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
51
|
+
InvalidACPData = "INVALID_ACP_DATA",
|
|
52
|
+
InvalidACPDomain = "INVALID_ACP_DOMAIN",
|
|
53
|
+
ACPNotFound = "ACP_NOT_FOUND",
|
|
54
|
+
CannotRemoveLastACP = "CANNOT_REMOVE_LAST_ACP",
|
|
32
55
|
AccountUninitialized = "ACCOUNT_UNINITIALIZED",
|
|
33
56
|
ChainIdUninitialized = "CHAIN_ID_UNINITIALIZED",
|
|
57
|
+
ConsumingContractUninitialized = "CONSUMING_CONTRACT_UNINITIALIZED",
|
|
34
58
|
SealOutputFailed = "SEAL_OUTPUT_FAILED",
|
|
35
59
|
SealOutputReturnedNull = "SEAL_OUTPUT_RETURNED_NULL",
|
|
36
60
|
InvalidUtype = "INVALID_UTYPE",
|
|
@@ -57,7 +81,25 @@ declare enum CofheErrorCode {
|
|
|
57
81
|
FetchKeysFailed = "FETCH_KEYS_FAILED",
|
|
58
82
|
PublicWalletGetChainIdFailed = "PUBLIC_WALLET_GET_CHAIN_ID_FAILED",
|
|
59
83
|
PublicWalletGetAddressesFailed = "PUBLIC_WALLET_GET_ADDRESSES_FAILED",
|
|
60
|
-
RehydrateKeysStoreFailed = "REHYDRATE_KEYS_STORE_FAILED"
|
|
84
|
+
RehydrateKeysStoreFailed = "REHYDRATE_KEYS_STORE_FAILED",
|
|
85
|
+
BadRequest = "BAD_REQUEST",
|
|
86
|
+
UnknownChain = "UNKNOWN_CHAIN",
|
|
87
|
+
ACPMalformed = "ACP_MALFORMED",
|
|
88
|
+
ACPDenied = "ACP_DENIED",
|
|
89
|
+
ACPExpired = "ACP_EXPIRED",
|
|
90
|
+
ACPInvalid = "ACP_INVALID",
|
|
91
|
+
ACPRevoked = "ACP_REVOKED",
|
|
92
|
+
NotPubliclyAllowed = "NOT_PUBLICLY_ALLOWED",
|
|
93
|
+
CtNotFound = "CT_NOT_FOUND",
|
|
94
|
+
UnsupportedSecurityZone = "UNSUPPORTED_SECURITY_ZONE",
|
|
95
|
+
UnsupportedType = "UNSUPPORTED_TYPE",
|
|
96
|
+
SigningFailed = "SIGNING_FAILED",
|
|
97
|
+
CtSourceError = "CT_SOURCE_ERROR",
|
|
98
|
+
ACPVerifierError = "ACP_VERIFIER_ERROR",
|
|
99
|
+
CtSourceTimeout = "CT_SOURCE_TIMEOUT",
|
|
100
|
+
ACPVerifierTimeout = "ACP_VERIFIER_TIMEOUT",
|
|
101
|
+
ACPRequired = "ACP_REQUIRED",
|
|
102
|
+
SealFailed = "SEAL_FAILED"
|
|
61
103
|
}
|
|
62
104
|
type CofheErrorParams = {
|
|
63
105
|
code: CofheErrorCode;
|
|
@@ -65,6 +107,8 @@ type CofheErrorParams = {
|
|
|
65
107
|
cause?: Error;
|
|
66
108
|
hint?: string;
|
|
67
109
|
context?: Record<string, unknown>;
|
|
110
|
+
/** Raw backend `error` string, when this error originated from a threshold-network response. */
|
|
111
|
+
apiErrorCode?: string;
|
|
68
112
|
};
|
|
69
113
|
/**
|
|
70
114
|
* CofheError class
|
|
@@ -82,7 +126,8 @@ declare class CofheError extends Error {
|
|
|
82
126
|
readonly cause?: Error;
|
|
83
127
|
readonly hint?: string;
|
|
84
128
|
readonly context?: Record<string, unknown>;
|
|
85
|
-
|
|
129
|
+
readonly apiErrorCode?: string;
|
|
130
|
+
constructor({ code, message, cause, hint, context, apiErrorCode }: CofheErrorParams);
|
|
86
131
|
/**
|
|
87
132
|
* Creates a CofheError from an unknown error
|
|
88
133
|
* If the error is a CofheError, it is returned unchanged, else a new CofheError is created
|
|
@@ -137,4 +182,4 @@ declare function verifyDecryptResult(handle: bigint | string, cleartext: bigint,
|
|
|
137
182
|
*/
|
|
138
183
|
declare function fheTypeToString(utype: FheTypes): string;
|
|
139
184
|
|
|
140
|
-
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, CofheClient, CofheClientConnectionState, CofheClientParams, CofheConfig, CofheError, CofheErrorCode, type CofheErrorParams, FheTypes, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ADDRESS, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, createCofheClientBase, fheTypeToString, isCofheError, verifyDecryptResult };
|
|
185
|
+
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, CofheClient, CofheClientConnectionState, CofheClientParams, CofheConfig, type CofheDebugInterceptors, CofheError, CofheErrorCode, type CofheErrorParams, type CofheOnRequest, type CofheOnResponse, type CofheRequestContext, type CofheRequestOverride, FheTypes, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ADDRESS, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, cofheFetch, createCofheClientBase, fheTypeToString, getCofheDebugInterceptors, isCofheError, setCofheDebugInterceptors, verifyDecryptResult };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-
|
|
2
|
-
export {
|
|
1
|
+
import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-BN3nbzYM.js';
|
|
2
|
+
export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a2 as DecryptForTxBuilder, a3 as DecryptForTxResult, a1 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, $ as EncryptInputsBuilder, a0 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, T as EncryptStep, N as EncryptStepCallbackContext, R as Encryptable, p as EncryptableAddress, j as EncryptableBool, E as EncryptableItem, B as EncryptableToExternalHashMap, o as EncryptableUint128, l as EncryptableUint16, m as EncryptableUint32, n as EncryptableUint64, k as EncryptableUint8, q as EncryptedNumber, y as ExternalAddressHash, s as ExternalBoolHash, z as ExternalHashProof, D as ExternalItemHashes, x as ExternalUint128Hash, u as ExternalUint16Hash, v as ExternalUint32Hash, w as ExternalUint64Hash, t as ExternalUint8Hash, Q as FheAllUTypes, X as FheKeyDeserializer, r as FheTypeValue, O as FheUintUTypes, H as HashPlusProofResult, I as IStorage, Z as KeysStorage, _ as KeysStore, L as LiteralToPrimitive, P as Primitive, U as UnsealedItem, a4 as ZkBuilderAndCrsGenerator, a5 as ZkProveWorkerFunction, a6 as ZkProveWorkerRequest, a7 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, Y as createKeysStore, W as fetchKeys, g as getCofheConfigItem, S as isEncryptableItem, V as isLastEncryptionStep, a8 as zkProveWithWorker } from './clientTypes-BN3nbzYM.js';
|
|
3
3
|
import { Hex, PublicClient } from 'viem';
|
|
4
4
|
import './types-C07FK-cL.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './
|
|
6
|
+
import './acp-Wi6isVQI.js';
|
|
7
7
|
import 'zustand/vanilla';
|
|
8
8
|
|
|
9
9
|
declare const InitialConnectStore: CofheClientConnectionState;
|
|
@@ -14,6 +14,29 @@ declare const InitialConnectStore: CofheClientConnectionState;
|
|
|
14
14
|
*/
|
|
15
15
|
declare function createCofheClientBase<TConfig extends CofheConfig>(opts: CofheClientParams<TConfig>): CofheClient<TConfig>;
|
|
16
16
|
|
|
17
|
+
interface CofheRequestContext {
|
|
18
|
+
/** Coarse label for the call site, e.g. 'decrypt' | 'sealoutput' | 'fetchKeys'. */
|
|
19
|
+
op: string;
|
|
20
|
+
}
|
|
21
|
+
interface CofheRequestOverride {
|
|
22
|
+
url?: string;
|
|
23
|
+
init?: RequestInit;
|
|
24
|
+
}
|
|
25
|
+
type CofheOnRequest = (url: string, init: RequestInit | undefined, ctx: CofheRequestContext) => CofheRequestOverride | void | Promise<CofheRequestOverride | void>;
|
|
26
|
+
type CofheOnResponse = (response: Response, ctx: CofheRequestContext) => Response | void | Promise<Response | void>;
|
|
27
|
+
interface CofheDebugInterceptors {
|
|
28
|
+
onRequest?: CofheOnRequest;
|
|
29
|
+
onResponse?: CofheOnResponse;
|
|
30
|
+
}
|
|
31
|
+
/** Register (or clear, with null) the debug interceptors. */
|
|
32
|
+
declare function setCofheDebugInterceptors(next: CofheDebugInterceptors | null): void;
|
|
33
|
+
declare function getCofheDebugInterceptors(): CofheDebugInterceptors;
|
|
34
|
+
/**
|
|
35
|
+
* fetch() wrapper used by all low-level SDK network ops. Applies the registered
|
|
36
|
+
* debug interceptors when present; otherwise behaves exactly like fetch().
|
|
37
|
+
*/
|
|
38
|
+
declare function cofheFetch(url: string, init?: RequestInit, ctx?: CofheRequestContext): Promise<Response>;
|
|
39
|
+
|
|
17
40
|
declare enum CofheErrorCode {
|
|
18
41
|
InternalError = "INTERNAL_ERROR",
|
|
19
42
|
UnknownEnvironment = "UNKNOWN_ENVIRONMENT",
|
|
@@ -25,12 +48,13 @@ declare enum CofheErrorCode {
|
|
|
25
48
|
MissingWalletClient = "MISSING_WALLET_CLIENT",
|
|
26
49
|
MissingProviderParam = "MISSING_PROVIDER_PARAM",
|
|
27
50
|
EmptySecurityZonesParam = "EMPTY_SECURITY_ZONES_PARAM",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
51
|
+
InvalidACPData = "INVALID_ACP_DATA",
|
|
52
|
+
InvalidACPDomain = "INVALID_ACP_DOMAIN",
|
|
53
|
+
ACPNotFound = "ACP_NOT_FOUND",
|
|
54
|
+
CannotRemoveLastACP = "CANNOT_REMOVE_LAST_ACP",
|
|
32
55
|
AccountUninitialized = "ACCOUNT_UNINITIALIZED",
|
|
33
56
|
ChainIdUninitialized = "CHAIN_ID_UNINITIALIZED",
|
|
57
|
+
ConsumingContractUninitialized = "CONSUMING_CONTRACT_UNINITIALIZED",
|
|
34
58
|
SealOutputFailed = "SEAL_OUTPUT_FAILED",
|
|
35
59
|
SealOutputReturnedNull = "SEAL_OUTPUT_RETURNED_NULL",
|
|
36
60
|
InvalidUtype = "INVALID_UTYPE",
|
|
@@ -57,7 +81,25 @@ declare enum CofheErrorCode {
|
|
|
57
81
|
FetchKeysFailed = "FETCH_KEYS_FAILED",
|
|
58
82
|
PublicWalletGetChainIdFailed = "PUBLIC_WALLET_GET_CHAIN_ID_FAILED",
|
|
59
83
|
PublicWalletGetAddressesFailed = "PUBLIC_WALLET_GET_ADDRESSES_FAILED",
|
|
60
|
-
RehydrateKeysStoreFailed = "REHYDRATE_KEYS_STORE_FAILED"
|
|
84
|
+
RehydrateKeysStoreFailed = "REHYDRATE_KEYS_STORE_FAILED",
|
|
85
|
+
BadRequest = "BAD_REQUEST",
|
|
86
|
+
UnknownChain = "UNKNOWN_CHAIN",
|
|
87
|
+
ACPMalformed = "ACP_MALFORMED",
|
|
88
|
+
ACPDenied = "ACP_DENIED",
|
|
89
|
+
ACPExpired = "ACP_EXPIRED",
|
|
90
|
+
ACPInvalid = "ACP_INVALID",
|
|
91
|
+
ACPRevoked = "ACP_REVOKED",
|
|
92
|
+
NotPubliclyAllowed = "NOT_PUBLICLY_ALLOWED",
|
|
93
|
+
CtNotFound = "CT_NOT_FOUND",
|
|
94
|
+
UnsupportedSecurityZone = "UNSUPPORTED_SECURITY_ZONE",
|
|
95
|
+
UnsupportedType = "UNSUPPORTED_TYPE",
|
|
96
|
+
SigningFailed = "SIGNING_FAILED",
|
|
97
|
+
CtSourceError = "CT_SOURCE_ERROR",
|
|
98
|
+
ACPVerifierError = "ACP_VERIFIER_ERROR",
|
|
99
|
+
CtSourceTimeout = "CT_SOURCE_TIMEOUT",
|
|
100
|
+
ACPVerifierTimeout = "ACP_VERIFIER_TIMEOUT",
|
|
101
|
+
ACPRequired = "ACP_REQUIRED",
|
|
102
|
+
SealFailed = "SEAL_FAILED"
|
|
61
103
|
}
|
|
62
104
|
type CofheErrorParams = {
|
|
63
105
|
code: CofheErrorCode;
|
|
@@ -65,6 +107,8 @@ type CofheErrorParams = {
|
|
|
65
107
|
cause?: Error;
|
|
66
108
|
hint?: string;
|
|
67
109
|
context?: Record<string, unknown>;
|
|
110
|
+
/** Raw backend `error` string, when this error originated from a threshold-network response. */
|
|
111
|
+
apiErrorCode?: string;
|
|
68
112
|
};
|
|
69
113
|
/**
|
|
70
114
|
* CofheError class
|
|
@@ -82,7 +126,8 @@ declare class CofheError extends Error {
|
|
|
82
126
|
readonly cause?: Error;
|
|
83
127
|
readonly hint?: string;
|
|
84
128
|
readonly context?: Record<string, unknown>;
|
|
85
|
-
|
|
129
|
+
readonly apiErrorCode?: string;
|
|
130
|
+
constructor({ code, message, cause, hint, context, apiErrorCode }: CofheErrorParams);
|
|
86
131
|
/**
|
|
87
132
|
* Creates a CofheError from an unknown error
|
|
88
133
|
* If the error is a CofheError, it is returned unchanged, else a new CofheError is created
|
|
@@ -137,4 +182,4 @@ declare function verifyDecryptResult(handle: bigint | string, cleartext: bigint,
|
|
|
137
182
|
*/
|
|
138
183
|
declare function fheTypeToString(utype: FheTypes): string;
|
|
139
184
|
|
|
140
|
-
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, CofheClient, CofheClientConnectionState, CofheClientParams, CofheConfig, CofheError, CofheErrorCode, type CofheErrorParams, FheTypes, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ADDRESS, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, createCofheClientBase, fheTypeToString, isCofheError, verifyDecryptResult };
|
|
185
|
+
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, CofheClient, CofheClientConnectionState, CofheClientParams, CofheConfig, type CofheDebugInterceptors, CofheError, CofheErrorCode, type CofheErrorParams, type CofheOnRequest, type CofheOnResponse, type CofheRequestContext, type CofheRequestOverride, FheTypes, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ADDRESS, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, cofheFetch, createCofheClientBase, fheTypeToString, getCofheDebugInterceptors, isCofheError, setCofheDebugInterceptors, verifyDecryptResult };
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, CofheError, CofheErrorCode, DecryptForTxBuilder, DecryptForViewBuilder, EncryptInputsBuilder, EncryptStep, Encryptable, FheAllUTypes, FheTypes, FheUintUTypes,
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, CofheError, CofheErrorCode, DecryptForTxBuilder, DecryptForViewBuilder, EncryptInputsBuilder, EncryptStep, Encryptable, FheAllUTypes, FheTypes, FheUintUTypes, assertNoRenamedConfigKeys, cofheFetch, createCofheClientBase, createCofheConfigBase, createKeysStore, fetchKeys, fheTypeToString, getCofheConfigItem, getCofheDebugInterceptors, isCofheError, isEncryptableItem, isLastEncryptionStep, setCofheDebugInterceptors, verifyDecryptResult, zkProveWithWorker } from './chunk-43USWPEH.js';
|
|
2
|
+
import './chunk-N6IDQRRU.js';
|
|
3
|
+
import './chunk-Q7CBWGQX.js';
|
|
4
4
|
export { MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ADDRESS, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS } from './chunk-ESMZCFJY.js';
|