@zama-fhe/relayer-sdk 0.3.0-4 → 0.3.0-5

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.d.ts CHANGED
@@ -10,7 +10,7 @@ export {
10
10
  FhevmInstance,
11
11
  FhevmInstanceConfig,
12
12
  createInstance,
13
- EncryptionTypes,
13
+ EncryptionBits,
14
14
  ENCRYPTION_TYPES,
15
15
  UserDecryptResults,
16
16
  PublicDecryptResults,
@@ -18,4 +18,8 @@ export {
18
18
  ClearValues,
19
19
  initSDK,
20
20
  SepoliaConfig,
21
+ Auth,
22
+ BearerToken,
23
+ ApiKeyCookie,
24
+ ApiKeyHeader,
21
25
  } from './lib/web';
package/lib/node.cjs CHANGED
@@ -788,7 +788,7 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
788
788
  checkEncryptedValue(Number(value), 1);
789
789
  checkLimit(2);
790
790
  builder.push_boolean(!!value);
791
- bits.push(1); // ebool takes 2 encrypted bits
791
+ bits.push(2); // ebool takes 2 encrypted bits
792
792
  return this;
793
793
  },
794
794
  add8(value) {
@@ -842,36 +842,6 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
842
842
  bits.push(256);
843
843
  return this;
844
844
  },
845
- addBytes64(value) {
846
- if (value.length !== 64)
847
- throw Error('Uncorrect length of input Uint8Array, should be 64 for an ebytes64');
848
- const bigIntValue = bytesToBigInt(value);
849
- checkEncryptedValue(bigIntValue, 512);
850
- checkLimit(512);
851
- builder.push_u512(bigIntValue);
852
- bits.push(512);
853
- return this;
854
- },
855
- addBytes128(value) {
856
- if (value.length !== 128)
857
- throw Error('Uncorrect length of input Uint8Array, should be 128 for an ebytes128');
858
- const bigIntValue = bytesToBigInt(value);
859
- checkEncryptedValue(bigIntValue, 1024);
860
- checkLimit(1024);
861
- builder.push_u1024(bigIntValue);
862
- bits.push(1024);
863
- return this;
864
- },
865
- addBytes256(value) {
866
- if (value.length !== 256)
867
- throw Error('Uncorrect length of input Uint8Array, should be 256 for an ebytes256');
868
- const bigIntValue = bytesToBigInt(value);
869
- checkEncryptedValue(bigIntValue, 2048);
870
- checkLimit(2048);
871
- builder.push_u2048(bigIntValue);
872
- bits.push(2048);
873
- return this;
874
- },
875
845
  getBits() {
876
846
  return bits;
877
847
  },
@@ -904,18 +874,37 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
904
874
  };
905
875
  };
906
876
 
877
+ /**
878
+ * **FHE Type Mapping for Input Builders**
879
+ * * Maps the **number of encrypted bits** used by a FHEVM primary type
880
+ * to its corresponding **FheTypeId**. This constant is primarily used by
881
+ * `EncryptedInput` and `RelayerEncryptedInput` builders to determine the correct
882
+ * input type and calculate the total required bit-length.
883
+ *
884
+ * **Structure: \{ Encrypted Bit Length: FheTypeId \}**
885
+ *
886
+ * | Bits | FheTypeId | FHE Type Name | Note |
887
+ * | :--- | :-------- | :------------ | :--- |
888
+ * | 2 | 0 | `ebool` | The boolean type. |
889
+ * | (N/A)| 1 | `euint4` | **Deprecated** and omitted from this map. |
890
+ * | 8 | 2 | `euint8` | |
891
+ * | 16 | 3 | `euint16` | |
892
+ * | 32 | 4 | `euint32` | |
893
+ * | 64 | 5 | `euint64` | |
894
+ * | 128 | 6 | `euint128` | |
895
+ * | 160 | 7 | `eaddress` | Used for encrypted Ethereum addresses. |
896
+ * | 256 | 8 | `euint256` | The maximum supported integer size. |
897
+ */
907
898
  const ENCRYPTION_TYPES = {
908
- 1: 0, // ebool takes 2 encrypted bits
909
- 8: 2,
910
- 16: 3,
911
- 32: 4,
912
- 64: 5,
913
- 128: 6,
914
- 160: 7,
915
- 256: 8,
916
- 512: 9,
917
- 1024: 10,
918
- 2048: 11,
899
+ 2: 0, // ebool (FheTypeId=0) is using 2 encrypted bits
900
+ // euint4 (FheTypeId=1) is deprecated
901
+ 8: 2, // euint8 (FheTypeId=2) is using 8 encrypted bits
902
+ 16: 3, // euint16 (FheTypeId=3) is using 16 encrypted bits
903
+ 32: 4, // euint32 (FheTypeId=4) is using 32 encrypted bits
904
+ 64: 5, // euint64 (FheTypeId=5) is using 64 encrypted bits
905
+ 128: 6, // euint128 (FheTypeId=128) is using 128 encrypted bits
906
+ 160: 7, // eaddress (FheTypeId=7) is using 160 encrypted bits
907
+ 256: 8, // euint256 (FheTypeId=8) is using 256 encrypted bits
919
908
  };
