Skip to content

Commit

Permalink
fix: supporting 1271 signatures not being 65 bytes long or not follow…
Browse files Browse the repository at this point in the history
…ing rsv pattern (#581)

modified:   src/sign/utils.ts
  • Loading branch information
0xdex18 authored May 26, 2022
1 parent 089a6b1 commit 99d3acf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/sign/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ export function getHash(data) {

export async function verify(address, sig, data) {
const { domain, types, message } = data;
const recoverAddress = verifyTypedData(domain, types, message, sig);

const hash = getHash(data);
console.log('Hash', hash);
console.log('Address', address);
console.log('Recover address', recoverAddress);
if (address === recoverAddress) return true;

try {
const recoverAddress = verifyTypedData(domain, types, message, sig);
console.log('Recover address', recoverAddress);
if (address === recoverAddress) return true;
} catch (e) {
console.log('Could not recoverAddress:' + e.message);
}

console.log('Check EIP1271 signature');
return await verifyEIP1271(address, sig, hash);
}

0 comments on commit 99d3acf

Please sign in to comment.