From 90e0828d17e30a9e9492ac25432217823c667468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Mon, 18 Nov 2024 17:34:32 +0100 Subject: [PATCH 1/2] feat: add log if gateway respond failure --- src/sdk/reencrypt.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sdk/reencrypt.ts b/src/sdk/reencrypt.ts index 8883299..72b0825 100644 --- a/src/sdk/reencrypt.ts +++ b/src/sdk/reencrypt.ts @@ -71,6 +71,10 @@ export const reencryptRequest = throw new Error("Gateway didn't response correctly"); } + if (json.status === 'failure') { + throw new Error("The reencryption didn't succeed"); + } + const client = new_client(kmsSignatures, userAddress, 'default'); try { @@ -88,7 +92,10 @@ export const reencryptRequest = // Duplicate payloadForRequest and replace ciphertext_handle with ciphertext_digest. const { ciphertext_handle, ...p } = payloadForRequest; // TODO check all ciphertext digests are all the same - const payloadForVerification = { ...p, ciphertext_digest: json.response[0].ciphertext_digest }; + const payloadForVerification = { + ...p, + ciphertext_digest: json.response[0].ciphertext_digest, + }; const decryption = process_reencryption_resp_from_js( client, From 160d21d070655047d82b892983aa906891b8762c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Mon, 18 Nov 2024 17:34:45 +0100 Subject: [PATCH 2/2] 0.6.0-9 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f3393e..a66feb8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fhevmjs", - "version": "0.6.0-8", + "version": "0.6.0-9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fhevmjs", - "version": "0.6.0-8", + "version": "0.6.0-9", "license": "BSD-3-Clause-Clear", "dependencies": { "@types/keccak": "^3.0.4", diff --git a/package.json b/package.json index abb4b0e..e084732 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fhevmjs", - "version": "0.6.0-8", + "version": "0.6.0-9", "description": "fhEVM SDK for blockchain using TFHE", "main": "lib/node.js", "types": "lib/node/node.d.ts",