diff --git a/package-lock.json b/package-lock.json index 357c444..598b8e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fhevmjs", - "version": "0.6.0", + "version": "0.6.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fhevmjs", - "version": "0.6.0", + "version": "0.6.1", "license": "BSD-3-Clause-Clear", "dependencies": { "bigint-buffer": "^1.1.5", @@ -14,9 +14,9 @@ "fetch-mock": "^11.1.3", "keccak": "^3.0.4", "node-tfhe": "^0.9.1", - "node-tkms": "0.9.0-rc36", + "node-tkms": "^0.9.0", "tfhe": "^0.9.1", - "tkms": "0.9.0-rc36", + "tkms": "^0.9.0", "wasm-feature-detect": "^1.8.0" }, "bin": { @@ -5820,9 +5820,9 @@ "integrity": "sha512-M2CbUVX4DQneaaK/4fygy9lW0zjOOzM8yGWAgbKGRt/Gd07zaloFEGGHW7dbmUaHo022q1uo7nzxyYhe4UgqCw==" }, "node_modules/node-tkms": { - "version": "0.9.0-rc36", - "resolved": "https://registry.npmjs.org/node-tkms/-/node-tkms-0.9.0-rc36.tgz", - "integrity": "sha512-oGqJfjvb/igd9VgQaqYbzKc+CmrnQ/eY0ShmdE3JDKXL3C4Re/tBswT0KkWmlT1aM+Lxt5ihRNOs2oHtrPqr5w==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/node-tkms/-/node-tkms-0.9.0.tgz", + "integrity": "sha512-ulhV23okeMW3WYnxzhvf9u87tcXqe64JqUFlvdgu64uKteG8re+zwOjzkOdxvF0xSWQbMtEU96dvcrvQM10PEg==", "license": "BSD-3-Clause-Clear" }, "node_modules/normalize-path": { @@ -7085,9 +7085,9 @@ "integrity": "sha512-kmtl7KfCCZJaFhm9lUYsTtat+yT0qzOiO6bOidM2Pt7/7jptkbS2/myeGHxb9qi2/aJ30g2joo1euKZPa207tg==" }, "node_modules/tkms": { - "version": "0.9.0-rc36", - "resolved": "https://registry.npmjs.org/tkms/-/tkms-0.9.0-rc36.tgz", - "integrity": "sha512-8IoRi6mYgnrmwTNBe/ejvHOFRhs5M6o2Ls2RVXCgAzSVBBBWJC1O8hquqlciHfME/VooUD4iokzEaBfADvoXZw==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/tkms/-/tkms-0.9.0.tgz", + "integrity": "sha512-dSzorTHvIXTYZtn6ACV/iz0GhO/kMRjqGbo3o7JJ3GNbFhsPzbIEtAQ/x+h9nJdwn//VRdsStnOAE0fxUVIGrQ==", "license": "BSD-3-Clause-Clear" }, "node_modules/tmpl": { @@ -12075,9 +12075,9 @@ "integrity": "sha512-M2CbUVX4DQneaaK/4fygy9lW0zjOOzM8yGWAgbKGRt/Gd07zaloFEGGHW7dbmUaHo022q1uo7nzxyYhe4UgqCw==" }, "node-tkms": { - "version": "0.9.0-rc36", - "resolved": "https://registry.npmjs.org/node-tkms/-/node-tkms-0.9.0-rc36.tgz", - "integrity": "sha512-oGqJfjvb/igd9VgQaqYbzKc+CmrnQ/eY0ShmdE3JDKXL3C4Re/tBswT0KkWmlT1aM+Lxt5ihRNOs2oHtrPqr5w==" + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/node-tkms/-/node-tkms-0.9.0.tgz", + "integrity": "sha512-ulhV23okeMW3WYnxzhvf9u87tcXqe64JqUFlvdgu64uKteG8re+zwOjzkOdxvF0xSWQbMtEU96dvcrvQM10PEg==" }, "normalize-path": { "version": "3.0.0", @@ -12958,9 +12958,9 @@ "integrity": "sha512-kmtl7KfCCZJaFhm9lUYsTtat+yT0qzOiO6bOidM2Pt7/7jptkbS2/myeGHxb9qi2/aJ30g2joo1euKZPa207tg==" }, "tkms": { - "version": "0.9.0-rc36", - "resolved": "https://registry.npmjs.org/tkms/-/tkms-0.9.0-rc36.tgz", - "integrity": "sha512-8IoRi6mYgnrmwTNBe/ejvHOFRhs5M6o2Ls2RVXCgAzSVBBBWJC1O8hquqlciHfME/VooUD4iokzEaBfADvoXZw==" + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/tkms/-/tkms-0.9.0.tgz", + "integrity": "sha512-dSzorTHvIXTYZtn6ACV/iz0GhO/kMRjqGbo3o7JJ3GNbFhsPzbIEtAQ/x+h9nJdwn//VRdsStnOAE0fxUVIGrQ==" }, "tmpl": { "version": "1.0.5", diff --git a/package.json b/package.json index dc60234..0dfc00f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fhevmjs", - "version": "0.6.0", + "version": "0.6.1", "description": "fhEVM SDK for blockchain using TFHE", "main": "lib/node.js", "types": "lib/node/node.d.ts", @@ -52,9 +52,9 @@ "fetch-mock": "^11.1.3", "keccak": "^3.0.4", "node-tfhe": "^0.9.1", - "node-tkms": "0.9.0-rc36", + "node-tkms": "^0.9.0", "tfhe": "^0.9.1", - "tkms": "0.9.0-rc36", + "tkms": "^0.9.0", "wasm-feature-detect": "^1.8.0" }, "devDependencies": { diff --git a/src/sdk/index.ts b/src/sdk/index.ts index 2eb5894..528c410 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -26,7 +26,7 @@ export type FhevmInstance = { createEIP712: ( publicKey: string, contractAddress: string, - userAddress?: string, + delegatedAccount?: string, ) => EIP712; reencrypt: ( handle: bigint, diff --git a/src/sdk/reencrypt.ts b/src/sdk/reencrypt.ts index bb58e8f..6ee4641 100644 --- a/src/sdk/reencrypt.ts +++ b/src/sdk/reencrypt.ts @@ -31,10 +31,14 @@ export const reencryptRequest = const acl = new ethers.Contract(aclContractAddress, aclABI, provider); const userAllowed = await acl.persistAllowed(handle, userAddress); const contractAllowed = await acl.persistAllowed(handle, contractAddress); - const isAllowed = userAllowed && contractAllowed; - if (!isAllowed) { + if (!userAllowed) { throw new Error('User is not authorized to reencrypt this handle!'); } + if (!contractAllowed) { + throw new Error( + 'dApp contract is not authorized to reencrypt this handle!', + ); + } if (userAddress === contractAddress) { throw new Error( 'userAddress should not be equal to contractAddress when requesting reencryption!',