Skip to content

Commit

Permalink
Fixes bug introduced in previous version (v param for EIP712)
Browse files Browse the repository at this point in the history
We still need to return the [0, 1] set for `v` with EIP712 signatures
and the previous version broke this.
  • Loading branch information
alex-miller-0 committed Aug 17, 2021
1 parent ce49b43 commit d455522
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gridplus-sdk",
"version": "0.8.1",
"version": "0.8.2",
"description": "SDK to interact with GridPlus Lattice1 device",
"scripts": {
"commit": "git-cz",
Expand Down
4 changes: 3 additions & 1 deletion src/ethereum.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports.validateEthereumMsgResponse = function(res, req) {
return addRecoveryParam(hash, sig, signer, { chainId: 1, useEIP155: false })
} else if (input.protocol === 'eip712') {
const digest = prehash ? prehash : eip712.TypedDataUtils.encodeDigest(req.input.payload);
return addRecoveryParam(digest, sig, signer)
return addRecoveryParam(digest, sig, signer, { type: 'EIP712_MSG' })
} else {
throw new Error('Unsupported protocol');
}
Expand Down Expand Up @@ -406,6 +406,8 @@ function getRecoveryParam(v, txData={}) {
// transaction payload.
if (type === 1 || type === 2) {
return ensureHexBuffer(v, true); // 0 or 1, with 0 expected as an empty buffer
} else if (type === 'EIP712_MSG') {
return ensureHexBuffer(v, false); // 0 or 1, with 0 expected as a number
}

// If we are not using EIP155, convert v directly to a buffer and return it
Expand Down

0 comments on commit d455522

Please sign in to comment.