UNPKG

1.21 kBTypeScriptView Raw
1import type { SignatureLike } from "../crypto/index.js";
2/**
3 * Computes the [[link-eip-191]] personal-sign message digest to sign.
4 *
5 * This prefixes the message with [[MessagePrefix]] and the decimal length
6 * of %%message%% and computes the [[keccak256]] digest.
7 *
8 * If %%message%% is a string, it is converted to its UTF-8 bytes
9 * first. To compute the digest of a [[DataHexString]], it must be converted
10 * to [bytes](getBytes).
11 *
12 * @example:
13 * hashMessage("Hello World")
14 * //_result:
15 *
16 * // Hashes the SIX (6) string characters, i.e.
17 * // [ "0", "x", "4", "2", "4", "3" ]
18 * hashMessage("0x4243")
19 * //_result:
20 *
21 * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]...
22 * hashMessage(getBytes("0x4243"))
23 * //_result:
24 *
25 * // ...which is equal to using data
26 * hashMessage(new Uint8Array([ 0x42, 0x43 ]))
27 * //_result:
28 *
29 */
30export declare function hashMessage(message: Uint8Array | string): string;
31/**
32 * Return the address of the private key that produced
33 * the signature %%sig%% during signing for %%message%%.
34 */
35export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike): string;
36//# sourceMappingURL=message.d.ts.map
\No newline at end of file