mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
Convert SIWE message to utf8array before hashing
Signed-off-by: Sebastian Martinez <sebastinez@me.com>
This commit is contained in:
@@ -51,13 +51,16 @@ export class WalletConnectSigner extends ethers.Signer {
|
||||
const prefix = ethers.utils.toUtf8Bytes(
|
||||
`\x19Ethereum Signed Message:\n${message.length}`
|
||||
);
|
||||
const msg = ethers.utils.concat([prefix, message]);
|
||||
const data = ((typeof(message) === "string") ? ethers.utils.toUtf8Bytes(message): message);
|
||||
|
||||
const msg = ethers.utils.concat([prefix, data]);
|
||||
const address = await this.getAddress();
|
||||
const keccakMessage = ethers.utils.keccak256(msg);
|
||||
const signature = await this.walletConnect.signMessage([
|
||||
address.toLowerCase(),
|
||||
keccakMessage,
|
||||
]);
|
||||
|
||||
return signature;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user