@cofhe/sdk 0.1.1 → 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.
- package/CHANGELOG.md +22 -0
- package/adapters/ethers6.ts +28 -28
- package/adapters/hardhat.ts +0 -1
- package/adapters/index.test.ts +14 -19
- package/adapters/smartWallet.ts +81 -73
- package/adapters/test-utils.ts +45 -45
- package/adapters/types.ts +3 -3
- package/chains/chains/localcofhe.ts +14 -0
- package/chains/chains.test.ts +2 -1
- package/chains/defineChain.ts +2 -2
- package/chains/index.ts +3 -1
- package/chains/types.ts +3 -3
- package/core/baseBuilder.ts +30 -49
- package/core/client.test.ts +200 -72
- package/core/client.ts +152 -148
- package/core/clientTypes.ts +114 -0
- package/core/config.test.ts +30 -11
- package/core/config.ts +26 -13
- package/core/consts.ts +18 -0
- package/core/decrypt/cofheMocksSealOutput.ts +2 -4
- package/core/decrypt/decryptHandleBuilder.ts +51 -45
- package/core/decrypt/{tnSealOutput.ts → tnSealOutputV1.ts} +1 -1
- package/core/decrypt/tnSealOutputV2.ts +298 -0
- package/core/encrypt/cofheMocksZkVerifySign.ts +15 -16
- package/core/encrypt/encryptInputsBuilder.test.ts +132 -116
- package/core/encrypt/encryptInputsBuilder.ts +159 -111
- package/core/encrypt/encryptUtils.ts +6 -3
- package/core/encrypt/zkPackProveVerify.ts +70 -8
- package/core/error.ts +0 -2
- package/core/fetchKeys.test.ts +1 -18
- package/core/fetchKeys.ts +0 -26
- package/core/index.ts +37 -17
- package/core/keyStore.ts +65 -38
- package/core/permits.test.ts +255 -4
- package/core/permits.ts +83 -18
- package/core/types.ts +198 -152
- package/core/utils.ts +43 -1
- package/dist/adapters.d.cts +38 -20
- package/dist/adapters.d.ts +38 -20
- package/dist/chains.cjs +18 -8
- package/dist/chains.d.cts +31 -9
- package/dist/chains.d.ts +31 -9
- package/dist/chains.js +1 -1
- package/dist/{chunk-KFGPTJ6X.js → chunk-I5WFEYXX.js} +1768 -1526
- package/dist/{chunk-LU7BMUUT.js → chunk-R3B5TMVX.js} +330 -197
- package/dist/{chunk-GZCQQYVI.js → chunk-TBLR7NNE.js} +18 -9
- package/dist/{types-PhwGgQvs.d.ts → clientTypes-RqkgkV2i.d.ts} +331 -429
- package/dist/{types-bB7wLj0q.d.cts → clientTypes-e4filDzK.d.cts} +331 -429
- package/dist/core.cjs +3000 -2625
- package/dist/core.d.cts +113 -7
- package/dist/core.d.ts +113 -7
- package/dist/core.js +3 -3
- package/dist/node.cjs +2851 -2526
- package/dist/node.d.cts +4 -4
- package/dist/node.d.ts +4 -4
- package/dist/node.js +4 -3
- package/dist/{permit-S9CnI6MF.d.cts → permit-MZ502UBl.d.cts} +54 -41
- package/dist/{permit-S9CnI6MF.d.ts → permit-MZ502UBl.d.ts} +54 -41
- package/dist/permits.cjs +328 -195
- package/dist/permits.d.cts +113 -825
- package/dist/permits.d.ts +113 -825
- package/dist/permits.js +1 -1
- package/dist/types-YiAC4gig.d.cts +33 -0
- package/dist/types-YiAC4gig.d.ts +33 -0
- package/dist/web.cjs +3067 -2527
- package/dist/web.d.cts +22 -6
- package/dist/web.d.ts +22 -6
- package/dist/web.js +185 -9
- package/dist/zkProve.worker.cjs +93 -0
- package/dist/zkProve.worker.d.cts +2 -0
- package/dist/zkProve.worker.d.ts +2 -0
- package/dist/zkProve.worker.js +91 -0
- package/node/client.test.ts +20 -25
- package/node/encryptInputs.test.ts +18 -38
- package/node/index.ts +1 -0
- package/package.json +15 -15
- package/permits/index.ts +1 -0
- package/permits/localstorage.test.ts +9 -14
- package/permits/onchain-utils.ts +221 -0
- package/permits/permit.test.ts +76 -27
- package/permits/permit.ts +58 -95
- package/permits/sealing.test.ts +3 -3
- package/permits/sealing.ts +2 -2
- package/permits/store.test.ts +10 -50
- package/permits/store.ts +9 -21
- package/permits/test-utils.ts +11 -3
- package/permits/types.ts +39 -9
- package/permits/utils.ts +0 -5
- package/permits/validation.test.ts +29 -32
- package/permits/validation.ts +114 -176
- package/web/client.web.test.ts +20 -25
- package/web/config.web.test.ts +0 -2
- package/web/encryptInputs.web.test.ts +31 -54
- package/web/index.ts +65 -1
- package/web/storage.ts +19 -5
- package/web/worker.builder.web.test.ts +148 -0
- package/web/worker.config.web.test.ts +329 -0
- package/web/worker.output.web.test.ts +84 -0
- package/web/workerManager.test.ts +80 -0
- package/web/workerManager.ts +214 -0
- package/web/workerManager.web.test.ts +114 -0
- package/web/zkProve.worker.ts +133 -0
- package/core/result.test.ts +0 -180
- package/core/result.ts +0 -67
- package/core/test-utils.ts +0 -45
- package/dist/types-KImPrEIe.d.cts +0 -48
- 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.
|
|
13
|
+
coFheUrl: z.url(),
|
|
14
14
|
/** Verifier service URL */
|
|
15
|
-
verifierUrl: z.
|
|
15
|
+
verifierUrl: z.url(),
|
|
16
16
|
/** Threshold network service URL */
|
|
17
|
-
thresholdNetworkUrl: z.
|
|
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
|
-
|
|
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
|
}
|
|
@@ -74,12 +71,24 @@ var hardhat = defineChain({
|
|
|
74
71
|
environment: "MOCK"
|
|
75
72
|
});
|
|
76
73
|
|
|
74
|
+
// chains/chains/localcofhe.ts
|
|
75
|
+
var localcofhe = defineChain({
|
|
76
|
+
id: 420105,
|
|
77
|
+
name: "Local Cofhe",
|
|
78
|
+
network: "localhost",
|
|
79
|
+
coFheUrl: "http://127.0.0.1:9448",
|
|
80
|
+
verifierUrl: "http://127.0.0.1:3001",
|
|
81
|
+
thresholdNetworkUrl: "http://127.0.0.1:3000",
|
|
82
|
+
environment: "TESTNET"
|
|
83
|
+
});
|
|
84
|
+
|
|
77
85
|
// chains/index.ts
|
|
78
86
|
var chains = {
|
|
79
87
|
sepolia,
|
|
80
88
|
arbSepolia,
|
|
81
89
|
baseSepolia,
|
|
82
|
-
hardhat
|
|
90
|
+
hardhat,
|
|
91
|
+
localcofhe
|
|
83
92
|
};
|
|
84
93
|
var getChainById = (chainId) => {
|
|
85
94
|
return Object.values(chains).find((chain) => chain.id === chainId);
|
|
@@ -90,4 +99,4 @@ var getChainByName = (name) => {
|
|
|
90
99
|
);
|
|
91
100
|
};
|
|
92
101
|
|
|
93
|
-
export { arbSepolia, baseSepolia, chains, getChainById, getChainByName, hardhat, sepolia };
|
|
102
|
+
export { arbSepolia, baseSepolia, chains, getChainById, getChainByName, hardhat, localcofhe, sepolia };
|