aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Ukustov <sergey@ukstv.me>2017-10-07 05:38:13 +0800
committerSergey Ukustov <sergey@ukstv.me>2017-10-07 05:38:13 +0800
commita1696f89a8764f17c10298a45160abf8fc7dce5e (patch)
tree074b937ed131b0dd15d7c7589d1e6ad5319001ca
parent0c61695656054d5da43a8bfb10d7a15cb2958d81 (diff)
downloadtangerine-wallet-browser-a1696f89a8764f17c10298a45160abf8fc7dce5e.tar
tangerine-wallet-browser-a1696f89a8764f17c10298a45160abf8fc7dce5e.tar.gz
tangerine-wallet-browser-a1696f89a8764f17c10298a45160abf8fc7dce5e.tar.bz2
tangerine-wallet-browser-a1696f89a8764f17c10298a45160abf8fc7dce5e.tar.lz
tangerine-wallet-browser-a1696f89a8764f17c10298a45160abf8fc7dce5e.tar.xz
tangerine-wallet-browser-a1696f89a8764f17c10298a45160abf8fc7dce5e.tar.zst
tangerine-wallet-browser-a1696f89a8764f17c10298a45160abf8fc7dce5e.zip
Validate data format for eth_signTypedData
-rw-r--r--app/scripts/lib/typed-message-manager.js4
-rw-r--r--package.json2
2 files changed, 5 insertions, 1 deletions
diff --git a/app/scripts/lib/typed-message-manager.js b/app/scripts/lib/typed-message-manager.js
index e041ae9f3..8b760790e 100644
--- a/app/scripts/lib/typed-message-manager.js
+++ b/app/scripts/lib/typed-message-manager.js
@@ -2,6 +2,7 @@ const EventEmitter = require('events')
const ObservableStore = require('obs-store')
const createId = require('./random-id')
const assert = require('assert')
+const sigUtil = require('eth-sig-util')
module.exports = class TypedMessageManager extends EventEmitter {
@@ -50,6 +51,9 @@ module.exports = class TypedMessageManager extends EventEmitter {
assert.ok('from' in params, 'Params must include a from field.')
assert.ok(Array.isArray(params.data), 'Data should be an array.')
assert.equal(typeof params.from, 'string', 'From field must be a string.')
+ assert.doesNotThrow(() => {
+ sigUtil.typedSignatureHash(params.data)
+ }, 'Expected EIP712 typed data')
}
addMsg (msg) {
diff --git a/package.json b/package.json
index c846bae41..225742487 100644
--- a/package.json
+++ b/package.json
@@ -74,7 +74,7 @@
"eth-keyring-controller": "^2.1.0",
"eth-phishing-detect": "^1.1.4",
"eth-query": "^2.1.2",
- "eth-sig-util": "^1.2.2",
+ "eth-sig-util": "^1.4.0",
"eth-simple-keyring": "^1.1.1",
"eth-token-tracker": "^1.1.4",
"ethereumjs-tx": "^1.3.0",