@zama-fhe/relayer-sdk 0.3.0-8 → 0.4.0-alpha.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/bundle/relayer-sdk-js.js +13724 -16835
- package/bundle/relayer-sdk-js.umd.cjs +5 -23
- package/bundle.d.ts +1 -2
- package/lib/node.cjs +4056 -461
- package/lib/node.d.ts +32 -111
- package/lib/node.js +4066 -470
- package/lib/web.d.ts +32 -111
- package/lib/web.js +4048 -452
- package/package.json +12 -4
package/lib/web.d.ts
CHANGED
|
@@ -1,60 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ApiKeyCookie } from './types/relayer';
|
|
2
|
+
import type { ApiKeyHeader } from './types/relayer';
|
|
3
|
+
import type { Auth } from './types/relayer';
|
|
4
|
+
import type { BearerToken } from './types/relayer';
|
|
5
|
+
import type { ClearValues } from './types/relayer';
|
|
6
|
+
import type { ClearValueType } from './types/relayer';
|
|
7
|
+
import { EncryptionBits } from './types/primitives';
|
|
8
|
+
import type { EncryptionBits as EncryptionBits_2 } from '../types/primitives';
|
|
9
|
+
import type { FhevmInstanceConfig } from './types/relayer';
|
|
10
|
+
import type { FhevmInstanceOptions } from './types/relayer';
|
|
2
11
|
import { InitInput as KMSInput } from 'tkms';
|
|
12
|
+
import type { PublicDecryptResults } from './types/relayer';
|
|
13
|
+
import type { RelayerV2InputProofOptions } from '../relayer-provider/v2/types/types';
|
|
14
|
+
import type { RelayerV2PublicDecryptOptions } from './relayer-provider/v2/types/types';
|
|
15
|
+
import type { RelayerV2UserDecryptOptions } from './relayer-provider/v2/types/types';
|
|
3
16
|
import { InitInput as TFHEInput } from 'tfhe';
|
|
17
|
+
import type { UserDecryptResults } from './types/relayer';
|
|
4
18
|
|
|
5
|
-
|
|
6
|
-
* Custom cookie authentication
|
|
7
|
-
*/
|
|
8
|
-
export declare type ApiKeyCookie = {
|
|
9
|
-
__type: 'ApiKeyCookie';
|
|
10
|
-
/**
|
|
11
|
-
* The cookie name. The default value is `x-api-key`.
|
|
12
|
-
*/
|
|
13
|
-
cookie?: string;
|
|
14
|
-
/**
|
|
15
|
-
* The API key.
|
|
16
|
-
*/
|
|
17
|
-
value: string;
|
|
18
|
-
};
|
|
19
|
+
export { ApiKeyCookie }
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
* Custom header authentication
|
|
22
|
-
*/
|
|
23
|
-
export declare type ApiKeyHeader = {
|
|
24
|
-
__type: 'ApiKeyHeader';
|
|
25
|
-
/**
|
|
26
|
-
* The header name. The default value is `x-api-key`.
|
|
27
|
-
*/
|
|
28
|
-
header?: string;
|
|
29
|
-
/**
|
|
30
|
-
* The API key.
|
|
31
|
-
*/
|
|
32
|
-
value: string;
|
|
33
|
-
};
|
|
21
|
+
export { ApiKeyHeader }
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
* Set the authentication method for the request. The default is no authentication.
|
|
37
|
-
* It supports:
|
|
38
|
-
* - Bearer Token
|
|
39
|
-
* - Custom header
|
|
40
|
-
* - Custom cookie
|
|
41
|
-
*/
|
|
42
|
-
export declare type Auth = BearerToken | ApiKeyHeader | ApiKeyCookie;
|
|
23
|
+
export { Auth }
|
|
43
24
|
|
|
44
|
-
|
|
45
|
-
* Bearer Token Authentication
|
|
46
|
-
*/
|
|
47
|
-
export declare type BearerToken = {
|
|
48
|
-
__type: 'BearerToken';
|
|
49
|
-
/**
|
|
50
|
-
* The Bearer token.
|
|
51
|
-
*/
|
|
52
|
-
token: string;
|
|
53
|
-
};
|
|
25
|
+
export { BearerToken }
|
|
54
26
|
|
|
55
|
-
export
|
|
27
|
+
export { ClearValues }
|
|
56
28
|
|
|
57
|
-
export
|
|
29
|
+
export { ClearValueType }
|
|
58
30
|
|
|
59
31
|
/**
|
|
60
32
|
* Creates an EIP712 structure specifically for user decrypt requests
|
|
@@ -92,39 +64,7 @@ export declare type EIP712Type = {
|
|
|
92
64
|
type: string;
|
|
93
65
|
};
|
|
94
66
|
|
|
95
|
-
|
|
96
|
-
* **FHE Type Mapping for Input Builders**
|
|
97
|
-
* * Maps the **number of encrypted bits** used by a FHEVM primary type
|
|
98
|
-
* to its corresponding **FheTypeId**. This constant is primarily used by
|
|
99
|
-
* `EncryptedInput` and `RelayerEncryptedInput` builders to determine the correct
|
|
100
|
-
* input type and calculate the total required bit-length.
|
|
101
|
-
*
|
|
102
|
-
* **Structure: \{ Encrypted Bit Length: FheTypeId \}**
|
|
103
|
-
*
|
|
104
|
-
* | Bits | FheTypeId | FHE Type Name | Note |
|
|
105
|
-
* | :--- | :-------- | :------------ | :--- |
|
|
106
|
-
* | 2 | 0 | `ebool` | The boolean type. |
|
|
107
|
-
* | (N/A)| 1 | `euint4` | **Deprecated** and omitted from this map. |
|
|
108
|
-
* | 8 | 2 | `euint8` | |
|
|
109
|
-
* | 16 | 3 | `euint16` | |
|
|
110
|
-
* | 32 | 4 | `euint32` | |
|
|
111
|
-
* | 64 | 5 | `euint64` | |
|
|
112
|
-
* | 128 | 6 | `euint128` | |
|
|
113
|
-
* | 160 | 7 | `eaddress` | Used for encrypted Ethereum addresses. |
|
|
114
|
-
* | 256 | 8 | `euint256` | The maximum supported integer size. |
|
|
115
|
-
*/
|
|
116
|
-
export declare const ENCRYPTION_TYPES: {
|
|
117
|
-
2: number;
|
|
118
|
-
8: number;
|
|
119
|
-
16: number;
|
|
120
|
-
32: number;
|
|
121
|
-
64: number;
|
|
122
|
-
128: number;
|
|
123
|
-
160: number;
|
|
124
|
-
256: number;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export declare type EncryptionBits = keyof typeof ENCRYPTION_TYPES;
|
|
67
|
+
export { EncryptionBits }
|
|
128
68
|
|
|
129
69
|
export declare type FhevmInstance = {
|
|
130
70
|
createEncryptedInput: (contractAddress: string, userAddress: string) => RelayerEncryptedInput;
|
|
@@ -133,8 +73,8 @@ export declare type FhevmInstance = {
|
|
|
133
73
|
privateKey: string;
|
|
134
74
|
};
|
|
135
75
|
createEIP712: (publicKey: string, contractAddresses: string[], startTimestamp: string | number, durationDays: string | number) => EIP712;
|
|
136
|
-
publicDecrypt: (handles: (string | Uint8Array)[]) => Promise<PublicDecryptResults>;
|
|
137
|
-
userDecrypt: (handles: HandleContractPair[], privateKey: string, publicKey: string, signature: string, contractAddresses: string[], userAddress: string, startTimestamp: string | number, durationDays: string | number) => Promise<UserDecryptResults>;
|
|
76
|
+
publicDecrypt: (handles: (string | Uint8Array)[], options?: RelayerV2PublicDecryptOptions) => Promise<PublicDecryptResults>;
|
|
77
|
+
userDecrypt: (handles: HandleContractPair[], privateKey: string, publicKey: string, signature: string, contractAddresses: string[], userAddress: string, startTimestamp: string | number, durationDays: string | number, options?: RelayerV2UserDecryptOptions) => Promise<UserDecryptResults>;
|
|
138
78
|
getPublicKey: () => {
|
|
139
79
|
publicKeyId: string;
|
|
140
80
|
publicKey: Uint8Array;
|
|
@@ -145,23 +85,9 @@ export declare type FhevmInstance = {
|
|
|
145
85
|
} | null;
|
|
146
86
|
};
|
|
147
87
|
|
|
148
|
-
export
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
kmsContractAddress: string;
|
|
152
|
-
inputVerifierContractAddress: string;
|
|
153
|
-
aclContractAddress: string;
|
|
154
|
-
gatewayChainId: number;
|
|
155
|
-
chainId?: number;
|
|
156
|
-
relayerUrl?: string;
|
|
157
|
-
network?: Eip1193Provider | string;
|
|
158
|
-
publicParams?: PublicParams<Uint8Array> | null;
|
|
159
|
-
publicKey?: {
|
|
160
|
-
data: Uint8Array | null;
|
|
161
|
-
id: string | null;
|
|
162
|
-
};
|
|
163
|
-
auth?: Auth;
|
|
164
|
-
};
|
|
88
|
+
export { FhevmInstanceConfig }
|
|
89
|
+
|
|
90
|
+
export { FhevmInstanceOptions }
|
|
165
91
|
|
|
166
92
|
export declare const generateKeypair: () => {
|
|
167
93
|
publicKey: string;
|
|
@@ -187,11 +113,7 @@ export { KMSInput }
|
|
|
187
113
|
|
|
188
114
|
export declare const MainnetConfig: FhevmInstanceConfig;
|
|
189
115
|
|
|
190
|
-
export
|
|
191
|
-
clearValues: ClearValues;
|
|
192
|
-
abiEncodedClearValues: `0x${string}`;
|
|
193
|
-
decryptionProof: `0x${string}`;
|
|
194
|
-
};
|
|
116
|
+
export { PublicDecryptResults }
|
|
195
117
|
|
|
196
118
|
export declare type PublicParams<T = TFHEType['CompactPkeCrs']> = {
|
|
197
119
|
2048: {
|
|
@@ -209,10 +131,9 @@ export declare type RelayerEncryptedInput = {
|
|
|
209
131
|
add128: (value: number | bigint) => RelayerEncryptedInput;
|
|
210
132
|
add256: (value: number | bigint) => RelayerEncryptedInput;
|
|
211
133
|
addAddress: (value: string) => RelayerEncryptedInput;
|
|
212
|
-
getBits: () =>
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}) => Promise<{
|
|
134
|
+
getBits: () => EncryptionBits_2[];
|
|
135
|
+
getCiphertextWithInputVerification(): Uint8Array;
|
|
136
|
+
encrypt: (options?: RelayerV2InputProofOptions) => Promise<{
|
|
216
137
|
handles: Uint8Array[];
|
|
217
138
|
inputProof: Uint8Array;
|
|
218
139
|
}>;
|
|
@@ -233,6 +154,6 @@ export declare type TFHEType = {
|
|
|
233
154
|
ZkComputeLoad: any;
|
|
234
155
|
};
|
|
235
156
|
|
|
236
|
-
export
|
|
157
|
+
export { UserDecryptResults }
|
|
237
158
|
|
|
238
159
|
export { }
|