Allow verification of new-style message wrapping (#6144)

This commit is contained in:
Jaco 2021-09-17 13:03:49 +03:00 committed by GitHub
parent 7a62234d34
commit 950a476f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import type { KeypairType } from '@polkadot/util-crypto/types';
import React, { useCallback, useEffect, useState } from 'react';
import styled from 'styled-components';
import { wrapBytes } from '@polkadot/extension-dapp';
import { Badge, Dropdown, Input, InputAddress, Static } from '@polkadot/react-components';
import { useApi } from '@polkadot/react-hooks';
import { keyring } from '@polkadot/ui-keyring';
@ -36,7 +37,11 @@ function Verify ({ className = '' }: Props): React.ReactElement {
// We use signatureVerify to detect validity and crypto type
if (isValid && publicKey) {
const verification = signatureVerify(data, signature, publicKey);
let verification = signatureVerify(data, signature, publicKey);
if (verification.crypto === 'none') {
verification = signatureVerify(wrapBytes(data), signature, publicKey);
}
if (verification.crypto !== 'none') {
isValid = verification.isValid;