920
909
 
921
910
  const MAX_UINT64 = BigInt('18446744073709551615'); // 2^64 - 1
@@ -1288,6 +1277,7 @@ const publicDecryptRequest = (kmsSigners, thresholdSigners, gatewayChainId, veri
1288
1277
  const result = json.response[0];
1289
1278
  const decryptedResult = ensure0x(result.decrypted_value);
1290
1279
  const kmsSignatures = result.signatures.map(ensure0x);
1280
+ // TODO result.extra_data (RelayerPublicDecryptJsonResponse)
1291
1281
  const signedExtraData = '0x';
1292
1282
  const recoveredAddresses = kmsSignatures.map((kmsSignature) => {
1293
1283
  const recoveredAddress = ethers.ethers.verifyTypedData(domain, types, { ctHandles: handles, decryptedResult, extraData: signedExtraData }, kmsSignature);
@@ -1428,7 +1418,7 @@ const SepoliaConfig = {
1428
1418
  // Gateway chain id
1429
1419
  gatewayChainId: 10901,
1430
1420
  // Optional RPC provider to host chain
1431
- network: 'https://eth-sepolia.public.blastapi.io',
1421
+ network: 'https://ethereum-sepolia-rpc.publicnode.com',
1432
1422
  // Relayer URL
1433
1423
  relayerUrl: 'https://relayer.testnet.zama.org',
1434
1424
  };
package/lib/node.d.ts CHANGED
@@ -6,7 +6,7 @@ import { TfheCompactPublicKey } from 'node-tfhe';
6
6
  /**
7
7
  * Custom cookie authentication
8
8
  */
9
- declare type ApiKeyCookie = {
9
+ export declare type ApiKeyCookie = {
10
10
  __type: 'ApiKeyCookie';
11
11
  /**
12
12
  * The cookie name. The default value is `x-api-key`.
@@ -21,7 +21,7 @@ declare type ApiKeyCookie = {
21
21
  /**
22
22
  * Custom header authentication
23
23
  */
24
- declare type ApiKeyHeader = {
24
+ export declare type ApiKeyHeader = {
25
25
  __type: 'ApiKeyHeader';
26
26
  /**
27
27
  * The header name. The default value is `x-api-key`.
@@ -40,12 +40,12 @@ declare type ApiKeyHeader = {
40
40
  * - Custom header
41
41
  * - Custom cookie
42
42
  */
43
- declare type Auth = BearerToken | ApiKeyHeader | ApiKeyCookie;
43
+ export declare type Auth = BearerToken | ApiKeyHeader | ApiKeyCookie;
44
44
 
45
45
  /**
46
46
  * Bearer Token Authentication
47
47
  */
48
- declare type BearerToken = {
48
+ export declare type BearerToken = {
49
49
  __type: 'BearerToken';
50
50
  /**
51
51
  * The Bearer token.
@@ -101,8 +101,29 @@ export declare type EIP712Type = {
101
101
  type: string;
102
102
  };
103
103
 
104
+ /**
105
+ * **FHE Type Mapping for Input Builders**
106
+ * * Maps the **number of encrypted bits** used by a FHEVM primary type
107
+ * to its corresponding **FheTypeId**. This constant is primarily used by
108
+ * `EncryptedInput` and `RelayerEncryptedInput` builders to determine the correct
109
+ * input type and calculate the total required bit-length.
110
+ *
111
+ * **Structure: \{ Encrypted Bit Length: FheTypeId \}**
112
+ *
113
+ * | Bits | FheTypeId | FHE Type Name | Note |
114
+ * | :--- | :-------- | :------------ | :--- |
115
+ * | 2 | 0 | `ebool` | The boolean type. |
116
+ * | (N/A)| 1 | `euint4` | **Deprecated** and omitted from this map. |
117
+ * | 8 | 2 | `euint8` | |
118
+ * | 16 | 3 | `euint16` | |
119
+ * | 32 | 4 | `euint32` | |
120
+ * | 64 | 5 | `euint64` | |
121
+ * | 128 | 6 | `euint128` | |
122
+ * | 160 | 7 | `eaddress` | Used for encrypted Ethereum addresses. |
123
+ * | 256 | 8 | `euint256` | The maximum supported integer size. |
124
+ */
104
125
  export declare const ENCRYPTION_TYPES: {
105
- 1: number;
126
+ 2: number;
106
127
  8: number;
107
128
  16: number;
108
129
  32: number;
@@ -110,12 +131,9 @@ export declare const ENCRYPTION_TYPES: {
110
131
  128: number;
111
132
  160: number;
112
133
  256: number;
113
- 512: number;
114
- 1024: number;
115
- 2048: number;
116
134
  };
117
135
 
118
- export declare type EncryptionTypes = keyof typeof ENCRYPTION_TYPES;
136
+ export declare type EncryptionBits = keyof typeof ENCRYPTION_TYPES;
119
137
 
120
138
  export declare type FhevmInstance = {
121
139
  createEncryptedInput: (contractAddress: string, userAddress: string) => RelayerEncryptedInput;
@@ -175,7 +193,7 @@ export declare type PublicDecryptResults = {
175
193
  };
176
194
 
177
195
  export declare type PublicParams<T = TFHEType['CompactPkeCrs']> = {
178
- [key in EncryptionTypes]?: {
196
+ 2048: {
179
197
  publicParams: T;
180
198
  publicParamsId: string;
181
199
  };
@@ -190,7 +208,7 @@ export declare type RelayerEncryptedInput = {
190
208
  add128: (value: number | bigint) => RelayerEncryptedInput;
191
209
  add256: (value: number | bigint) => RelayerEncryptedInput;
192
210
  addAddress: (value: string) => RelayerEncryptedInput;
193
- getBits: () => EncryptionTypes[];
211
+ getBits: () => EncryptionBits[];
194
212
  encrypt: (options?: {
195
213
  auth?: Auth;
196
214
  }) => Promise<{
package/lib/node.js CHANGED
@@ -767,7 +767,7 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
767
767
  checkEncryptedValue(Number(value), 1);
768
768
  checkLimit(2);
769
769
  builder.push_boolean(!!value);
770
- bits.push(1); // ebool takes 2 encrypted bits
770
+ bits.push(2); // ebool takes 2 encrypted bits
771
771
  return this;
772
772
  },
773
773
  add8(value) {
@@ -821,36 +821,6 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
821
821
  bits.push(256);
822
822
  return this;
823
823
  },
824
- addBytes64(value) {
825
- if (value.length !== 64)
826
- throw Error('Uncorrect length of input Uint8Array, should be 64 for an ebytes64');
827
- const bigIntValue = bytesToBigInt(value);
828
- checkEncryptedValue(bigIntValue, 512);
829
- checkLimit(512);
830
- builder.push_u512(bigIntValue);
831
- bits.push(512);
832
- return this;
833
- },
834
- addBytes128(value) {
835
- if (value.length !== 128)
836
- throw Error('Uncorrect length of input Uint8Array, should be 128 for an ebytes128');
837
- const bigIntValue = bytesToBigInt(value);
838
- checkEncryptedValue(bigIntValue, 1024);
839
- checkLimit(1024);
840
- builder.push_u1024(bigIntValue);
841
- bits.push(1024);
842
- return this;
843
- },
844
- addBytes256(value) {
845
- if (value.length !== 256)
846
- throw Error('Uncorrect length of input Uint8Array, should be 256 for an ebytes256');
847
- const bigIntValue = bytesToBigInt(value);
848
- checkEncryptedValue(bigIntValue, 2048);
849
- checkLimit(2048);
850
- builder.push_u2048(bigIntValue);
851
- bits.push(2048);
852
- return this;
853
- },
854
824
  getBits() {
855
825
  return bits;
856
826
  },
@@ -883,18 +853,37 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
883
853
  };
884
854
  };
885
855
 
856
+ /**
857
+ * **FHE Type Mapping for Input Builders**
858
+ * * Maps the **number of encrypted bits** used by a FHEVM primary type
859
+ * to its corresponding **FheTypeId**. This constant is primarily used by
860
+ * `EncryptedInput` and `RelayerEncryptedInput` builders to determine the correct
861
+ * input type and calculate the total required bit-length.
862
+ *
863
+ * **Structure: \{ Encrypted Bit Length: FheTypeId \}**
864
+ *
865
+ * | Bits | FheTypeId | FHE Type Name | Note |
866
+ * | :--- | :-------- | :------------ | :--- |
867
+ * | 2 | 0 | `ebool` | The boolean type. |
868
+ * | (N/A)| 1 | `euint4` | **Deprecated** and omitted from this map. |
869
+ * | 8 | 2 | `euint8` | |
870
+ * | 16 | 3 | `euint16` | |
871
+ * | 32 | 4 | `euint32` | |
872
+ * | 64 | 5 | `euint64` | |
873
+ * | 128 | 6 | `euint128` | |
874
+ * | 160 | 7 | `eaddress` | Used for encrypted Ethereum addresses. |
875
+ * | 256 | 8 | `euint256` | The maximum supported integer size. |
876
+ */
886
877
  const ENCRYPTION_TYPES = {
887
- 1: 0, // ebool takes 2 encrypted bits
888
- 8: 2,
889
- 16: 3,
890
- 32: 4,
891
- 64: 5,
892
- 128: 6,
893
- 160: 7,
894
- 256: 8,
895
- 512: 9,
896
- 1024: 10,
897
- 2048: 11,
878
+ 2: 0, // ebool (FheTypeId=0) is using 2 encrypted bits
879
+ // euint4 (FheTypeId=1) is deprecated
880
+ 8: 2, // euint8 (FheTypeId=2) is using 8 encrypted bits
881
+ 16: 3, // euint16 (FheTypeId=3) is using 16 encrypted bits
882
+ 32: 4, // euint32 (FheTypeId=4) is using 32 encrypted bits
883
+ 64: 5, // euint64 (FheTypeId=5) is using 64 encrypted bits
884
+ 128: 6, // euint128 (FheTypeId=128) is using 128 encrypted bits
885
+ 160: 7, // eaddress (FheTypeId=7) is using 160 encrypted bits
886
+ 256: 8, // euint256 (FheTypeId=8) is using 256 encrypted bits
898
887
  };
899
888
 
900
889
  const MAX_UINT64 = BigInt('18446744073709551615'); // 2^64 - 1
@@ -1267,6 +1256,7 @@ const publicDecryptRequest = (kmsSigners, thresholdSigners, gatewayChainId, veri
1267
1256
  const result = json.response[0];
1268
1257
  const decryptedResult = ensure0x(result.decrypted_value);
1269
1258
  const kmsSignatures = result.signatures.map(ensure0x);
1259
+ // TODO result.extra_data (RelayerPublicDecryptJsonResponse)
1270
1260
  const signedExtraData = '0x';
1271
1261
  const recoveredAddresses = kmsSignatures.map((kmsSignature) => {
1272
1262
  const recoveredAddress = ethers.verifyTypedData(domain, types, { ctHandles: handles, decryptedResult, extraData: signedExtraData }, kmsSignature);
@@ -1407,7 +1397,7 @@ const SepoliaConfig = {
1407
1397
  // Gateway chain id
1408
1398
  gatewayChainId: 10901,
1409
1399
  // Optional RPC provider to host chain
1410
- network: 'https://eth-sepolia.public.blastapi.io',
1400
+ network: 'https://ethereum-sepolia-rpc.publicnode.com',
1411
1401
  // Relayer URL
1412
1402
  relayerUrl: 'https://relayer.testnet.zama.org',
1413
1403
  };
package/lib/web.d.ts CHANGED
@@ -5,7 +5,7 @@ import { InitInput as TFHEInput } from 'tfhe';
5
5
  /**
6
6
  * Custom cookie authentication
7
7
  */
8
- declare type ApiKeyCookie = {
8
+ export declare type ApiKeyCookie = {
9
9
  __type: 'ApiKeyCookie';
10
10
  /**
11
11
  * The cookie name. The default value is `x-api-key`.
@@ -20,7 +20,7 @@ declare type ApiKeyCookie = {
20
20
  /**
21
21
  * Custom header authentication
22
22
  */
23
- declare type ApiKeyHeader = {
23
+ export declare type ApiKeyHeader = {
24
24
  __type: 'ApiKeyHeader';
25
25
  /**
26
26
  * The header name. The default value is `x-api-key`.
@@ -39,12 +39,12 @@ declare type ApiKeyHeader = {
39
39
  * - Custom header
40
40
  * - Custom cookie
41
41
  */
42
- declare type Auth = BearerToken | ApiKeyHeader | ApiKeyCookie;
42
+ export declare type Auth = BearerToken | ApiKeyHeader | ApiKeyCookie;
43
43
 
44
44
  /**
45
45
  * Bearer Token Authentication
46
46
  */
47
- declare type BearerToken = {
47
+ export declare type BearerToken = {
48
48
  __type: 'BearerToken';
49
49
  /**
50
50
  * The Bearer token.
@@ -92,8 +92,29 @@ export declare type EIP712Type = {
92
92
  type: string;
93
93
  };
94
94
 
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
+ */
95
116
  export declare const ENCRYPTION_TYPES: {
96
- 1: number;
117
+ 2: number;
97
118
  8: number;
98
119
  16: number;
99
120
  32: number;
@@ -101,12 +122,9 @@ export declare const ENCRYPTION_TYPES: {
101
122
  128: number;
102
123
  160: number;
103
124
  256: number;
104
- 512: number;
105
- 1024: number;
106
- 2048: number;
107
125
  };
108
126
 
109
- export declare type EncryptionTypes = keyof typeof ENCRYPTION_TYPES;
127
+ export declare type EncryptionBits = keyof typeof ENCRYPTION_TYPES;
110
128
 
111
129
  export declare type FhevmInstance = {
112
130
  createEncryptedInput: (contractAddress: string, userAddress: string) => RelayerEncryptedInput;
@@ -174,7 +192,7 @@ export declare type PublicDecryptResults = {
174
192
  };
175
193
 
176
194
  export declare type PublicParams<T = TFHEType['CompactPkeCrs']> = {
177
- [key in EncryptionTypes]?: {
195
+ 2048: {
178
196
  publicParams: T;
179
197
  publicParamsId: string;
180
198
  };
@@ -189,7 +207,7 @@ export declare type RelayerEncryptedInput = {
189
207
  add128: (value: number | bigint) => RelayerEncryptedInput;
190
208
  add256: (value: number | bigint) => RelayerEncryptedInput;
191
209
  addAddress: (value: string) => RelayerEncryptedInput;
192
- getBits: () => EncryptionTypes[];
210
+ getBits: () => EncryptionBits[];
193
211
  encrypt: (options?: {
194
212
  auth?: Auth;
195
213
  }) => Promise<{
@@ -202,7 +220,7 @@ export declare const SepoliaConfig: FhevmInstanceConfig;
202
220
 
203
221
  export { TFHEInput }
204
222
 
205
- declare type TFHEType = {
223
+ export declare type TFHEType = {
206
224
  default?: any;
207
225
  TFHEInput?: any;
208
226
  TfheCompactPublicKey: any;
package/lib/web.js CHANGED
@@ -17014,7 +17014,7 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
17014
17014
  checkEncryptedValue(Number(value), 1);
17015
17015
  checkLimit(2);
17016
17016
  builder.push_boolean(!!value);
17017
- bits.push(1); // ebool takes 2 encrypted bits
17017
+ bits.push(2); // ebool takes 2 encrypted bits
17018
17018
  return this;
17019
17019
  },
17020
17020
  add8(value) {
@@ -17068,36 +17068,6 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
17068
17068
  bits.push(256);
17069
17069
  return this;
17070
17070
  },
17071
- addBytes64(value) {
17072
- if (value.length !== 64)
17073
- throw Error('Uncorrect length of input Uint8Array, should be 64 for an ebytes64');
17074
- const bigIntValue = bytesToBigInt(value);
17075
- checkEncryptedValue(bigIntValue, 512);
17076
- checkLimit(512);
17077
- builder.push_u512(bigIntValue);
17078
- bits.push(512);
17079
- return this;
17080
- },
17081
- addBytes128(value) {
17082
- if (value.length !== 128)
17083
- throw Error('Uncorrect length of input Uint8Array, should be 128 for an ebytes128');
17084
- const bigIntValue = bytesToBigInt(value);
17085
- checkEncryptedValue(bigIntValue, 1024);
17086
- checkLimit(1024);
17087
- builder.push_u1024(bigIntValue);
17088
- bits.push(1024);
17089
- return this;
17090
- },
17091
- addBytes256(value) {
17092
- if (value.length !== 256)
17093
- throw Error('Uncorrect length of input Uint8Array, should be 256 for an ebytes256');
17094
- const bigIntValue = bytesToBigInt(value);
17095
- checkEncryptedValue(bigIntValue, 2048);
17096
- checkLimit(2048);
17097
- builder.push_u2048(bigIntValue);
17098
- bits.push(2048);
17099
- return this;
17100
- },
17101
17071
  getBits() {
17102
17072
  return bits;
17103
17073
  },
@@ -17130,18 +17100,37 @@ const createEncryptedInput = ({ aclContractAddress, chainId, tfheCompactPublicKe
17130
17100
  };
17131
17101
  };
17132
17102
 
17103
+ /**
17104
+ * **FHE Type Mapping for Input Builders**
17105
+ * * Maps the **number of encrypted bits** used by a FHEVM primary type
17106
+ * to its corresponding **FheTypeId**. This constant is primarily used by
17107
+ * `EncryptedInput` and `RelayerEncryptedInput` builders to determine the correct
17108
+ * input type and calculate the total required bit-length.
17109
+ *
17110
+ * **Structure: \{ Encrypted Bit Length: FheTypeId \}**
17111
+ *
17112
+ * | Bits | FheTypeId | FHE Type Name | Note |
17113
+ * | :--- | :-------- | :------------ | :--- |
17114
+ * | 2 | 0 | `ebool` | The boolean type. |
17115
+ * | (N/A)| 1 | `euint4` | **Deprecated** and omitted from this map. |
17116
+ * | 8 | 2 | `euint8` | |
17117
+ * | 16 | 3 | `euint16` | |
17118
+ * | 32 | 4 | `euint32` | |
17119
+ * | 64 | 5 | `euint64` | |
17120
+ * | 128 | 6 | `euint128` | |
17121
+ * | 160 | 7 | `eaddress` | Used for encrypted Ethereum addresses. |
17122
+ * | 256 | 8 | `euint256` | The maximum supported integer size. |
17123
+ */
17133
17124
  const ENCRYPTION_TYPES = {
17134
- 1: 0, // ebool takes 2 encrypted bits
17135
- 8: 2,
17136
- 16: 3,
17137
- 32: 4,
17138
- 64: 5,
17139
- 128: 6,
17140
- 160: 7,
17141
- 256: 8,
17142
- 512: 9,
17143
- 1024: 10,
17144
- 2048: 11,
17125
+ 2: 0, // ebool (FheTypeId=0) is using 2 encrypted bits
17126
+ // euint4 (FheTypeId=1) is deprecated
17127
+ 8: 2, // euint8 (FheTypeId=2) is using 8 encrypted bits
17128
+ 16: 3, // euint16 (FheTypeId=3) is using 16 encrypted bits
17129
+ 32: 4, // euint32 (FheTypeId=4) is using 32 encrypted bits
17130
+ 64: 5, // euint64 (FheTypeId=5) is using 64 encrypted bits
17131
+ 128: 6, // euint128 (FheTypeId=128) is using 128 encrypted bits
17132
+ 160: 7, // eaddress (FheTypeId=7) is using 160 encrypted bits
17133
+ 256: 8, // euint256 (FheTypeId=8) is using 256 encrypted bits
17145
17134
  };
17146
17135
 
17147
17136
  const MAX_UINT64 = BigInt('18446744073709551615'); // 2^64 - 1
@@ -17514,6 +17503,7 @@ const publicDecryptRequest = (kmsSigners, thresholdSigners, gatewayChainId, veri
17514
17503
  const result = json.response[0];
17515
17504
  const decryptedResult = ensure0x(result.decrypted_value);
17516
17505
  const kmsSignatures = result.signatures.map(ensure0x);
17506
+ // TODO result.extra_data (RelayerPublicDecryptJsonResponse)
17517
17507
  const signedExtraData = '0x';
17518
17508
  const recoveredAddresses = kmsSignatures.map((kmsSignature) => {
17519
17509
  const recoveredAddress = ethers.verifyTypedData(domain, types, { ctHandles: handles, decryptedResult, extraData: signedExtraData }, kmsSignature);
@@ -17654,7 +17644,7 @@ const SepoliaConfig = {
17654
17644
  // Gateway chain id
17655
17645
  gatewayChainId: 10901,
17656
17646
  // Optional RPC provider to host chain
17657
- network: 'https://eth-sepolia.public.blastapi.io',
17647
+ network: 'https://ethereum-sepolia-rpc.publicnode.com',
17658
17648
  // Relayer URL
17659
17649
  relayerUrl: 'https://relayer.testnet.zama.org',
17660
17650
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zama-fhe/relayer-sdk",
3
- "version": "0.3.0-4",
3
+ "version": "0.3.0-5",
4
4
  "description": "fhevm Relayer SDK",
5
5
  "main": "lib/node.js",
6
6
  "types": "lib/node.d.ts",
@@ -11,19 +11,19 @@
11
11
  },
12
12
  "exports": {
13
13
  "./web": {
14
+ "types": "./lib/web.d.ts",
14
15
  "import": "./lib/web.js",
15
- "require": "./lib/web.js",
16
- "types": "./lib/web.d.ts"
16
+ "require": "./lib/web.js"
17
17
  },
18
18
  "./bundle": {
19
+ "types": "./bundle.d.ts",
19
20
  "import": "./bundle.js",
20
- "require": "./bundle.js",
21
- "types": "./bundle.d.ts"
21
+ "require": "./bundle.js"
22
22
  },
23
23
  "./node": {
24
+ "types": "./lib/node.d.ts",
24
25
  "import": "./lib/node.js",
25
- "require": "./lib/node.cjs",
26
- "types": "./lib/node.d.ts"
26
+ "require": "./lib/node.cjs"
27
27
  },
28
28
  "./package.json": "./package.json"
29
29
  },