diff --git a/client/src/utils/Post.js b/client/src/utils/Post.js index bb22de4..d15b780 100644 --- a/client/src/utils/Post.js +++ b/client/src/utils/Post.js @@ -5,7 +5,7 @@ import { recoverPersonalSignature } from '@metamask/eth-sig-util'; import objectHash from 'object-hash/dist/object_hash'; // Make Buffer available to recoverPersonalSignature -// window.Buffer = Buffer; +window.Buffer = Buffer; class Post { constructor({ @@ -26,12 +26,8 @@ class Post { throw new Error('Hash mismatch'); } // Verify signature - let recovered; - try { - recovered = recoverPersonalSignature({ data: content, signature }); - } catch (e) { - throw new Error('Signature error', e); - } + const recovered = recoverPersonalSignature({ data: content, signature }); + if (recovered !== author) { throw new Error('Author mismatch'); }