Current Folder
This commit is contained in:
1 parent
8b3382289b
commit
cfcada880d
4379 files changed
No files matched your search
+15
@@ -0,0 +1,15 @@
|
||||
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
|
||||
Reference in new issue
Block a user