From 10b3dca3d89fbeaadc3b7927d0e7c110bdfae2ab Mon Sep 17 00:00:00 2001 From: Thunder Date: Sun, 24 Sep 2023 15:38:24 +0300 Subject: [PATCH] WIP: Removed the extra line for encoding base24. (#1137) --- packages/UI/examples/server-example/src/server.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/UI/examples/server-example/src/server.ts b/packages/UI/examples/server-example/src/server.ts index eea033cdc6..679dde433b 100644 --- a/packages/UI/examples/server-example/src/server.ts +++ b/packages/UI/examples/server-example/src/server.ts @@ -27,8 +27,7 @@ type Payload = { const verify = async (payload: Payload) => { try { - const content = Uint8Array.from(Buffer.from(payload.content || "", "base64")); - const hash = MD5(content.toString()).toString(); + const hash = MD5(payload.content!).toString(); const messageBytes = Uint8Array.from(Buffer.from(hash.toString(), "hex")); const keyring = new Keyring({ type: payload.keypairType }); @@ -38,9 +37,8 @@ const verify = async (payload: Payload) => { const key = keyring.addFromAddress(payload.pubkey); const sig = Uint8Array.from(Buffer.from(payload.signature, "hex")); - // Verify the signature - const isValid = key.verify(messageBytes, sig, key.publicKey); - return { isValid }; + // Verify and return the signature + return key.verify(messageBytes, sig, key.publicKey); } catch (error) { console.error(error); // Handle any errors that occur during the verification process