mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Validate data format for eth_signTypedData
This commit is contained in:
parent
0c61695656
commit
a1696f89a8
@ -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) {
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user