Skip to content

Commit

Permalink
fixes the signing message
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1995 committed Sep 2, 2024
1 parent 7d91b40 commit d60ffbb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { addHexPrefix, privateToAddress } from "@ethereumjs/util";
import { signMessage } from "@toruslabs/base-controllers";
import { JRPCRequest, providerErrors } from "@web3auth/auth";
import { log, SafeEventEmitterProvider } from "@web3auth/base";
import { SigningKey, TypedDataEncoder } from "ethers";
import { hashMessage, SigningKey, TypedDataEncoder } from "ethers";

import { IProviderHandlers, MessageParams, SignTypedDataMessageV4, TransactionParams, TypedMessageParams } from "../../rpc/interfaces";
import { TransactionFormatter } from "./TransactionFormatter/formatter";
Expand Down Expand Up @@ -74,7 +74,7 @@ export function getProviderHandlers({
processPersonalMessage: async (msgParams: MessageParams<string>, _: JRPCRequest<unknown>): Promise<string> => {
const privKeyBuffer = Buffer.from(privKey, "hex");
const ethersKey = new SigningKey(privKeyBuffer);
const signature = ethersKey.sign(Buffer.from(msgParams.data));
const signature = ethersKey.sign(hashMessage(msgParams.data));
return signature.serialized;
},
processTypedMessageV4: async (msgParams: TypedMessageParams, _: JRPCRequest<unknown>): Promise<string> => {
Expand Down

0 comments on commit d60ffbb

Please sign in to comment.