@zama-fhe/relayer-sdk 0.3.0-0 → 0.3.0-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 +217 -217
- package/bundle/relayer-sdk-js.umd.cjs +7 -7
- package/lib/node.cjs +4 -0
- package/lib/node.js +4 -0
- package/lib/web.js +4 -0
- package/package.json +2 -2
package/lib/node.cjs
CHANGED
|
@@ -912,10 +912,13 @@ const ENCRYPTION_TYPES = {
|
|
|
912
912
|
};
|
|
913
913
|
|
|
914
914
|
const MAX_UINT64 = BigInt('18446744073709551615'); // 2^64 - 1
|
|
915
|
+
const RAW_CT_HASH_DOMAIN_SEPARATOR = 'ZK-w_rct';
|
|
916
|
+
const HANDLE_HASH_DOMAIN_SEPARATOR = 'ZK-w_hdl';
|
|
915
917
|
const computeHandles = (ciphertextWithZKProof, bitwidths, aclContractAddress, chainId, ciphertextVersion) => {
|
|
916
918
|
// Should be identical to:
|
|
917
919
|
// https://github.com/zama-ai/fhevm-backend/blob/bae00d1b0feafb63286e94acdc58dc88d9c481bf/fhevm-engine/zkproof-worker/src/verifier.rs#L301
|
|
918
920
|
const blob_hash = createHash('keccak256')
|
|
921
|
+
.update(Buffer.from(RAW_CT_HASH_DOMAIN_SEPARATOR))
|
|
919
922
|
.update(Buffer.from(ciphertextWithZKProof))
|
|
920
923
|
.digest();
|
|
921
924
|
const aclContractAddress20Bytes = Buffer.from(fromHexString(aclContractAddress));
|
|
@@ -925,6 +928,7 @@ const computeHandles = (ciphertextWithZKProof, bitwidths, aclContractAddress, ch
|
|
|
925
928
|
const encryptionType = ENCRYPTION_TYPES[bitwidth];
|
|
926
929
|
const encryptionIndex1Byte = Buffer.from([encryptionIndex]);
|
|
927
930
|
const handleHash = createHash('keccak256')
|
|
931
|
+
.update(Buffer.from(HANDLE_HASH_DOMAIN_SEPARATOR))
|
|
928
932
|
.update(blob_hash)
|
|
929
933
|
.update(encryptionIndex1Byte)
|
|
930
934
|
.update(aclContractAddress20Bytes)
|
package/lib/node.js
CHANGED
|
@@ -891,10 +891,13 @@ const ENCRYPTION_TYPES = {
|
|
|
891
891
|
};
|
|
892
892
|
|
|
893
893
|
const MAX_UINT64 = BigInt('18446744073709551615'); // 2^64 - 1
|
|
894
|
+
const RAW_CT_HASH_DOMAIN_SEPARATOR = 'ZK-w_rct';
|
|
895
|
+
const HANDLE_HASH_DOMAIN_SEPARATOR = 'ZK-w_hdl';
|
|
894
896
|
const computeHandles = (ciphertextWithZKProof, bitwidths, aclContractAddress, chainId, ciphertextVersion) => {
|
|
895
897
|
// Should be identical to:
|
|
896
898
|
// https://github.com/zama-ai/fhevm-backend/blob/bae00d1b0feafb63286e94acdc58dc88d9c481bf/fhevm-engine/zkproof-worker/src/verifier.rs#L301
|
|
897
899
|
const blob_hash = createHash('keccak256')
|
|
900
|
+
.update(Buffer.from(RAW_CT_HASH_DOMAIN_SEPARATOR))
|
|
898
901
|
.update(Buffer.from(ciphertextWithZKProof))
|
|
899
902
|
.digest();
|
|
900
903
|
const aclContractAddress20Bytes = Buffer.from(fromHexString(aclContractAddress));
|
|
@@ -904,6 +907,7 @@ const computeHandles = (ciphertextWithZKProof, bitwidths, aclContractAddress, ch
|
|
|
904
907
|
const encryptionType = ENCRYPTION_TYPES[bitwidth];
|
|
905
908
|
const encryptionIndex1Byte = Buffer.from([encryptionIndex]);
|
|
906
909
|
const handleHash = createHash('keccak256')
|
|
910
|
+
.update(Buffer.from(HANDLE_HASH_DOMAIN_SEPARATOR))
|
|
907
911
|
.update(blob_hash)
|
|
908
912
|
.update(encryptionIndex1Byte)
|
|
909
913
|
.update(aclContractAddress20Bytes)
|
package/lib/web.js
CHANGED
|
@@ -17022,10 +17022,13 @@ const ENCRYPTION_TYPES = {
|
|
|
17022
17022
|
};
|
|
17023
17023
|
|
|
17024
17024
|
const MAX_UINT64 = BigInt('18446744073709551615'); // 2^64 - 1
|
|
17025
|
+
const RAW_CT_HASH_DOMAIN_SEPARATOR = 'ZK-w_rct';
|
|
17026
|
+
const HANDLE_HASH_DOMAIN_SEPARATOR = 'ZK-w_hdl';
|
|
17025
17027
|
const computeHandles = (ciphertextWithZKProof, bitwidths, aclContractAddress, chainId, ciphertextVersion) => {
|
|
17026
17028
|
// Should be identical to:
|
|
17027
17029
|
// https://github.com/zama-ai/fhevm-backend/blob/bae00d1b0feafb63286e94acdc58dc88d9c481bf/fhevm-engine/zkproof-worker/src/verifier.rs#L301
|
|
17028
17030
|
const blob_hash = createHash('keccak256')
|
|
17031
|
+
.update(Buffer.from(RAW_CT_HASH_DOMAIN_SEPARATOR))
|
|
17029
17032
|
.update(Buffer.from(ciphertextWithZKProof))
|
|
17030
17033
|
.digest();
|
|
17031
17034
|
const aclContractAddress20Bytes = Buffer.from(fromHexString(aclContractAddress));
|
|
@@ -17035,6 +17038,7 @@ const computeHandles = (ciphertextWithZKProof, bitwidths, aclContractAddress, ch
|
|
|
17035
17038
|
const encryptionType = ENCRYPTION_TYPES[bitwidth];
|
|
17036
17039
|
const encryptionIndex1Byte = Buffer.from([encryptionIndex]);
|
|
17037
17040
|
const handleHash = createHash('keccak256')
|
|
17041
|
+
.update(Buffer.from(HANDLE_HASH_DOMAIN_SEPARATOR))
|
|
17038
17042
|
.update(blob_hash)
|
|
17039
17043
|
.update(encryptionIndex1Byte)
|
|
17040
17044
|
.update(aclContractAddress20Bytes)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zama-fhe/relayer-sdk",
|
|
3
|
-
"version": "0.3.0-
|
|
3
|
+
"version": "0.3.0-1",
|
|
4
4
|
"description": "fhevm Relayer SDK",
|
|
5
5
|
"main": "lib/node.js",
|
|
6
6
|
"types": "lib/node.d.ts",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"buffer": "6.0.3",
|
|
85
85
|
"crypto-browserify": "3.12.1",
|
|
86
86
|
"fetch-mock": "12.5.3",
|
|
87
|
-
"jest": "30.0.4",
|
|
87
|
+
"jest": "^30.0.4",
|
|
88
88
|
"jest-raw-loader": "1.0.1",
|
|
89
89
|
"path-browserify": "1.0.1",
|
|
90
90
|
"prettier": "3.6.2",
|