message: validates signature baised on paste or text
diff: @@ -82,13 +82,13 @@ export class VerifyMessage extends Component<Props, State> {
  private handleVerifySignedMessage = () => {
  try {
  - const parsedSignature: ISignedMessage = JSON.parse(this.state.signature);
  + const parsedSignature = this.checkIfSignatureIsValid(this.state.signature);
  - if (!verifySignedMessage(parsedSignature)) {
  + if (parsedSignature.isSignatureValid) {
  throw Error();
  }
  - const { address, msg } = parsedSignature;
  + const { address, msg } = parsedSignature.signature;
  this.setState({
  verifiedAddress: address,
  verifiedMessage: msg
  @@ -101,15 +101,34 @@ export class VerifyMessage extends Component<Props, State> {
  };
  private checkIfSignatureIsValid = (signature: string) => {
  + try {
  const parsedSignature: ISignedMessage = JSON.parse(signature);
  - return !verifySignedMessage(parsedSignature);
  + this.setState({
  + isButtonDisabled: !verifySignedMessage(parsedSignature)
  + });
  + return {
  + isSignatureValid: !verifySignedMessage(parsedSignature),
  + signature: parsedSignature
  + };
  + } catch (error) {
  + this.setState({
  + isButtonDisabled: true
  + });
  + return {
  + isSignatureValid: false,
  + signature: {
  + address: '',
  + msg: ''
  + }
  + };
  + }
  };
  private handleSignatureChange = (e: React.FormEvent<HTMLTextAreaElement>) => {
  const signature = e.currentTarget.value;
  this.setState({ signature });
  - // this.checkIfSignatureIsValid(signature);
  + this.checkIfSignatureIsValid(signature);
  };
  private handleSignaturePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {
  @@ -118,9 +137,7 @@ export class VerifyMessage extends Component<Props, State> {
  try {
  const signature = JSON.stringify(JSON.parse(text), null, 2);
  this.setState({ signature });
  - this.setState({
  - isButtonDisabled: this.checkIfSignatureIsValid(signature)
  - });
  + this.checkIfSignatureIsValid(signature);
  e.preventDefault();
  } catch (err) {
  // Do nothing, it wasn't json they pasted
  