@cofhe/sdk 1.0.0-alpha.0 → 1.1.0-alpha.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 +51 -0
- package/acps/onchain-utils.ts +15 -10
- package/acps/sealing.ts +22 -2
- package/acps/test/aclServedAddresses.test.ts +65 -0
- package/acps/test/sealing.test.ts +51 -0
- package/core/acps.ts +64 -23
- package/core/client.ts +32 -1
- package/core/clientTypes.ts +22 -1
- package/core/test/acpsPrepare.test.ts +77 -0
- package/dist/acps.cjs +122 -99
- package/dist/acps.d.cts +4 -358
- package/dist/acps.d.ts +4 -358
- package/dist/acps.js +2 -2
- package/dist/{chunk-OL3DZN7A.js → chunk-2EO4JSR7.js} +65 -23
- package/dist/{chunk-BQWHPIYU.js → chunk-3L2IVPMI.js} +29 -6
- package/dist/{chunk-6ZW76ZKB.js → chunk-WJGTPW7K.js} +1 -1
- package/dist/{clientTypes-CcU5WvdV.d.ts → clientTypes-CnslFzxB.d.ts} +38 -2
- package/dist/{clientTypes-C0A9ji5O.d.cts → clientTypes-RXwLVWou.d.cts} +38 -2
- package/dist/core.cjs +250 -185
- package/dist/core.d.cts +3 -3
- package/dist/core.d.ts +3 -3
- package/dist/core.js +4 -4
- package/dist/node.cjs +184 -119
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +4 -4
- package/dist/{onchain-utils-D9Z33IP7.d.ts → onchain-utils-Ns56cBm0.d.cts} +359 -5
- package/dist/{onchain-utils-D9Z33IP7.d.cts → onchain-utils-Ns56cBm0.d.ts} +359 -5
- package/dist/web.cjs +184 -119
- package/dist/web.d.cts +2 -2
- package/dist/web.d.ts +2 -2
- package/dist/web.js +4 -4
- package/dist/zkProve.worker.js +2 -2
- package/package.json +1 -1
- package/dist/{chunk-XQ32JG3T.js → chunk-J23FYAI2.js} +13 -13
package/dist/core.cjs
CHANGED
|
@@ -41,6 +41,166 @@ function toBigInt(value) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// core/error.ts
|
|
45
|
+
var CofheErrorCode = /* @__PURE__ */ ((CofheErrorCode2) => {
|
|
46
|
+
CofheErrorCode2["InternalError"] = "INTERNAL_ERROR";
|
|
47
|
+
CofheErrorCode2["UnknownEnvironment"] = "UNKNOWN_ENVIRONMENT";
|
|
48
|
+
CofheErrorCode2["InitTfheFailed"] = "INIT_TFHE_FAILED";
|
|
49
|
+
CofheErrorCode2["InitViemFailed"] = "INIT_VIEM_FAILED";
|
|
50
|
+
CofheErrorCode2["InitEthersFailed"] = "INIT_ETHERS_FAILED";
|
|
51
|
+
CofheErrorCode2["NotConnected"] = "NOT_CONNECTED";
|
|
52
|
+
CofheErrorCode2["MissingPublicClient"] = "MISSING_PUBLIC_CLIENT";
|
|
53
|
+
CofheErrorCode2["MissingWalletClient"] = "MISSING_WALLET_CLIENT";
|
|
54
|
+
CofheErrorCode2["MissingProviderParam"] = "MISSING_PROVIDER_PARAM";
|
|
55
|
+
CofheErrorCode2["EmptySecurityZonesParam"] = "EMPTY_SECURITY_ZONES_PARAM";
|
|
56
|
+
CofheErrorCode2["InvalidACPData"] = "INVALID_ACP_DATA";
|
|
57
|
+
CofheErrorCode2["InvalidACPDomain"] = "INVALID_ACP_DOMAIN";
|
|
58
|
+
CofheErrorCode2["ACPNotFound"] = "ACP_NOT_FOUND";
|
|
59
|
+
CofheErrorCode2["CannotRemoveLastACP"] = "CANNOT_REMOVE_LAST_ACP";
|
|
60
|
+
CofheErrorCode2["AccountUninitialized"] = "ACCOUNT_UNINITIALIZED";
|
|
61
|
+
CofheErrorCode2["ChainIdUninitialized"] = "CHAIN_ID_UNINITIALIZED";
|
|
62
|
+
CofheErrorCode2["ConsumingContractUninitialized"] = "CONSUMING_CONTRACT_UNINITIALIZED";
|
|
63
|
+
CofheErrorCode2["SealOutputFailed"] = "SEAL_OUTPUT_FAILED";
|
|
64
|
+
CofheErrorCode2["SealOutputReturnedNull"] = "SEAL_OUTPUT_RETURNED_NULL";
|
|
65
|
+
CofheErrorCode2["InvalidUtype"] = "INVALID_UTYPE";
|
|
66
|
+
CofheErrorCode2["DecryptFailed"] = "DECRYPT_FAILED";
|
|
67
|
+
CofheErrorCode2["DecryptReturnedNull"] = "DECRYPT_RETURNED_NULL";
|
|
68
|
+
CofheErrorCode2["ZkMocksInsertCtHashesFailed"] = "ZK_MOCKS_INSERT_CT_HASHES_FAILED";
|
|
69
|
+
CofheErrorCode2["ZkMocksCalcCtHashesFailed"] = "ZK_MOCKS_CALC_CT_HASHES_FAILED";
|
|
70
|
+
CofheErrorCode2["ZkMocksVerifySignFailed"] = "ZK_MOCKS_VERIFY_SIGN_FAILED";
|
|
71
|
+
CofheErrorCode2["ZkMocksCreateProofSignatureFailed"] = "ZK_MOCKS_CREATE_PROOF_SIGNATURE_FAILED";
|
|
72
|
+
CofheErrorCode2["ZkVerifyFailed"] = "ZK_VERIFY_FAILED";
|
|
73
|
+
CofheErrorCode2["ZkPackFailed"] = "ZK_PACK_FAILED";
|
|
74
|
+
CofheErrorCode2["ZkProveFailed"] = "ZK_PROVE_FAILED";
|
|
75
|
+
CofheErrorCode2["EncryptRemainingInItems"] = "ENCRYPT_REMAINING_IN_ITEMS";
|
|
76
|
+
CofheErrorCode2["ZkUninitialized"] = "ZK_UNINITIALIZED";
|
|
77
|
+
CofheErrorCode2["ZkVerifierUrlUninitialized"] = "ZK_VERIFIER_URL_UNINITIALIZED";
|
|
78
|
+
CofheErrorCode2["ThresholdNetworkUrlUninitialized"] = "THRESHOLD_NETWORK_URL_UNINITIALIZED";
|
|
79
|
+
CofheErrorCode2["MissingConfig"] = "MISSING_CONFIG";
|
|
80
|
+
CofheErrorCode2["UnsupportedChain"] = "UNSUPPORTED_CHAIN";
|
|
81
|
+
CofheErrorCode2["MissingZkBuilderAndCrsGenerator"] = "MISSING_ZK_BUILDER_AND_CRS_GENERATOR";
|
|
82
|
+
CofheErrorCode2["MissingTfhePublicKeyDeserializer"] = "MISSING_TFHE_PUBLIC_KEY_DESERIALIZER";
|
|
83
|
+
CofheErrorCode2["MissingCompactPkeCrsDeserializer"] = "MISSING_COMPACT_PKE_CRS_DESERIALIZER";
|
|
84
|
+
CofheErrorCode2["MissingFheKey"] = "MISSING_FHE_KEY";
|
|
85
|
+
CofheErrorCode2["MissingCrs"] = "MISSING_CRS";
|
|
86
|
+
CofheErrorCode2["FetchKeysFailed"] = "FETCH_KEYS_FAILED";
|
|
87
|
+
CofheErrorCode2["PublicWalletGetChainIdFailed"] = "PUBLIC_WALLET_GET_CHAIN_ID_FAILED";
|
|
88
|
+
CofheErrorCode2["PublicWalletGetAddressesFailed"] = "PUBLIC_WALLET_GET_ADDRESSES_FAILED";
|
|
89
|
+
CofheErrorCode2["RehydrateKeysStoreFailed"] = "REHYDRATE_KEYS_STORE_FAILED";
|
|
90
|
+
CofheErrorCode2["TaskManagerUnresolved"] = "TASK_MANAGER_UNRESOLVED";
|
|
91
|
+
CofheErrorCode2["BadRequest"] = "BAD_REQUEST";
|
|
92
|
+
CofheErrorCode2["UnknownChain"] = "UNKNOWN_CHAIN";
|
|
93
|
+
CofheErrorCode2["ACPMalformed"] = "ACP_MALFORMED";
|
|
94
|
+
CofheErrorCode2["ACPDenied"] = "ACP_DENIED";
|
|
95
|
+
CofheErrorCode2["ACPExpired"] = "ACP_EXPIRED";
|
|
96
|
+
CofheErrorCode2["ACPInvalid"] = "ACP_INVALID";
|
|
97
|
+
CofheErrorCode2["ACPRevoked"] = "ACP_REVOKED";
|
|
98
|
+
CofheErrorCode2["NotPubliclyAllowed"] = "NOT_PUBLICLY_ALLOWED";
|
|
99
|
+
CofheErrorCode2["CtNotFound"] = "CT_NOT_FOUND";
|
|
100
|
+
CofheErrorCode2["UnsupportedSecurityZone"] = "UNSUPPORTED_SECURITY_ZONE";
|
|
101
|
+
CofheErrorCode2["UnsupportedType"] = "UNSUPPORTED_TYPE";
|
|
102
|
+
CofheErrorCode2["SigningFailed"] = "SIGNING_FAILED";
|
|
103
|
+
CofheErrorCode2["CtSourceError"] = "CT_SOURCE_ERROR";
|
|
104
|
+
CofheErrorCode2["ACPVerifierError"] = "ACP_VERIFIER_ERROR";
|
|
105
|
+
CofheErrorCode2["CtSourceTimeout"] = "CT_SOURCE_TIMEOUT";
|
|
106
|
+
CofheErrorCode2["ACPVerifierTimeout"] = "ACP_VERIFIER_TIMEOUT";
|
|
107
|
+
CofheErrorCode2["ACPRequired"] = "ACP_REQUIRED";
|
|
108
|
+
CofheErrorCode2["SealFailed"] = "SEAL_FAILED";
|
|
109
|
+
return CofheErrorCode2;
|
|
110
|
+
})(CofheErrorCode || {});
|
|
111
|
+
var CofheError = class _CofheError extends Error {
|
|
112
|
+
code;
|
|
113
|
+
cause;
|
|
114
|
+
hint;
|
|
115
|
+
context;
|
|
116
|
+
apiErrorCode;
|
|
117
|
+
constructor({ code, message, cause, hint, context, apiErrorCode }) {
|
|
118
|
+
const fullMessage = cause ? `${message} | Caused by: ${cause.message}` : message;
|
|
119
|
+
super(fullMessage);
|
|
120
|
+
this.name = "CofheError";
|
|
121
|
+
this.code = code;
|
|
122
|
+
this.cause = cause;
|
|
123
|
+
this.hint = hint;
|
|
124
|
+
this.context = context;
|
|
125
|
+
this.apiErrorCode = apiErrorCode;
|
|
126
|
+
if (Error.captureStackTrace) {
|
|
127
|
+
Error.captureStackTrace(this, _CofheError);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Creates a CofheError from an unknown error
|
|
132
|
+
* If the error is a CofheError, it is returned unchanged, else a new CofheError is created
|
|
133
|
+
* If a wrapperError is provided, it is used to create the new CofheError, else a default is used
|
|
134
|
+
*/
|
|
135
|
+
static fromError(error, wrapperError) {
|
|
136
|
+
if (isCofheError(error))
|
|
137
|
+
return error;
|
|
138
|
+
const cause = error instanceof Error ? error : new Error(`${error}`);
|
|
139
|
+
return new _CofheError({
|
|
140
|
+
code: wrapperError?.code ?? "INTERNAL_ERROR" /* InternalError */,
|
|
141
|
+
message: wrapperError?.message ?? "An internal error occurred",
|
|
142
|
+
hint: wrapperError?.hint,
|
|
143
|
+
context: wrapperError?.context,
|
|
144
|
+
apiErrorCode: wrapperError?.apiErrorCode,
|
|
145
|
+
cause
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Serializes the error to JSON string with proper handling of Error objects
|
|
150
|
+
*/
|
|
151
|
+
serialize() {
|
|
152
|
+
return bigintSafeJsonStringify({
|
|
153
|
+
name: this.name,
|
|
154
|
+
code: this.code,
|
|
155
|
+
message: this.message,
|
|
156
|
+
hint: this.hint,
|
|
157
|
+
context: this.context,
|
|
158
|
+
apiErrorCode: this.apiErrorCode,
|
|
159
|
+
cause: this.cause ? {
|
|
160
|
+
name: this.cause.name,
|
|
161
|
+
message: this.cause.message,
|
|
162
|
+
stack: this.cause.stack
|
|
163
|
+
} : void 0,
|
|
164
|
+
stack: this.stack
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Returns a human-readable string representation of the error
|
|
169
|
+
*/
|
|
170
|
+
toString() {
|
|
171
|
+
const codeSuffix = this.apiErrorCode ? ` (api: ${this.apiErrorCode})` : "";
|
|
172
|
+
const parts = [`${this.name} [${this.code}]${codeSuffix}: ${this.message}`];
|
|
173
|
+
if (this.hint) {
|
|
174
|
+
parts.push(`Hint: ${this.hint}`);
|
|
175
|
+
}
|
|
176
|
+
if (this.context && Object.keys(this.context).length > 0) {
|
|
177
|
+
parts.push(`Context: ${bigintSafeJsonStringify(this.context)}`);
|
|
178
|
+
}
|
|
179
|
+
if (this.stack) {
|
|
180
|
+
parts.push(`
|
|
181
|
+
Stack trace:`);
|
|
182
|
+
parts.push(this.stack);
|
|
183
|
+
}
|
|
184
|
+
if (this.cause) {
|
|
185
|
+
parts.push(`
|
|
186
|
+
Caused by: ${this.cause.name}: ${this.cause.message}`);
|
|
187
|
+
if (this.cause.stack) {
|
|
188
|
+
parts.push(this.cause.stack);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return parts.join("\n");
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var bigintSafeJsonStringify = (value) => {
|
|
195
|
+
return JSON.stringify(value, (key, value2) => {
|
|
196
|
+
if (typeof value2 === "bigint") {
|
|
197
|
+
return `${value2}n`;
|
|
198
|
+
}
|
|
199
|
+
return value2;
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
var isCofheError = (error) => error instanceof CofheError;
|
|
203
|
+
|
|
44
204
|
// acps/sealing.ts
|
|
45
205
|
var KEY_HEX_LENGTH = 64;
|
|
46
206
|
var GenerateSealingKey = () => {
|
|
@@ -55,9 +215,25 @@ var unsealWithPrivateKey = (privateKey, parsedData) => {
|
|
|
55
215
|
const nonce = parsedData.nonce instanceof Uint8Array ? parsedData.nonce : new Uint8Array(parsedData.nonce);
|
|
56
216
|
const ephemPublicKey = parsedData.public_key instanceof Uint8Array ? parsedData.public_key : new Uint8Array(parsedData.public_key);
|
|
57
217
|
const dataToDecrypt = parsedData.data instanceof Uint8Array ? parsedData.data : new Uint8Array(parsedData.data);
|
|
58
|
-
|
|
218
|
+
let decryptedMessage;
|
|
219
|
+
let cause;
|
|
220
|
+
try {
|
|
221
|
+
decryptedMessage = nacl__default.default.box.open(dataToDecrypt, nonce, ephemPublicKey, fromHexString(privateKey));
|
|
222
|
+
} catch (e) {
|
|
223
|
+
decryptedMessage = null;
|
|
224
|
+
cause = e instanceof Error ? e : void 0;
|
|
225
|
+
}
|
|
59
226
|
if (!decryptedMessage) {
|
|
60
|
-
throw new
|
|
227
|
+
throw new CofheError({
|
|
228
|
+
code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
|
|
229
|
+
message: "Failed to unseal decrypt response",
|
|
230
|
+
cause,
|
|
231
|
+
context: {
|
|
232
|
+
dataLength: dataToDecrypt.length,
|
|
233
|
+
nonceLength: nonce.length,
|
|
234
|
+
publicKeyLength: ephemPublicKey.length
|
|
235
|
+
}
|
|
236
|
+
});
|
|
61
237
|
}
|
|
62
238
|
return toBigInt(decryptedMessage);
|
|
63
239
|
};
|
|
@@ -377,166 +553,6 @@ var TFHE_RS_ZK_MAX_BITS = 2048;
|
|
|
377
553
|
var TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT = BigInt(1 << 30);
|
|
378
554
|
var TFHE_RS_KEY_VERSION = 2;
|
|
379
555
|
|
|
380
|
-
// core/error.ts
|
|
381
|
-
var CofheErrorCode = /* @__PURE__ */ ((CofheErrorCode2) => {
|
|
382
|
-
CofheErrorCode2["InternalError"] = "INTERNAL_ERROR";
|
|
383
|
-
CofheErrorCode2["UnknownEnvironment"] = "UNKNOWN_ENVIRONMENT";
|
|
384
|
-
CofheErrorCode2["InitTfheFailed"] = "INIT_TFHE_FAILED";
|
|
385
|
-
CofheErrorCode2["InitViemFailed"] = "INIT_VIEM_FAILED";
|
|
386
|
-
CofheErrorCode2["InitEthersFailed"] = "INIT_ETHERS_FAILED";
|
|
387
|
-
CofheErrorCode2["NotConnected"] = "NOT_CONNECTED";
|
|
388
|
-
CofheErrorCode2["MissingPublicClient"] = "MISSING_PUBLIC_CLIENT";
|
|
389
|
-
CofheErrorCode2["MissingWalletClient"] = "MISSING_WALLET_CLIENT";
|
|
390
|
-
CofheErrorCode2["MissingProviderParam"] = "MISSING_PROVIDER_PARAM";
|
|
391
|
-
CofheErrorCode2["EmptySecurityZonesParam"] = "EMPTY_SECURITY_ZONES_PARAM";
|
|
392
|
-
CofheErrorCode2["InvalidACPData"] = "INVALID_ACP_DATA";
|
|
393
|
-
CofheErrorCode2["InvalidACPDomain"] = "INVALID_ACP_DOMAIN";
|
|
394
|
-
CofheErrorCode2["ACPNotFound"] = "ACP_NOT_FOUND";
|
|
395
|
-
CofheErrorCode2["CannotRemoveLastACP"] = "CANNOT_REMOVE_LAST_ACP";
|
|
396
|
-
CofheErrorCode2["AccountUninitialized"] = "ACCOUNT_UNINITIALIZED";
|
|
397
|
-
CofheErrorCode2["ChainIdUninitialized"] = "CHAIN_ID_UNINITIALIZED";
|
|
398
|
-
CofheErrorCode2["ConsumingContractUninitialized"] = "CONSUMING_CONTRACT_UNINITIALIZED";
|
|
399
|
-
CofheErrorCode2["SealOutputFailed"] = "SEAL_OUTPUT_FAILED";
|
|
400
|
-
CofheErrorCode2["SealOutputReturnedNull"] = "SEAL_OUTPUT_RETURNED_NULL";
|
|
401
|
-
CofheErrorCode2["InvalidUtype"] = "INVALID_UTYPE";
|
|
402
|
-
CofheErrorCode2["DecryptFailed"] = "DECRYPT_FAILED";
|
|
403
|
-
CofheErrorCode2["DecryptReturnedNull"] = "DECRYPT_RETURNED_NULL";
|
|
404
|
-
CofheErrorCode2["ZkMocksInsertCtHashesFailed"] = "ZK_MOCKS_INSERT_CT_HASHES_FAILED";
|
|
405
|
-
CofheErrorCode2["ZkMocksCalcCtHashesFailed"] = "ZK_MOCKS_CALC_CT_HASHES_FAILED";
|
|
406
|
-
CofheErrorCode2["ZkMocksVerifySignFailed"] = "ZK_MOCKS_VERIFY_SIGN_FAILED";
|
|
407
|
-
CofheErrorCode2["ZkMocksCreateProofSignatureFailed"] = "ZK_MOCKS_CREATE_PROOF_SIGNATURE_FAILED";
|
|
408
|
-
CofheErrorCode2["ZkVerifyFailed"] = "ZK_VERIFY_FAILED";
|
|
409
|
-
CofheErrorCode2["ZkPackFailed"] = "ZK_PACK_FAILED";
|
|
410
|
-
CofheErrorCode2["ZkProveFailed"] = "ZK_PROVE_FAILED";
|
|
411
|
-
CofheErrorCode2["EncryptRemainingInItems"] = "ENCRYPT_REMAINING_IN_ITEMS";
|
|
412
|
-
CofheErrorCode2["ZkUninitialized"] = "ZK_UNINITIALIZED";
|
|
413
|
-
CofheErrorCode2["ZkVerifierUrlUninitialized"] = "ZK_VERIFIER_URL_UNINITIALIZED";
|
|
414
|
-
CofheErrorCode2["ThresholdNetworkUrlUninitialized"] = "THRESHOLD_NETWORK_URL_UNINITIALIZED";
|
|
415
|
-
CofheErrorCode2["MissingConfig"] = "MISSING_CONFIG";
|
|
416
|
-
CofheErrorCode2["UnsupportedChain"] = "UNSUPPORTED_CHAIN";
|
|
417
|
-
CofheErrorCode2["MissingZkBuilderAndCrsGenerator"] = "MISSING_ZK_BUILDER_AND_CRS_GENERATOR";
|
|
418
|
-
CofheErrorCode2["MissingTfhePublicKeyDeserializer"] = "MISSING_TFHE_PUBLIC_KEY_DESERIALIZER";
|
|
419
|
-
CofheErrorCode2["MissingCompactPkeCrsDeserializer"] = "MISSING_COMPACT_PKE_CRS_DESERIALIZER";
|
|
420
|
-
CofheErrorCode2["MissingFheKey"] = "MISSING_FHE_KEY";
|
|
421
|
-
CofheErrorCode2["MissingCrs"] = "MISSING_CRS";
|
|
422
|
-
CofheErrorCode2["FetchKeysFailed"] = "FETCH_KEYS_FAILED";
|
|
423
|
-
CofheErrorCode2["PublicWalletGetChainIdFailed"] = "PUBLIC_WALLET_GET_CHAIN_ID_FAILED";
|
|
424
|
-
CofheErrorCode2["PublicWalletGetAddressesFailed"] = "PUBLIC_WALLET_GET_ADDRESSES_FAILED";
|
|
425
|
-
CofheErrorCode2["RehydrateKeysStoreFailed"] = "REHYDRATE_KEYS_STORE_FAILED";
|
|
426
|
-
CofheErrorCode2["TaskManagerUnresolved"] = "TASK_MANAGER_UNRESOLVED";
|
|
427
|
-
CofheErrorCode2["BadRequest"] = "BAD_REQUEST";
|
|
428
|
-
CofheErrorCode2["UnknownChain"] = "UNKNOWN_CHAIN";
|
|
429
|
-
CofheErrorCode2["ACPMalformed"] = "ACP_MALFORMED";
|
|
430
|
-
CofheErrorCode2["ACPDenied"] = "ACP_DENIED";
|
|
431
|
-
CofheErrorCode2["ACPExpired"] = "ACP_EXPIRED";
|
|
432
|
-
CofheErrorCode2["ACPInvalid"] = "ACP_INVALID";
|
|
433
|
-
CofheErrorCode2["ACPRevoked"] = "ACP_REVOKED";
|
|
434
|
-
CofheErrorCode2["NotPubliclyAllowed"] = "NOT_PUBLICLY_ALLOWED";
|
|
435
|
-
CofheErrorCode2["CtNotFound"] = "CT_NOT_FOUND";
|
|
436
|
-
CofheErrorCode2["UnsupportedSecurityZone"] = "UNSUPPORTED_SECURITY_ZONE";
|
|
437
|
-
CofheErrorCode2["UnsupportedType"] = "UNSUPPORTED_TYPE";
|
|
438
|
-
CofheErrorCode2["SigningFailed"] = "SIGNING_FAILED";
|
|
439
|
-
CofheErrorCode2["CtSourceError"] = "CT_SOURCE_ERROR";
|
|
440
|
-
CofheErrorCode2["ACPVerifierError"] = "ACP_VERIFIER_ERROR";
|
|
441
|
-
CofheErrorCode2["CtSourceTimeout"] = "CT_SOURCE_TIMEOUT";
|
|
442
|
-
CofheErrorCode2["ACPVerifierTimeout"] = "ACP_VERIFIER_TIMEOUT";
|
|
443
|
-
CofheErrorCode2["ACPRequired"] = "ACP_REQUIRED";
|
|
444
|
-
CofheErrorCode2["SealFailed"] = "SEAL_FAILED";
|
|
445
|
-
return CofheErrorCode2;
|
|
446
|
-
})(CofheErrorCode || {});
|
|
447
|
-
var CofheError = class _CofheError extends Error {
|
|
448
|
-
code;
|
|
449
|
-
cause;
|
|
450
|
-
hint;
|
|
451
|
-
context;
|
|
452
|
-
apiErrorCode;
|
|
453
|
-
constructor({ code, message, cause, hint, context, apiErrorCode }) {
|
|
454
|
-
const fullMessage = cause ? `${message} | Caused by: ${cause.message}` : message;
|
|
455
|
-
super(fullMessage);
|
|
456
|
-
this.name = "CofheError";
|
|
457
|
-
this.code = code;
|
|
458
|
-
this.cause = cause;
|
|
459
|
-
this.hint = hint;
|
|
460
|
-
this.context = context;
|
|
461
|
-
this.apiErrorCode = apiErrorCode;
|
|
462
|
-
if (Error.captureStackTrace) {
|
|
463
|
-
Error.captureStackTrace(this, _CofheError);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Creates a CofheError from an unknown error
|
|
468
|
-
* If the error is a CofheError, it is returned unchanged, else a new CofheError is created
|
|
469
|
-
* If a wrapperError is provided, it is used to create the new CofheError, else a default is used
|
|
470
|
-
*/
|
|
471
|
-
static fromError(error, wrapperError) {
|
|
472
|
-
if (isCofheError(error))
|
|
473
|
-
return error;
|
|
474
|
-
const cause = error instanceof Error ? error : new Error(`${error}`);
|
|
475
|
-
return new _CofheError({
|
|
476
|
-
code: wrapperError?.code ?? "INTERNAL_ERROR" /* InternalError */,
|
|
477
|
-
message: wrapperError?.message ?? "An internal error occurred",
|
|
478
|
-
hint: wrapperError?.hint,
|
|
479
|
-
context: wrapperError?.context,
|
|
480
|
-
apiErrorCode: wrapperError?.apiErrorCode,
|
|
481
|
-
cause
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Serializes the error to JSON string with proper handling of Error objects
|
|
486
|
-
*/
|
|
487
|
-
serialize() {
|
|
488
|
-
return bigintSafeJsonStringify({
|
|
489
|
-
name: this.name,
|
|
490
|
-
code: this.code,
|
|
491
|
-
message: this.message,
|
|
492
|
-
hint: this.hint,
|
|
493
|
-
context: this.context,
|
|
494
|
-
apiErrorCode: this.apiErrorCode,
|
|
495
|
-
cause: this.cause ? {
|
|
496
|
-
name: this.cause.name,
|
|
497
|
-
message: this.cause.message,
|
|
498
|
-
stack: this.cause.stack
|
|
499
|
-
} : void 0,
|
|
500
|
-
stack: this.stack
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Returns a human-readable string representation of the error
|
|
505
|
-
*/
|
|
506
|
-
toString() {
|
|
507
|
-
const codeSuffix = this.apiErrorCode ? ` (api: ${this.apiErrorCode})` : "";
|
|
508
|
-
const parts = [`${this.name} [${this.code}]${codeSuffix}: ${this.message}`];
|
|
509
|
-
if (this.hint) {
|
|
510
|
-
parts.push(`Hint: ${this.hint}`);
|
|
511
|
-
}
|
|
512
|
-
if (this.context && Object.keys(this.context).length > 0) {
|
|
513
|
-
parts.push(`Context: ${bigintSafeJsonStringify(this.context)}`);
|
|
514
|
-
}
|
|
515
|
-
if (this.stack) {
|
|
516
|
-
parts.push(`
|
|
517
|
-
Stack trace:`);
|
|
518
|
-
parts.push(this.stack);
|
|
519
|
-
}
|
|
520
|
-
if (this.cause) {
|
|
521
|
-
parts.push(`
|
|
522
|
-
Caused by: ${this.cause.name}: ${this.cause.message}`);
|
|
523
|
-
if (this.cause.stack) {
|
|
524
|
-
parts.push(this.cause.stack);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
return parts.join("\n");
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
var bigintSafeJsonStringify = (value) => {
|
|
531
|
-
return JSON.stringify(value, (key, value2) => {
|
|
532
|
-
if (typeof value2 === "bigint") {
|
|
533
|
-
return `${value2}n`;
|
|
534
|
-
}
|
|
535
|
-
return value2;
|
|
536
|
-
});
|
|
537
|
-
};
|
|
538
|
-
var isCofheError = (error) => error instanceof CofheError;
|
|
539
|
-
|
|
540
556
|
// core/taskManager.ts
|
|
541
557
|
var ADDRESS_BOOK_ABI = viem.parseAbi([
|
|
542
558
|
"function getTm(uint256 id) view returns (address)",
|
|
@@ -844,15 +860,22 @@ var getAclServedAddresses = async (publicClient, chainId) => {
|
|
|
844
860
|
} catch {
|
|
845
861
|
return {};
|
|
846
862
|
}
|
|
863
|
+
let transient = false;
|
|
864
|
+
const readServedAddress = (functionName) => publicClient.readContract({ address: aclAddress, abi: ACL_SERVED_ADDRESSES_ABI, functionName }).catch((err) => {
|
|
865
|
+
if (revertErrorName(err, ACL_SERVED_ADDRESSES_ABI) === void 0)
|
|
866
|
+
transient = true;
|
|
867
|
+
return void 0;
|
|
868
|
+
});
|
|
847
869
|
const [defaultRevoker, shareRegistry] = await Promise.all([
|
|
848
|
-
|
|
849
|
-
|
|
870
|
+
readServedAddress("defaultRevokerContract"),
|
|
871
|
+
readServedAddress("shareRegistry")
|
|
850
872
|
]);
|
|
851
873
|
const resolved = {
|
|
852
874
|
defaultRevoker: defaultRevoker != null && defaultRevoker !== viem.zeroAddress ? defaultRevoker : void 0,
|
|
853
875
|
shareRegistry: shareRegistry != null && shareRegistry !== viem.zeroAddress ? shareRegistry : void 0
|
|
854
876
|
};
|
|
855
|
-
|
|
877
|
+
if (!transient)
|
|
878
|
+
aclServedAddressesCache.set(chainId, resolved);
|
|
856
879
|
return resolved;
|
|
857
880
|
};
|
|
858
881
|
|
|
@@ -3441,23 +3464,25 @@ var getBlockRevokerData = async (publicClient) => {
|
|
|
3441
3464
|
}
|
|
3442
3465
|
return revokerData;
|
|
3443
3466
|
};
|
|
3444
|
-
var
|
|
3467
|
+
var prepareRevokeACP = (acp) => {
|
|
3445
3468
|
if (acp.revokerContract === viem.zeroAddress || acp.revokerData === 0) {
|
|
3446
3469
|
throw new Error("ACP is not revocable: it has no revoker (revokerContract/revokerData unset)");
|
|
3447
3470
|
}
|
|
3471
|
+
return {
|
|
3472
|
+
address: acp.revokerContract,
|
|
3473
|
+
abi: ACP_REVOKER_ABI,
|
|
3474
|
+
functionName: "revokeSingle",
|
|
3475
|
+
args: [BigInt(acp.revokerData)]
|
|
3476
|
+
};
|
|
3477
|
+
};
|
|
3478
|
+
var revokeACP = async (acp, walletClient) => {
|
|
3479
|
+
const write = prepareRevokeACP(acp);
|
|
3448
3480
|
if (walletClient.account == null)
|
|
3449
3481
|
throw new Error("Missing walletClient account");
|
|
3450
3482
|
if (walletClient.account.address.toLowerCase() !== acp.issuer.toLowerCase()) {
|
|
3451
3483
|
throw new Error("Only the acp issuer can revoke it");
|
|
3452
3484
|
}
|
|
3453
|
-
return walletClient.writeContract({
|
|
3454
|
-
address: acp.revokerContract,
|
|
3455
|
-
abi: ACP_REVOKER_ABI,
|
|
3456
|
-
functionName: "revokeSingle",
|
|
3457
|
-
args: [BigInt(acp.revokerData)],
|
|
3458
|
-
account: walletClient.account,
|
|
3459
|
-
chain: walletClient.chain
|
|
3460
|
-
});
|
|
3485
|
+
return walletClient.writeContract({ ...write, account: walletClient.account, chain: walletClient.chain });
|
|
3461
3486
|
};
|
|
3462
3487
|
var revokeAllACPs = async (walletClient, publicClient, revokerContract) => {
|
|
3463
3488
|
if (walletClient.account == null)
|
|
@@ -3508,28 +3533,36 @@ var metadataOf = (acp, { labels, metadata, appKey }) => {
|
|
|
3508
3533
|
}
|
|
3509
3534
|
return encodeShareMetadata(labels, { issuer: acp.issuer, appKey });
|
|
3510
3535
|
};
|
|
3511
|
-
var
|
|
3536
|
+
var prepareShareOnChain = (acp, registry, options = {}) => {
|
|
3512
3537
|
if (acp.type !== "sharing") {
|
|
3513
3538
|
throw new Error(`Cannot share a '${acp.type}' ACP on-chain \u2014 only 'sharing' ACPs are shareable.`);
|
|
3514
3539
|
}
|
|
3515
3540
|
if (acp.issuerSignature === "0x") {
|
|
3516
3541
|
throw new Error("Cannot share an unsigned sharing ACP \u2014 sign it first.");
|
|
3517
3542
|
}
|
|
3543
|
+
return {
|
|
3544
|
+
write: {
|
|
3545
|
+
address: registry,
|
|
3546
|
+
abi: ACP_SHARE_REGISTRY_ABI,
|
|
3547
|
+
functionName: "share",
|
|
3548
|
+
args: [toChainShare(acp), metadataOf(acp, options)]
|
|
3549
|
+
},
|
|
3550
|
+
shareId: computeShareId(acp)
|
|
3551
|
+
};
|
|
3552
|
+
};
|
|
3553
|
+
var shareOnChain = async (acp, walletClient, registry, options = {}) => {
|
|
3554
|
+
const { write, shareId } = prepareShareOnChain(acp, registry, options);
|
|
3518
3555
|
if (walletClient.account == null)
|
|
3519
3556
|
throw new Error("Missing walletClient account");
|
|
3520
3557
|
if (walletClient.account.address.toLowerCase() !== acp.issuer.toLowerCase()) {
|
|
3521
3558
|
throw new Error("Only the ACP issuer can share it on-chain");
|
|
3522
3559
|
}
|
|
3523
|
-
const metadata = metadataOf(acp, options);
|
|
3524
3560
|
const txHash = await walletClient.writeContract({
|
|
3525
|
-
|
|
3526
|
-
abi: ACP_SHARE_REGISTRY_ABI,
|
|
3527
|
-
functionName: "share",
|
|
3528
|
-
args: [toChainShare(acp), metadata],
|
|
3561
|
+
...write,
|
|
3529
3562
|
account: walletClient.account,
|
|
3530
3563
|
chain: walletClient.chain ?? null
|
|
3531
3564
|
});
|
|
3532
|
-
return { txHash, shareId
|
|
3565
|
+
return { txHash, shareId };
|
|
3533
3566
|
};
|
|
3534
3567
|
var toIncomingShare = ({ shareId, share: s, metadata }) => ({
|
|
3535
3568
|
shareId,
|
|
@@ -3564,14 +3597,17 @@ var importFromChain = async (share, publicClient, walletClient, importOptions =
|
|
|
3564
3597
|
const { shareId: _shareId, appKey: _appKey, ...options } = share;
|
|
3565
3598
|
return importShared({ ...options, type: "sharing" }, publicClient, walletClient, importOptions);
|
|
3566
3599
|
};
|
|
3600
|
+
var prepareRemoveShare = (shareId, registry) => ({
|
|
3601
|
+
address: registry,
|
|
3602
|
+
abi: ACP_SHARE_REGISTRY_ABI,
|
|
3603
|
+
functionName: "removeShare",
|
|
3604
|
+
args: [shareId]
|
|
3605
|
+
});
|
|
3567
3606
|
var removeShareOnChain = async (shareId, walletClient, registry) => {
|
|
3568
3607
|
if (walletClient.account == null)
|
|
3569
3608
|
throw new Error("Missing walletClient account");
|
|
3570
3609
|
return walletClient.writeContract({
|
|
3571
|
-
|
|
3572
|
-
abi: ACP_SHARE_REGISTRY_ABI,
|
|
3573
|
-
functionName: "removeShare",
|
|
3574
|
-
args: [shareId],
|
|
3610
|
+
...prepareRemoveShare(shareId, registry),
|
|
3575
3611
|
account: walletClient.account,
|
|
3576
3612
|
chain: walletClient.chain ?? null
|
|
3577
3613
|
});
|
|
@@ -3598,14 +3634,17 @@ var acps = {
|
|
|
3598
3634
|
selectActiveACP,
|
|
3599
3635
|
removeActiveACP,
|
|
3600
3636
|
revokeACP,
|
|
3637
|
+
prepareRevokeACP,
|
|
3601
3638
|
revokeAllACPs,
|
|
3602
3639
|
isACPRevoked,
|
|
3603
3640
|
checkAccess,
|
|
3604
3641
|
shareOnChain,
|
|
3642
|
+
prepareShareOnChain,
|
|
3605
3643
|
getIncomingShares,
|
|
3606
3644
|
getShareFromChain,
|
|
3607
3645
|
importFromChain,
|
|
3608
3646
|
removeShareOnChain,
|
|
3647
|
+
prepareRemoveShare,
|
|
3609
3648
|
computeShareId,
|
|
3610
3649
|
applyACPDefaultsFromChain,
|
|
3611
3650
|
getAclServedAddresses,
|
|
@@ -5388,6 +5427,12 @@ function createCofheClientBase(opts) {
|
|
|
5388
5427
|
});
|
|
5389
5428
|
}
|
|
5390
5429
|
};
|
|
5430
|
+
const _requireIssuer = (acp, what) => {
|
|
5431
|
+
const sender = connectStore.getState().walletClient?.account?.address;
|
|
5432
|
+
if (sender == null || sender.toLowerCase() !== acp.issuer.toLowerCase()) {
|
|
5433
|
+
throw new Error(`Only the acp issuer can ${what}`);
|
|
5434
|
+
}
|
|
5435
|
+
};
|
|
5391
5436
|
async function connect(publicClient, walletClient) {
|
|
5392
5437
|
const state = connectStore.getState();
|
|
5393
5438
|
if (state.connected && state.publicClient === publicClient && state.walletClient === walletClient)
|
|
@@ -5555,6 +5600,11 @@ function createCofheClientBase(opts) {
|
|
|
5555
5600
|
const { walletClient } = connectStore.getState();
|
|
5556
5601
|
return acps.revokeACP(acp, walletClient);
|
|
5557
5602
|
},
|
|
5603
|
+
prepareRevokeACP: (acp) => {
|
|
5604
|
+
_requireConnected();
|
|
5605
|
+
_requireIssuer(acp, "revoke it");
|
|
5606
|
+
return acps.prepareRevokeACP(acp);
|
|
5607
|
+
},
|
|
5558
5608
|
revokeAllACPs: async (revokerContract) => {
|
|
5559
5609
|
_requireConnected();
|
|
5560
5610
|
const { publicClient, walletClient } = connectStore.getState();
|
|
@@ -5578,6 +5628,21 @@ function createCofheClientBase(opts) {
|
|
|
5578
5628
|
const sharingRegistry = await _resolveSharingRegistry(publicClient, chainId);
|
|
5579
5629
|
return acps.shareOnChain(acp, walletClient, sharingRegistry, { ...withAppKey(), ...options });
|
|
5580
5630
|
},
|
|
5631
|
+
prepareShareOnChain: async (acp, options) => {
|
|
5632
|
+
_requireConnected();
|
|
5633
|
+
_requireIssuer(acp, "share it on-chain");
|
|
5634
|
+
const { publicClient } = connectStore.getState();
|
|
5635
|
+
const chainId = await publicClient.getChainId();
|
|
5636
|
+
const sharingRegistry = await _resolveSharingRegistry(publicClient, chainId);
|
|
5637
|
+
return acps.prepareShareOnChain(acp, sharingRegistry, { ...withAppKey(), ...options });
|
|
5638
|
+
},
|
|
5639
|
+
prepareRemoveShare: async (shareId) => {
|
|
5640
|
+
_requireConnected();
|
|
5641
|
+
const { publicClient } = connectStore.getState();
|
|
5642
|
+
const chainId = await publicClient.getChainId();
|
|
5643
|
+
const sharingRegistry = await _resolveSharingRegistry(publicClient, chainId);
|
|
5644
|
+
return acps.prepareRemoveShare(shareId, sharingRegistry);
|
|
5645
|
+
},
|
|
5581
5646
|
getIncomingShares: async () => {
|
|
5582
5647
|
_requireConnected();
|
|
5583
5648
|
const { publicClient, walletClient } = connectStore.getState();
|
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 { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S 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, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-
|
|
1
|
+
import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-RXwLVWou.cjs';
|
|
2
|
+
export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S 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, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-RXwLVWou.cjs';
|
|
3
3
|
import { PublicClient, Address, Hex } from 'viem';
|
|
4
4
|
import './types-C07FK-cL.cjs';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './onchain-utils-
|
|
6
|
+
import './onchain-utils-Ns56cBm0.cjs';
|
|
7
7
|
import 'zustand/vanilla';
|
|
8
8
|
|
|
9
9
|
declare const InitialConnectStore: CofheClientConnectionState;
|
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 { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S 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, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-
|
|
1
|
+
import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-CnslFzxB.js';
|
|
2
|
+
export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S 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, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-CnslFzxB.js';
|
|
3
3
|
import { PublicClient, Address, Hex } from 'viem';
|
|
4
4
|
import './types-C07FK-cL.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './onchain-utils-
|
|
6
|
+
import './onchain-utils-Ns56cBm0.js';
|
|
7
7
|
import 'zustand/vanilla';
|
|
8
8
|
|
|
9
9
|
declare const InitialConnectStore: CofheClientConnectionState;
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, DecryptForTxBuilder, DecryptForViewBuilder, EncryptInputsBuilder, assertNoRenamedConfigKeys, cofheFetch, createCofheClientBase, createCofheConfigBase, createKeysStore, fetchKeys, getCofheConfigItem, getCofheDebugInterceptors, setCofheDebugInterceptors, verifyDecryptResult, zkProveWithWorker } from './chunk-
|
|
1
|
+
export { InitialConnectStore as CONNECT_STORE_DEFAULTS, DecryptForTxBuilder, DecryptForViewBuilder, EncryptInputsBuilder, assertNoRenamedConfigKeys, cofheFetch, createCofheClientBase, createCofheConfigBase, createKeysStore, fetchKeys, getCofheConfigItem, getCofheDebugInterceptors, setCofheDebugInterceptors, verifyDecryptResult, zkProveWithWorker } from './chunk-2EO4JSR7.js';
|
|
2
2
|
import './chunk-UKQAJK4N.js';
|
|
3
|
-
export { getTaskManagerAddress } from './chunk-
|
|
4
|
-
export { EncryptStep, Encryptable, FheAllUTypes, FheTypes, FheUintUTypes, fheTypeToString, isEncryptableItem, isLastEncryptionStep } from './chunk-
|
|
5
|
-
export { COFHE_ADDRESS_BOOK_ADDRESS, CofheError, CofheErrorCode, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_TASK_MANAGER_ADDRESS, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ID, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, isCofheError } from './chunk-
|
|
3
|
+
export { getTaskManagerAddress } from './chunk-3L2IVPMI.js';
|
|
4
|
+
export { EncryptStep, Encryptable, FheAllUTypes, FheTypes, FheUintUTypes, fheTypeToString, isEncryptableItem, isLastEncryptionStep } from './chunk-WJGTPW7K.js';
|
|
5
|
+
export { COFHE_ADDRESS_BOOK_ADDRESS, CofheError, CofheErrorCode, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_TASK_MANAGER_ADDRESS, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ID, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, isCofheError } from './chunk-J23FYAI2.js';
|