19 lines
752 B
JavaScript
19 lines
752 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.hashMessage = exports.messagePrefix = void 0;
|
|
var bytes_1 = require("@ethersproject/bytes");
|
|
var keccak256_1 = require("@ethersproject/keccak256");
|
|
var strings_1 = require("@ethersproject/strings");
|
|
exports.messagePrefix = "\x19Ethereum Signed Message:\n";
|
|
function hashMessage(message) {
|
|
if (typeof (message) === "string") {
|
|
message = (0, strings_1.toUtf8Bytes)(message);
|
|
}
|
|
return (0, keccak256_1.keccak256)((0, bytes_1.concat)([
|
|
(0, strings_1.toUtf8Bytes)(exports.messagePrefix),
|
|
(0, strings_1.toUtf8Bytes)(String(message.length)),
|
|
message
|
|
]));
|
|
}
|
|
exports.hashMessage = hashMessage;
|
|
//# sourceMappingURL=message.js.map
|