Skip to content

Commit

Permalink
Added verifyTypedData for EIP-712 typed data (#687).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Oct 20, 2020
1 parent 7b19fdf commit 550ecf2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/wallet/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,7 @@ export class Wallet extends Signer implements ExternallyOwnedAccount, TypedDataS
export function verifyMessage(message: Bytes | string, signature: SignatureLike): string {
return recoverAddress(hashMessage(message), signature);
}

export function verifyTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, signature: SignatureLike): string {
return recoverAddress(_TypedDataEncoder.hash(domain, types, value), signature);
}

0 comments on commit 550ecf2

Please # to comment.