aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
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 /app/scripts
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
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/lib/typed-message-manager.js4
1 files changed, 4 insertions, 0 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) {