ethereumjs-util#hashPersonalMessage TypeScript Examples
The following examples show how to use
ethereumjs-util#hashPersonalMessage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: provider.ts From cloud-cryptographic-wallet with MIT License | 6 votes |
public async signMessage(msgParams: MsgParams): Promise<string> {
const from = msgParams.from;
const signer = this.resolveSigner(from);
if (!signer) {
throw new Error(`Account not found: ${from}`);
}
const data = toBuffer(msgParams.data);
const digest = hashPersonalMessage(data);
const signature = await signer.sign(digest);
return `0x${signature.toString()}`;
}