@cofhe/sdk 0.2.1 → 0.3.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 +28 -0
- package/core/baseBuilder.ts +18 -18
- package/core/client.test.ts +58 -55
- package/core/client.ts +50 -30
- package/core/clientTypes.ts +21 -17
- package/core/config.test.ts +32 -33
- package/core/config.ts +47 -48
- package/core/consts.ts +6 -2
- package/core/decrypt/{MockQueryDecrypterAbi.ts → MockThresholdNetworkAbi.ts} +71 -21
- package/core/decrypt/cofheMocksDecryptForTx.ts +142 -0
- package/core/decrypt/{cofheMocksSealOutput.ts → cofheMocksDecryptForView.ts} +12 -12
- package/core/decrypt/decryptForTxBuilder.ts +340 -0
- package/core/decrypt/{decryptHandleBuilder.ts → decryptForViewBuilder.ts} +75 -42
- package/core/decrypt/tnDecrypt.ts +232 -0
- package/core/decrypt/tnSealOutputV1.ts +5 -5
- package/core/decrypt/tnSealOutputV2.ts +27 -27
- package/core/encrypt/cofheMocksZkVerifySign.ts +15 -15
- package/core/encrypt/encryptInputsBuilder.test.ts +57 -61
- package/core/encrypt/encryptInputsBuilder.ts +65 -42
- package/core/encrypt/zkPackProveVerify.ts +11 -11
- package/core/error.ts +18 -18
- package/core/fetchKeys.test.ts +3 -3
- package/core/fetchKeys.ts +3 -3
- package/core/index.ts +14 -11
- package/core/utils.ts +10 -10
- package/dist/{chunk-I5WFEYXX.js → chunk-2TPSCOW3.js} +791 -209
- package/dist/{chunk-R3B5TMVX.js → chunk-NWDKXBIP.js} +3 -2
- package/dist/{clientTypes-RqkgkV2i.d.ts → clientTypes-6aTZPQ_4.d.ts} +204 -85
- package/dist/{clientTypes-e4filDzK.d.cts → clientTypes-Bhq7pCSA.d.cts} +204 -85
- package/dist/core.cjs +799 -214
- package/dist/core.d.cts +25 -23
- package/dist/core.d.ts +25 -23
- package/dist/core.js +2 -2
- package/dist/node.cjs +748 -165
- package/dist/node.d.cts +10 -10
- package/dist/node.d.ts +10 -10
- package/dist/node.js +7 -7
- package/dist/permits.js +1 -1
- package/dist/web.cjs +751 -168
- package/dist/web.d.cts +11 -11
- package/dist/web.d.ts +11 -11
- package/dist/web.js +9 -9
- package/node/client.test.ts +34 -34
- package/node/config.test.ts +11 -11
- package/node/encryptInputs.test.ts +29 -29
- package/node/index.ts +15 -15
- package/package.json +1 -1
- package/web/client.web.test.ts +34 -34
- package/web/config.web.test.ts +11 -11
- package/web/encryptInputs.web.test.ts +29 -29
- package/web/index.ts +19 -19
- package/web/worker.builder.web.test.ts +28 -28
- package/web/worker.config.web.test.ts +47 -47
- package/web/worker.output.web.test.ts +10 -10
package/dist/node.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as CofheInputConfig, a as CofheConfig, b as CofheClient } from './clientTypes-Bhq7pCSA.cjs';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import './types-YiAC4gig.cjs';
|
|
4
4
|
import 'zod';
|
|
@@ -6,17 +6,17 @@ import './permit-MZ502UBl.cjs';
|
|
|
6
6
|
import 'zustand/vanilla';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Creates a CoFHE
|
|
10
|
-
* @param config - The CoFHE
|
|
11
|
-
* @returns The CoFHE
|
|
9
|
+
* Creates a CoFHE configuration for Node.js with filesystem storage as default
|
|
10
|
+
* @param config - The CoFHE input configuration (fheKeyStorage will default to filesystem if not provided)
|
|
11
|
+
* @returns The CoFHE configuration with Node.js defaults applied
|
|
12
12
|
*/
|
|
13
|
-
declare function
|
|
13
|
+
declare function createCofheConfig(config: CofheInputConfig): CofheConfig;
|
|
14
14
|
/**
|
|
15
|
-
* Creates a CoFHE
|
|
15
|
+
* Creates a CoFHE client instance for Node.js with node-tfhe automatically configured
|
|
16
16
|
* TFHE will be initialized automatically on first encryption - no manual setup required
|
|
17
|
-
* @param config - The CoFHE
|
|
18
|
-
* @returns The CoFHE
|
|
17
|
+
* @param config - The CoFHE configuration (use createCofheConfig to create with Node.js defaults)
|
|
18
|
+
* @returns The CoFHE client instance
|
|
19
19
|
*/
|
|
20
|
-
declare function
|
|
20
|
+
declare function createCofheClient(config: CofheConfig): CofheClient;
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { createCofheClient, createCofheConfig };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as CofheInputConfig, a as CofheConfig, b as CofheClient } from './clientTypes-6aTZPQ_4.js';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import './types-YiAC4gig.js';
|
|
4
4
|
import 'zod';
|
|
@@ -6,17 +6,17 @@ import './permit-MZ502UBl.js';
|
|
|
6
6
|
import 'zustand/vanilla';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Creates a CoFHE
|
|
10
|
-
* @param config - The CoFHE
|
|
11
|
-
* @returns The CoFHE
|
|
9
|
+
* Creates a CoFHE configuration for Node.js with filesystem storage as default
|
|
10
|
+
* @param config - The CoFHE input configuration (fheKeyStorage will default to filesystem if not provided)
|
|
11
|
+
* @returns The CoFHE configuration with Node.js defaults applied
|
|
12
12
|
*/
|
|
13
|
-
declare function
|
|
13
|
+
declare function createCofheConfig(config: CofheInputConfig): CofheConfig;
|
|
14
14
|
/**
|
|
15
|
-
* Creates a CoFHE
|
|
15
|
+
* Creates a CoFHE client instance for Node.js with node-tfhe automatically configured
|
|
16
16
|
* TFHE will be initialized automatically on first encryption - no manual setup required
|
|
17
|
-
* @param config - The CoFHE
|
|
18
|
-
* @returns The CoFHE
|
|
17
|
+
* @param config - The CoFHE configuration (use createCofheConfig to create with Node.js defaults)
|
|
18
|
+
* @returns The CoFHE client instance
|
|
19
19
|
*/
|
|
20
|
-
declare function
|
|
20
|
+
declare function createCofheClient(config: CofheConfig): CofheClient;
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { createCofheClient, createCofheConfig };
|
package/dist/node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createCofheConfigBase, createCofheClientBase } from './chunk-2TPSCOW3.js';
|
|
2
2
|
import './chunk-TBLR7NNE.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-NWDKXBIP.js';
|
|
4
4
|
import { promises } from 'fs';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
import { init_panic_hook, TfheCompactPublicKey, CompactPkeCrs, ProvenCompactCiphertextList } from 'node-tfhe';
|
|
@@ -71,15 +71,15 @@ var zkBuilderAndCrsGenerator = (fhe, crs) => {
|
|
|
71
71
|
const zkCrs = CompactPkeCrs.deserialize(fromHexString(crs));
|
|
72
72
|
return { zkBuilder, zkCrs };
|
|
73
73
|
};
|
|
74
|
-
function
|
|
75
|
-
return
|
|
74
|
+
function createCofheConfig(config) {
|
|
75
|
+
return createCofheConfigBase({
|
|
76
76
|
environment: "node",
|
|
77
77
|
...config,
|
|
78
78
|
fheKeyStorage: config.fheKeyStorage === null ? null : config.fheKeyStorage ?? createNodeStorage()
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
function createCofheClient(config) {
|
|
82
|
+
return createCofheClientBase({
|
|
83
83
|
config,
|
|
84
84
|
zkBuilderAndCrsGenerator,
|
|
85
85
|
tfhePublicKeyDeserializer,
|
|
@@ -88,4 +88,4 @@ function createCofhesdkClient(config) {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
export {
|
|
91
|
+
export { createCofheClient, createCofheConfig };
|
package/dist/permits.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { GenerateSealingKey, ImportPermitOptionsValidator, ImportPermitValidator, PERMIT_STORE_DEFAULTS, PermitUtils, SealingKey, SelfPermitOptionsValidator, SelfPermitValidator, SharingPermitOptionsValidator, SharingPermitValidator, SignatureTypes, SignatureUtils, ValidationUtils, _permitStore, addressNotZeroSchema, addressSchema, bytesNotEmptySchema, bytesSchema, clearStaleStore, getActivePermit, getActivePermitHash, getPermit, getPermits, getSignatureTypesAndMessage, permitStore, removeActivePermitHash, removePermit, resetStore, setActivePermitHash, setPermit, validateImportPermit, validateImportPermitOptions, validateSelfPermit, validateSelfPermitOptions, validateSharingPermit, validateSharingPermitOptions } from './chunk-
|
|
1
|
+
export { GenerateSealingKey, ImportPermitOptionsValidator, ImportPermitValidator, PERMIT_STORE_DEFAULTS, PermitUtils, SealingKey, SelfPermitOptionsValidator, SelfPermitValidator, SharingPermitOptionsValidator, SharingPermitValidator, SignatureTypes, SignatureUtils, ValidationUtils, _permitStore, addressNotZeroSchema, addressSchema, bytesNotEmptySchema, bytesSchema, clearStaleStore, getActivePermit, getActivePermitHash, getPermit, getPermits, getSignatureTypesAndMessage, permitStore, removeActivePermitHash, removePermit, resetStore, setActivePermitHash, setPermit, validateImportPermit, validateImportPermitOptions, validateSelfPermit, validateSelfPermitOptions, validateSharingPermit, validateSharingPermitOptions } from './chunk-NWDKXBIP.js';
|