@zama-fhe/relayer-sdk 0.1.0-1 → 0.1.0-2
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/bundle/fhevm.js +1 -0
- package/bundle/fhevm.umd.cjs +7 -7
- package/bundle.d.ts +16 -1
- package/lib/node.cjs +8 -7
- package/lib/node.d.ts +139 -2
- package/lib/node.js +1146 -0
- package/lib/web.d.ts +141 -2
- package/lib/web.js +8 -8
- package/package.json +12 -4
- package/lib/config.d.ts +0 -30
- package/lib/index.d.ts +0 -29
- package/lib/init.d.ts +0 -7
- package/lib/relayer/decryptUtils.d.ts +0 -2
- package/lib/relayer/handles.d.ts +0 -4
- package/lib/relayer/network.d.ts +0 -31
- package/lib/relayer/network.test.d.ts +0 -1
- package/lib/relayer/publicDecrypt.d.ts +0 -3
- package/lib/relayer/publicDecrypt.test.d.ts +0 -1
- package/lib/relayer/sendEncryption.d.ts +0 -41
- package/lib/relayer/sendEncryption.test.d.ts +0 -1
- package/lib/relayer/userDecrypt.d.ts +0 -11
- package/lib/relayer/userDecrypt.test.d.ts +0 -1
- package/lib/sdk/encrypt.d.ts +0 -34
- package/lib/sdk/encrypt.test.d.ts +0 -1
- package/lib/sdk/encryptionTypes.d.ts +0 -13
- package/lib/sdk/keypair.d.ts +0 -34
- package/lib/sdk/keypair.test.d.ts +0 -1
- package/lib/test/index.d.ts +0 -10
- package/lib/tfhe.d.ts +0 -7
- package/lib/utils.d.ts +0 -9
package/lib/web.d.ts
CHANGED
|
@@ -1,2 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { CompactPkeCrs } from 'node-tfhe';
|
|
2
|
+
import { Eip1193Provider } from 'ethers';
|
|
3
|
+
import { InitInput as KMSInput } from 'tkms';
|
|
4
|
+
import { InitInput as TFHEInput } from 'tfhe';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates an EIP712 structure specifically for user decrypt requests
|
|
8
|
+
*
|
|
9
|
+
* @param gatewayChainId - The chain ID of the gateway
|
|
10
|
+
* @param verifyingContract - The address of the contract that will verify the signature
|
|
11
|
+
* @param publicKey - The user's public key as a hex string or Uint8Array
|
|
12
|
+
* @param contractAddresses - Array of contract addresses that can access the decryption
|
|
13
|
+
* @param contractsChainId - The chain ID where the contracts are deployed
|
|
14
|
+
* @param startTimestamp - The timestamp when the decryption permission becomes valid
|
|
15
|
+
* @param durationDays - How many days the decryption permission remains valid
|
|
16
|
+
* @returns EIP712 typed data structure for user decryption
|
|
17
|
+
*/
|
|
18
|
+
export declare const createEIP712: (gatewayChainId: number, verifyingContract: string, contractsChainId: number) => (publicKey: string | Uint8Array, contractAddresses: string[], startTimestamp: string | number, durationDays: string | number, delegatedAccount?: string) => EIP712;
|
|
19
|
+
|
|
20
|
+
export declare const createInstance: (config: FhevmInstanceConfig) => Promise<FhevmInstance>;
|
|
21
|
+
|
|
22
|
+
export declare type DecryptedResults = Record<string, bigint | boolean | string>;
|
|
23
|
+
|
|
24
|
+
export declare type EIP712 = {
|
|
25
|
+
domain: {
|
|
26
|
+
chainId: number;
|
|
27
|
+
name: string;
|
|
28
|
+
verifyingContract: string;
|
|
29
|
+
version: string;
|
|
30
|
+
};
|
|
31
|
+
message: any;
|
|
32
|
+
primaryType: string;
|
|
33
|
+
types: {
|
|
34
|
+
[key: string]: EIP712Type[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export declare type EIP712Type = {
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export declare const ENCRYPTION_TYPES: {
|
|
44
|
+
1: number;
|
|
45
|
+
8: number;
|
|
46
|
+
16: number;
|
|
47
|
+
32: number;
|
|
48
|
+
64: number;
|
|
49
|
+
128: number;
|
|
50
|
+
160: number;
|
|
51
|
+
256: number;
|
|
52
|
+
512: number;
|
|
53
|
+
1024: number;
|
|
54
|
+
2048: number;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export declare type EncryptionTypes = keyof typeof ENCRYPTION_TYPES;
|
|
58
|
+
|
|
59
|
+
export declare type FhevmInstance = {
|
|
60
|
+
createEncryptedInput: (contractAddress: string, userAddress: string) => RelayerEncryptedInput;
|
|
61
|
+
generateKeypair: () => {
|
|
62
|
+
publicKey: string;
|
|
63
|
+
privateKey: string;
|
|
64
|
+
};
|
|
65
|
+
createEIP712: (publicKey: string, contractAddresses: string[], startTimestamp: string | number, durationDays: string | number) => EIP712;
|
|
66
|
+
publicDecrypt: (handles: (string | Uint8Array)[]) => Promise<DecryptedResults>;
|
|
67
|
+
userDecrypt: (handles: HandleContractPair[], privateKey: string, publicKey: string, signature: string, contractAddresses: string[], userAddress: string, startTimestamp: string | number, durationDays: string | number) => Promise<DecryptedResults>;
|
|
68
|
+
getPublicKey: () => {
|
|
69
|
+
publicKeyId: string;
|
|
70
|
+
publicKey: Uint8Array;
|
|
71
|
+
} | null;
|
|
72
|
+
getPublicParams: (bits: keyof PublicParams) => {
|
|
73
|
+
publicParams: Uint8Array;
|
|
74
|
+
publicParamsId: string;
|
|
75
|
+
} | null;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
declare type FhevmInstanceConfig = {
|
|
79
|
+
verifyingContractAddressDecryption: string;
|
|
80
|
+
verifyingContractAddressInputVerification: string;
|
|
81
|
+
kmsContractAddress: string;
|
|
82
|
+
inputVerifierContractAddress: string;
|
|
83
|
+
aclContractAddress: string;
|
|
84
|
+
gatewayChainId: number;
|
|
85
|
+
chainId?: number;
|
|
86
|
+
relayerUrl?: string;
|
|
87
|
+
network?: Eip1193Provider | string;
|
|
88
|
+
publicParams?: PublicParams<Uint8Array> | null;
|
|
89
|
+
publicKey?: {
|
|
90
|
+
data: Uint8Array | null;
|
|
91
|
+
id: string | null;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export declare const generateKeypair: () => {
|
|
96
|
+
publicKey: string;
|
|
97
|
+
privateKey: string;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export declare type HandleContractPair = {
|
|
101
|
+
handle: Uint8Array | string;
|
|
102
|
+
contractAddress: string;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export declare const initFhevm: ({ tfheParams, kmsParams, thread, }?: {
|
|
106
|
+
tfheParams?: TFHEInput;
|
|
107
|
+
kmsParams?: KMSInput;
|
|
108
|
+
thread?: number;
|
|
109
|
+
}) => Promise<boolean>;
|
|
110
|
+
|
|
111
|
+
export { KMSInput }
|
|
112
|
+
|
|
113
|
+
export declare type PublicParams<T = CompactPkeCrs> = {
|
|
114
|
+
[key in EncryptionTypes]?: {
|
|
115
|
+
publicParams: T;
|
|
116
|
+
publicParamsId: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export declare type RelayerEncryptedInput = {
|
|
121
|
+
addBool: (value: boolean | number | bigint) => RelayerEncryptedInput;
|
|
122
|
+
add8: (value: number | bigint) => RelayerEncryptedInput;
|
|
123
|
+
add16: (value: number | bigint) => RelayerEncryptedInput;
|
|
124
|
+
add32: (value: number | bigint) => RelayerEncryptedInput;
|
|
125
|
+
add64: (value: number | bigint) => RelayerEncryptedInput;
|
|
126
|
+
add128: (value: number | bigint) => RelayerEncryptedInput;
|
|
127
|
+
add256: (value: number | bigint) => RelayerEncryptedInput;
|
|
128
|
+
addBytes64: (value: Uint8Array) => RelayerEncryptedInput;
|
|
129
|
+
addBytes128: (value: Uint8Array) => RelayerEncryptedInput;
|
|
130
|
+
addBytes256: (value: Uint8Array) => RelayerEncryptedInput;
|
|
131
|
+
addAddress: (value: string) => RelayerEncryptedInput;
|
|
132
|
+
getBits: () => EncryptionTypes[];
|
|
133
|
+
encrypt: () => Promise<{
|
|
134
|
+
handles: Uint8Array[];
|
|
135
|
+
inputProof: Uint8Array;
|
|
136
|
+
}>;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export { TFHEInput }
|
|
140
|
+
|
|
141
|
+
export { }
|
package/lib/web.js
CHANGED
|
@@ -27126,13 +27126,13 @@ const publicDecryptRequest = (kmsSigners, thresholdSigners, gatewayChainId, veri
|
|
|
27126
27126
|
/**
|
|
27127
27127
|
* Creates an EIP712 structure specifically for user decrypt requests
|
|
27128
27128
|
*
|
|
27129
|
-
* @param gatewayChainId The chain ID of the gateway
|
|
27130
|
-
* @param verifyingContract The address of the contract that will verify the signature
|
|
27131
|
-
* @param publicKey The user's public key as a hex string or Uint8Array
|
|
27132
|
-
* @param contractAddresses Array of contract addresses that can access the decryption
|
|
27133
|
-
* @param contractsChainId The chain ID where the contracts are deployed
|
|
27134
|
-
* @param startTimestamp The timestamp when the decryption permission becomes valid
|
|
27135
|
-
* @param durationDays How many days the decryption permission remains valid
|
|
27129
|
+
* @param gatewayChainId - The chain ID of the gateway
|
|
27130
|
+
* @param verifyingContract - The address of the contract that will verify the signature
|
|
27131
|
+
* @param publicKey - The user's public key as a hex string or Uint8Array
|
|
27132
|
+
* @param contractAddresses - Array of contract addresses that can access the decryption
|
|
27133
|
+
* @param contractsChainId - The chain ID where the contracts are deployed
|
|
27134
|
+
* @param startTimestamp - The timestamp when the decryption permission becomes valid
|
|
27135
|
+
* @param durationDays - How many days the decryption permission remains valid
|
|
27136
27136
|
* @returns EIP712 typed data structure for user decryption
|
|
27137
27137
|
*/
|
|
27138
27138
|
const createEIP712 = (gatewayChainId, verifyingContract, contractsChainId) => (publicKey, contractAddresses, startTimestamp, durationDays, delegatedAccount) => {
|
|
@@ -27302,4 +27302,4 @@ const initFhevm = async ({ tfheParams, kmsParams, thread, } = {}) => {
|
|
|
27302
27302
|
return true;
|
|
27303
27303
|
};
|
|
27304
27304
|
|
|
27305
|
-
export { createEIP712, createInstance, generateKeypair, initFhevm };
|
|
27305
|
+
export { ENCRYPTION_TYPES, createEIP712, createInstance, generateKeypair, initFhevm };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zama-fhe/relayer-sdk",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-2",
|
|
4
4
|
"description": "fhevm Relayer SDK",
|
|
5
5
|
"main": "lib/node.js",
|
|
6
|
-
"types": "lib/node
|
|
6
|
+
"types": "lib/node.d.ts",
|
|
7
7
|
"browser": "lib/web.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"bin": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"require": "./bundle.js"
|
|
24
24
|
},
|
|
25
25
|
"./node": {
|
|
26
|
+
"import": "./lib/node.js",
|
|
26
27
|
"require": "./lib/node.cjs"
|
|
27
28
|
}
|
|
28
29
|
},
|
|
@@ -33,12 +34,18 @@
|
|
|
33
34
|
"lint": "eslint src/",
|
|
34
35
|
"generateKeys": "./generateKeys.js",
|
|
35
36
|
"build": "npm run build:lib && npm run build:bundle",
|
|
36
|
-
"build:lib": "rollup
|
|
37
|
+
"build:lib": "npm run rollup:lib && npm run build:dts",
|
|
37
38
|
"build:bundle": "vite build --config config/vite.config.js",
|
|
38
39
|
"test": "jest --colors --passWithNoTests --coverage",
|
|
39
40
|
"test:watch": "jest --colors --passWithNoTests --watch",
|
|
40
41
|
"prettier": "prettier --write \"**/*.{js,json,md,sol,ts,yml}\"",
|
|
41
|
-
"prettier:check": "prettier --check \"**/*.{js,json,md,sol,ts,yml}\""
|
|
42
|
+
"prettier:check": "prettier --check \"**/*.{js,json,md,sol,ts,yml}\"",
|
|
43
|
+
"rollup:lib": "rollup -c config/rollup.config.js",
|
|
44
|
+
"clean": "rm -rf dist.tmp lib bundle coverage",
|
|
45
|
+
"clean:dts": "rm -rf dist.tmp",
|
|
46
|
+
"tsc:dts": "tsc --project config/tsconfig.dts.json",
|
|
47
|
+
"flatten:dts": "api-extractor run --local --config config/api-extractor.node.json && api-extractor run --local --config config/api-extractor.web.json",
|
|
48
|
+
"build:dts": "npm run clean:dts && npm run tsc:dts && npm run flatten:dts && npm run clean:dts"
|
|
42
49
|
},
|
|
43
50
|
"repository": {
|
|
44
51
|
"type": "git",
|
|
@@ -64,6 +71,7 @@
|
|
|
64
71
|
"devDependencies": {
|
|
65
72
|
"@fetch-mock/jest": "^0.1.0",
|
|
66
73
|
"@jest/globals": "^29.7.0",
|
|
74
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
67
75
|
"@rollup/plugin-alias": "^5.1.0",
|
|
68
76
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
69
77
|
"@rollup/plugin-json": "^6.1.0",
|
package/lib/config.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { BrowserProvider, Eip1193Provider, JsonRpcProvider, Provider } from 'ethers';
|
|
2
|
-
import { PublicParams } from './sdk/encrypt';
|
|
3
|
-
import { TfheCompactPublicKey } from 'node-tfhe';
|
|
4
|
-
export type FhevmInstanceConfig = {
|
|
5
|
-
verifyingContractAddressDecryption: string;
|
|
6
|
-
verifyingContractAddressInputVerification: string;
|
|
7
|
-
kmsContractAddress: string;
|
|
8
|
-
inputVerifierContractAddress: string;
|
|
9
|
-
aclContractAddress: string;
|
|
10
|
-
gatewayChainId: number;
|
|
11
|
-
chainId?: number;
|
|
12
|
-
relayerUrl?: string;
|
|
13
|
-
network?: Eip1193Provider | string;
|
|
14
|
-
publicParams?: PublicParams<Uint8Array> | null;
|
|
15
|
-
publicKey?: {
|
|
16
|
-
data: Uint8Array | null;
|
|
17
|
-
id: string | null;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const getProvider: (config: FhevmInstanceConfig) => JsonRpcProvider | BrowserProvider;
|
|
21
|
-
export declare const getChainId: (provider: Provider, config: FhevmInstanceConfig) => Promise<number>;
|
|
22
|
-
export declare const getTfheCompactPublicKey: (config: FhevmInstanceConfig) => Promise<{
|
|
23
|
-
publicKey: TfheCompactPublicKey;
|
|
24
|
-
publicKeyId: string;
|
|
25
|
-
}>;
|
|
26
|
-
export declare const getPublicParams: (config: FhevmInstanceConfig) => Promise<PublicParams>;
|
|
27
|
-
export declare const getKMSSigners: (provider: Provider, config: FhevmInstanceConfig) => Promise<string[]>;
|
|
28
|
-
export declare const getKMSSignersThreshold: (provider: Provider, config: FhevmInstanceConfig) => Promise<number>;
|
|
29
|
-
export declare const getCoprocessorSigners: (provider: Provider, config: FhevmInstanceConfig) => Promise<string[]>;
|
|
30
|
-
export declare const getCoprocessorSignersThreshold: (provider: Provider, config: FhevmInstanceConfig) => Promise<number>;
|
package/lib/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FhevmInstanceConfig } from './config';
|
|
2
|
-
import { HandleContractPair } from './relayer/userDecrypt';
|
|
3
|
-
import { RelayerEncryptedInput } from './relayer/sendEncryption';
|
|
4
|
-
import { DecryptedResults } from './relayer/decryptUtils';
|
|
5
|
-
import { PublicParams } from './sdk/encrypt';
|
|
6
|
-
import { EIP712 } from './sdk/keypair';
|
|
7
|
-
export { generateKeypair, createEIP712, EIP712, EIP712Type, } from './sdk/keypair';
|
|
8
|
-
export { RelayerEncryptedInput } from './relayer/sendEncryption';
|
|
9
|
-
export { HandleContractPair } from './relayer/userDecrypt';
|
|
10
|
-
export { PublicParams } from './sdk/encrypt';
|
|
11
|
-
export type FhevmInstance = {
|
|
12
|
-
createEncryptedInput: (contractAddress: string, userAddress: string) => RelayerEncryptedInput;
|
|
13
|
-
generateKeypair: () => {
|
|
14
|
-
publicKey: string;
|
|
15
|
-
privateKey: string;
|
|
16
|
-
};
|
|
17
|
-
createEIP712: (publicKey: string, contractAddresses: string[], startTimestamp: string | number, durationDays: string | number) => EIP712;
|
|
18
|
-
publicDecrypt: (handles: (string | Uint8Array)[]) => Promise<DecryptedResults>;
|
|
19
|
-
userDecrypt: (handles: HandleContractPair[], privateKey: string, publicKey: string, signature: string, contractAddresses: string[], userAddress: string, startTimestamp: string | number, durationDays: string | number) => Promise<DecryptedResults>;
|
|
20
|
-
getPublicKey: () => {
|
|
21
|
-
publicKeyId: string;
|
|
22
|
-
publicKey: Uint8Array;
|
|
23
|
-
} | null;
|
|
24
|
-
getPublicParams: (bits: keyof PublicParams) => {
|
|
25
|
-
publicParams: Uint8Array;
|
|
26
|
-
publicParamsId: string;
|
|
27
|
-
} | null;
|
|
28
|
-
};
|
|
29
|
-
export declare const createInstance: (config: FhevmInstanceConfig) => Promise<FhevmInstance>;
|
package/lib/init.d.ts
DELETED
package/lib/relayer/handles.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ENCRYPTION_TYPES } from '../sdk/encryptionTypes';
|
|
2
|
-
type EncryptionBitwidths = keyof typeof ENCRYPTION_TYPES;
|
|
3
|
-
export declare const computeHandles: (ciphertextWithZKProof: Uint8Array, bitwidths: EncryptionBitwidths[], aclContractAddress: string, chainId: number, ciphertextVersion: number) => Uint8Array<ArrayBuffer>[];
|
|
4
|
-
export {};
|
package/lib/relayer/network.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export type RelayerKeysItem = {
|
|
2
|
-
data_id: string;
|
|
3
|
-
param_choice: number;
|
|
4
|
-
urls: string[];
|
|
5
|
-
signatures: string[];
|
|
6
|
-
};
|
|
7
|
-
export type RelayerKey = {
|
|
8
|
-
data_id: string;
|
|
9
|
-
param_choice: number;
|
|
10
|
-
signatures: string[];
|
|
11
|
-
urls: string[];
|
|
12
|
-
};
|
|
13
|
-
export type RelayerKeys = {
|
|
14
|
-
response: {
|
|
15
|
-
fhe_key_info: {
|
|
16
|
-
fhe_public_key: RelayerKey;
|
|
17
|
-
fhe_server_key: RelayerKey;
|
|
18
|
-
}[];
|
|
19
|
-
verf_public_key: {
|
|
20
|
-
key_id: string;
|
|
21
|
-
server_id: number;
|
|
22
|
-
verf_public_key_address: string;
|
|
23
|
-
verf_public_key_url: string;
|
|
24
|
-
}[];
|
|
25
|
-
crs: {
|
|
26
|
-
[key: string]: RelayerKeysItem;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
status: string;
|
|
30
|
-
};
|
|
31
|
-
export declare const getKeysFromRelayer: (url: string, publicKeyId?: string | null) => Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
import { DecryptedResults } from './decryptUtils';
|
|
3
|
-
export declare const publicDecryptRequest: (kmsSigners: string[], thresholdSigners: number, gatewayChainId: number, verifyingContractAddress: string, aclContractAddress: string, relayerUrl: string, provider: ethers.JsonRpcProvider | ethers.BrowserProvider) => (_handles: (Uint8Array | string)[]) => Promise<DecryptedResults>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { TfheCompactPublicKey, CompactPkeCrs } from 'node-tfhe';
|
|
2
|
-
import { EncryptedInput } from '../sdk/encrypt';
|
|
3
|
-
import { ENCRYPTION_TYPES } from '../sdk/encryptionTypes';
|
|
4
|
-
type EncryptionTypes = keyof typeof ENCRYPTION_TYPES;
|
|
5
|
-
export declare const currentCiphertextVersion: () => number;
|
|
6
|
-
export type FhevmRelayerInputProofResponse = {
|
|
7
|
-
response: {
|
|
8
|
-
handles: string[];
|
|
9
|
-
signatures: string[];
|
|
10
|
-
};
|
|
11
|
-
status: string;
|
|
12
|
-
};
|
|
13
|
-
export type RelayerEncryptedInputInternal = RelayerEncryptedInput & {
|
|
14
|
-
_input: EncryptedInput;
|
|
15
|
-
};
|
|
16
|
-
export type RelayerEncryptedInput = {
|
|
17
|
-
addBool: (value: boolean | number | bigint) => RelayerEncryptedInput;
|
|
18
|
-
add8: (value: number | bigint) => RelayerEncryptedInput;
|
|
19
|
-
add16: (value: number | bigint) => RelayerEncryptedInput;
|
|
20
|
-
add32: (value: number | bigint) => RelayerEncryptedInput;
|
|
21
|
-
add64: (value: number | bigint) => RelayerEncryptedInput;
|
|
22
|
-
add128: (value: number | bigint) => RelayerEncryptedInput;
|
|
23
|
-
add256: (value: number | bigint) => RelayerEncryptedInput;
|
|
24
|
-
addBytes64: (value: Uint8Array) => RelayerEncryptedInput;
|
|
25
|
-
addBytes128: (value: Uint8Array) => RelayerEncryptedInput;
|
|
26
|
-
addBytes256: (value: Uint8Array) => RelayerEncryptedInput;
|
|
27
|
-
addAddress: (value: string) => RelayerEncryptedInput;
|
|
28
|
-
getBits: () => EncryptionTypes[];
|
|
29
|
-
encrypt: () => Promise<{
|
|
30
|
-
handles: Uint8Array[];
|
|
31
|
-
inputProof: Uint8Array;
|
|
32
|
-
}>;
|
|
33
|
-
};
|
|
34
|
-
export type PublicParams<T = CompactPkeCrs> = {
|
|
35
|
-
[key in EncryptionTypes]?: {
|
|
36
|
-
publicParams: T;
|
|
37
|
-
publicParamsId: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export declare const createRelayerEncryptedInput: (aclContractAddress: string, verifyingContractAddressInputVerification: string, chainId: number, gatewayChainId: number, relayerUrl: string, tfheCompactPublicKey: TfheCompactPublicKey, publicParams: PublicParams, coprocessorSigners: string[], thresholdCoprocessorSigners: number) => (contractAddress: string, userAddress: string) => RelayerEncryptedInputInternal;
|
|
41
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
import { DecryptedResults } from './decryptUtils';
|
|
3
|
-
export type HandleContractPair = {
|
|
4
|
-
handle: Uint8Array | string;
|
|
5
|
-
contractAddress: string;
|
|
6
|
-
};
|
|
7
|
-
export type HandleContractPairRelayer = {
|
|
8
|
-
handle: string;
|
|
9
|
-
contractAddress: string;
|
|
10
|
-
};
|
|
11
|
-
export declare const userDecryptRequest: (kmsSigners: string[], gatewayChainId: number, chainId: number, verifyingContractAddress: string, aclContractAddress: string, relayerUrl: string, provider: ethers.JsonRpcProvider | ethers.BrowserProvider) => (_handles: HandleContractPair[], privateKey: string, publicKey: string, signature: string, contractAddresses: string[], userAddress: string, startTimestamp: string | number, durationDays: string | number) => Promise<DecryptedResults>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/sdk/encrypt.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { TfheCompactPublicKey, CompactPkeCrs } from 'node-tfhe';
|
|
2
|
-
import { ENCRYPTION_TYPES } from './encryptionTypes';
|
|
3
|
-
type EncryptionTypes = keyof typeof ENCRYPTION_TYPES;
|
|
4
|
-
export type EncryptedInput = {
|
|
5
|
-
addBool: (value: boolean | number | bigint) => EncryptedInput;
|
|
6
|
-
add8: (value: number | bigint) => EncryptedInput;
|
|
7
|
-
add16: (value: number | bigint) => EncryptedInput;
|
|
8
|
-
add32: (value: number | bigint) => EncryptedInput;
|
|
9
|
-
add64: (value: number | bigint) => EncryptedInput;
|
|
10
|
-
add128: (value: number | bigint) => EncryptedInput;
|
|
11
|
-
add256: (value: number | bigint) => EncryptedInput;
|
|
12
|
-
addBytes64: (value: Uint8Array) => EncryptedInput;
|
|
13
|
-
addBytes128: (value: Uint8Array) => EncryptedInput;
|
|
14
|
-
addBytes256: (value: Uint8Array) => EncryptedInput;
|
|
15
|
-
addAddress: (value: string) => EncryptedInput;
|
|
16
|
-
getBits: () => EncryptionTypes[];
|
|
17
|
-
encrypt: () => Uint8Array;
|
|
18
|
-
};
|
|
19
|
-
export type PublicParams<T = CompactPkeCrs> = {
|
|
20
|
-
[key in EncryptionTypes]?: {
|
|
21
|
-
publicParams: T;
|
|
22
|
-
publicParamsId: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export type EncryptInputParams = {
|
|
26
|
-
aclContractAddress: string;
|
|
27
|
-
chainId: number;
|
|
28
|
-
tfheCompactPublicKey: TfheCompactPublicKey;
|
|
29
|
-
publicParams: PublicParams;
|
|
30
|
-
contractAddress: string;
|
|
31
|
-
userAddress: string;
|
|
32
|
-
};
|
|
33
|
-
export declare const createEncryptedInput: ({ aclContractAddress, chainId, tfheCompactPublicKey, publicParams, contractAddress, userAddress, }: EncryptInputParams) => EncryptedInput;
|
|
34
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/sdk/keypair.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type EIP712Type = {
|
|
2
|
-
name: string;
|
|
3
|
-
type: string;
|
|
4
|
-
};
|
|
5
|
-
export type EIP712 = {
|
|
6
|
-
domain: {
|
|
7
|
-
chainId: number;
|
|
8
|
-
name: string;
|
|
9
|
-
verifyingContract: string;
|
|
10
|
-
version: string;
|
|
11
|
-
};
|
|
12
|
-
message: any;
|
|
13
|
-
primaryType: string;
|
|
14
|
-
types: {
|
|
15
|
-
[key: string]: EIP712Type[];
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Creates an EIP712 structure specifically for user decrypt requests
|
|
20
|
-
*
|
|
21
|
-
* @param gatewayChainId The chain ID of the gateway
|
|
22
|
-
* @param verifyingContract The address of the contract that will verify the signature
|
|
23
|
-
* @param publicKey The user's public key as a hex string or Uint8Array
|
|
24
|
-
* @param contractAddresses Array of contract addresses that can access the decryption
|
|
25
|
-
* @param contractsChainId The chain ID where the contracts are deployed
|
|
26
|
-
* @param startTimestamp The timestamp when the decryption permission becomes valid
|
|
27
|
-
* @param durationDays How many days the decryption permission remains valid
|
|
28
|
-
* @returns EIP712 typed data structure for user decryption
|
|
29
|
-
*/
|
|
30
|
-
export declare const createEIP712: (gatewayChainId: number, verifyingContract: string, contractsChainId: number) => (publicKey: string | Uint8Array, contractAddresses: string[], startTimestamp: string | number, durationDays: string | number, delegatedAccount?: string) => EIP712;
|
|
31
|
-
export declare const generateKeypair: () => {
|
|
32
|
-
publicKey: string;
|
|
33
|
-
privateKey: string;
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/test/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CompactPkeCrs, TfheClientKey, TfheCompactPublicKey } from 'node-tfhe';
|
|
2
|
-
export declare const publicKeyId = "408d8cbaa51dece7f782fe04ba0b1c1d017b1088";
|
|
3
|
-
export declare const privateKey: TfheClientKey;
|
|
4
|
-
export declare const publicKey: TfheCompactPublicKey;
|
|
5
|
-
export declare const publicParams: {
|
|
6
|
-
2048: {
|
|
7
|
-
publicParams: CompactPkeCrs;
|
|
8
|
-
publicParamsId: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
package/lib/tfhe.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TfheCompactPublicKey, TfheClientKey, CompactPkeCrs } from 'node-tfhe';
|
|
2
|
-
export declare const createTfheKeypair: () => {
|
|
3
|
-
clientKey: TfheClientKey;
|
|
4
|
-
publicKey: TfheCompactPublicKey;
|
|
5
|
-
crs: CompactPkeCrs;
|
|
6
|
-
};
|
|
7
|
-
export declare const createTfhePublicKey: () => string;
|
package/lib/utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const SERIALIZED_SIZE_LIMIT_CIPHERTEXT: bigint;
|
|
2
|
-
export declare const SERIALIZED_SIZE_LIMIT_PK: bigint;
|
|
3
|
-
export declare const SERIALIZED_SIZE_LIMIT_CRS: bigint;
|
|
4
|
-
export declare const cleanURL: (url: string | undefined) => string;
|
|
5
|
-
export declare const numberToHex: (num: number) => string;
|
|
6
|
-
export declare const fromHexString: (hexString: string) => Uint8Array;
|
|
7
|
-
export declare const toHexString: (bytes: Uint8Array, with0x?: boolean) => string;
|
|
8
|
-
export declare const bytesToHex: (byteArray: Uint8Array) => string;
|
|
9
|
-
export declare const bytesToBigInt: (byteArray: Uint8Array) => bigint;
|