From b229e2e6af792330d00ee56b3be2091cb949bc06 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Wed, 20 Mar 2024 20:10:43 -0500 Subject: [PATCH] Disable signature verification on API read --- client/src/utils/Post.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/client/src/utils/Post.js b/client/src/utils/Post.js index f11de88..c79bc0e 100644 --- a/client/src/utils/Post.js +++ b/client/src/utils/Post.js @@ -1,12 +1,11 @@ import axios from 'axios'; // trailing slash is deliberate, to differentiate this package from the core node module import { Buffer } from 'buffer/'; -import { recoverPersonalSignature } from '@metamask/eth-sig-util'; -// import createHash from 'create-hash'; +// import { recoverPersonalSignature } from '@metamask/eth-sig-util'; import objectHash from 'object-hash'; // Make Buffer available to recoverPersonalSignature -window.Buffer = Buffer; +// window.Buffer = Buffer; class Post { constructor({ @@ -26,16 +25,18 @@ class Post { if (hash !== derivedHash) { throw new Error('Hash mismatch'); } - // Verify signature - let recovered; - try { - recovered = recoverPersonalSignature({ data: content, signature }); - } catch (e) { - throw new Error('Signature error', e); - } - if (recovered !== author) { - throw new Error('Author mismatch'); - } + // TODO: Verify signature + // Disabling this because @metamask/eth-sig-util is a nodejs module + // and we need to figure out how to bundle it. + // let recovered; + // try { + // recovered = recoverPersonalSignature({ data: content, signature }); + // } catch (e) { + // throw new Error('Signature error', e); + // } + // if (recovered !== author) { + // throw new Error('Author mismatch'); + // } return new Post({ content, author, signature, hash, });