You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
517 B
15 lines
517 B
import { concat } from "@ethersproject/bytes";
|
|
import { keccak256 } from "@ethersproject/keccak256";
|
|
import { toUtf8Bytes } from "@ethersproject/strings";
|
|
export const messagePrefix = "\x19Ethereum Signed Message:\n";
|
|
export function hashMessage(message) {
|
|
if (typeof (message) === "string") {
|
|
message = toUtf8Bytes(message);
|
|
}
|
|
return keccak256(concat([
|
|
toUtf8Bytes(messagePrefix),
|
|
toUtf8Bytes(String(message.length)),
|
|
message
|
|
]));
|
|
}
|
|
//# sourceMappingURL=message.js.map
|