mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
eth-sig-util@3.0.0 (#9831)
* eth-sig-util@3.0.0 * Only import used sig-util exports in the typed message manager
This commit is contained in:
commit
e005a03e75
@ -2,7 +2,7 @@ import EventEmitter from 'events'
|
|||||||
import assert from 'assert'
|
import assert from 'assert'
|
||||||
import ObservableStore from 'obs-store'
|
import ObservableStore from 'obs-store'
|
||||||
import { ethErrors } from 'eth-json-rpc-errors'
|
import { ethErrors } from 'eth-json-rpc-errors'
|
||||||
import sigUtil from 'eth-sig-util'
|
import { typedSignatureHash, TYPED_MESSAGE_SCHEMA } from 'eth-sig-util'
|
||||||
import { isValidAddress } from 'ethereumjs-util'
|
import { isValidAddress } from 'ethereumjs-util'
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
import jsonschema from 'jsonschema'
|
import jsonschema from 'jsonschema'
|
||||||
@ -164,7 +164,7 @@ export default class TypedMessageManager extends EventEmitter {
|
|||||||
case 'V1':
|
case 'V1':
|
||||||
assert.ok(Array.isArray(params.data), '"params.data" must be an array.')
|
assert.ok(Array.isArray(params.data), '"params.data" must be an array.')
|
||||||
assert.doesNotThrow(() => {
|
assert.doesNotThrow(() => {
|
||||||
sigUtil.typedSignatureHash(params.data)
|
typedSignatureHash(params.data)
|
||||||
}, 'Signing data must be valid EIP-712 typed data.')
|
}, 'Signing data must be valid EIP-712 typed data.')
|
||||||
break
|
break
|
||||||
case 'V3':
|
case 'V3':
|
||||||
@ -178,10 +178,7 @@ export default class TypedMessageManager extends EventEmitter {
|
|||||||
assert.doesNotThrow(() => {
|
assert.doesNotThrow(() => {
|
||||||
data = JSON.parse(params.data)
|
data = JSON.parse(params.data)
|
||||||
}, '"data" must be a valid JSON string.')
|
}, '"data" must be a valid JSON string.')
|
||||||
const validation = jsonschema.validate(
|
const validation = jsonschema.validate(data, TYPED_MESSAGE_SCHEMA)
|
||||||
data,
|
|
||||||
sigUtil.TYPED_MESSAGE_SCHEMA,
|
|
||||||
)
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
data.primaryType in data.types,
|
data.primaryType in data.types,
|
||||||
`Primary type of "${data.primaryType}" has no type definition.`,
|
`Primary type of "${data.primaryType}" has no type definition.`,
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
"eth-method-registry": "^1.2.0",
|
"eth-method-registry": "^1.2.0",
|
||||||
"eth-phishing-detect": "^1.1.14",
|
"eth-phishing-detect": "^1.1.14",
|
||||||
"eth-query": "^2.1.2",
|
"eth-query": "^2.1.2",
|
||||||
"eth-sig-util": "^2.3.0",
|
"eth-sig-util": "^3.0.0",
|
||||||
"eth-trezor-keyring": "^0.4.0",
|
"eth-trezor-keyring": "^0.4.0",
|
||||||
"ethereum-ens-network-map": "^1.0.2",
|
"ethereum-ens-network-map": "^1.0.2",
|
||||||
"ethereumjs-abi": "^0.6.4",
|
"ethereumjs-abi": "^0.6.4",
|
||||||
|
12
yarn.lock
12
yarn.lock
@ -10757,6 +10757,18 @@ eth-sig-util@^2.3.0, eth-sig-util@^2.4.4, eth-sig-util@^2.5.0:
|
|||||||
tweetnacl "^1.0.0"
|
tweetnacl "^1.0.0"
|
||||||
tweetnacl-util "^0.15.0"
|
tweetnacl-util "^0.15.0"
|
||||||
|
|
||||||
|
eth-sig-util@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-3.0.0.tgz#75133b3d7c20a5731af0690c385e184ab942b97e"
|
||||||
|
integrity sha512-4eFkMOhpGbTxBQ3AMzVf0haUX2uTur7DpWiHzWyTURa28BVJJtOkcb9Ok5TV0YvEPG61DODPW7ZUATbJTslioQ==
|
||||||
|
dependencies:
|
||||||
|
buffer "^5.2.1"
|
||||||
|
elliptic "^6.4.0"
|
||||||
|
ethereumjs-abi "0.6.5"
|
||||||
|
ethereumjs-util "^5.1.1"
|
||||||
|
tweetnacl "^1.0.0"
|
||||||
|
tweetnacl-util "^0.15.0"
|
||||||
|
|
||||||
eth-simple-keyring@^3.5.0:
|
eth-simple-keyring@^3.5.0:
|
||||||
version "3.5.0"
|
version "3.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/eth-simple-keyring/-/eth-simple-keyring-3.5.0.tgz#c7fa285ca58d31ef44bc7db678b689f9ffd7b453"
|
resolved "https://registry.yarnpkg.com/eth-simple-keyring/-/eth-simple-keyring-3.5.0.tgz#c7fa285ca58d31ef44bc7db678b689f9ffd7b453"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user