Skip to content

tokoinofficial/node-sign-verify-message

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-sign-verify-message

This repos shows the way to sign/verify an ethereum message. It's used for backend of third party where interacts with Tokoin Payment System.

Tokoin Payment System

How to use

  • Sign message
const Sign = async (pk: string, types: Array<string>, values: Array<any>) => {
    const wallet = new ethers.Wallet(pk);
    var hash = abi.soliditySHA3(
        types,
        values,
    );
    return await wallet.signMessage(hash);
};
  • Verify message
const Verify = async (wallet: string, types: Array<string>, values: Array<any>, signature: any) => {
    var hash = abi.soliditySHA3(
        types,
        values,
    );
    return ethers.verifyMessage(hash, signature) == wallet;
};

How to run sample

  • yarn install
  • yarn start

Demo

Created & Maintained By

Trong Dinh

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published