Skip to content

Commit

Permalink
Merge pull request #565 from GridPlus/nb/eip155
Browse files Browse the repository at this point in the history
revert eip712 `v` change
  • Loading branch information
netbonus committed Aug 5, 2024
2 parents 647c138 + daaf000 commit 7dca29f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const validateEthereumMsgResponse = function (res, req) {
const digest = prehash ? prehash : encoded;
const chainId = parseInt(input.payload.domain.chainId, 16);
// Get recovery param with a `v` value of [27,28] by setting `useEIP155=false`
return addRecoveryParam(digest, sig, signer, { chainId });
return addRecoveryParam(digest, sig, signer, { chainId, useEIP155: false });
} else {
throw new Error('Unsupported protocol');
}
Expand Down Expand Up @@ -495,7 +495,7 @@ function getRecoveryParam(v, txData: any = {}) {
// transaction payload.
if (type === 1 || type === 2) {
return ensureHexBuffer(v, true); // 0 or 1, with 0 expected as an empty buffer
} else if (false === useEIP155 || chainId === null) {
} else if (!useEIP155 || !chainId) {
// For ETH messages and non-EIP155 chains the set should be [27, 28] for `v`
return Buffer.from(new BN(v).plus(27).toString(16), 'hex');
}
Expand Down

0 comments on commit 7dca29f

Please sign in to comment.