Skip to content

Commit

Permalink
WIP: Removed the extra line for encoding base24. (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud-Emad authored Sep 24, 2023
1 parent bf50ef8 commit 10b3dca
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/UI/examples/server-example/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Check warning on line 30 in packages/UI/examples/server-example/src/server.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

Forbidden non-null assertion

const messageBytes = Uint8Array.from(Buffer.from(hash.toString(), "hex"));
const keyring = new Keyring({ type: payload.keypairType });
Expand All @@ -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
Expand Down

0 comments on commit 10b3dca

Please sign in to comment.