aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/keyring-controller.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-02-28 04:59:19 +0800
committerDan Finlay <dan@danfinlay.com>2017-02-28 04:59:19 +0800
commit462c7ae21316cbb3a242f53a0b726194a0faa64e (patch)
treef8c72294bed4d53221162e24fde92069ff17382b /app/scripts/keyring-controller.js
parentdfc89d6c6dd622e7dff79544c0885594000ffd37 (diff)
parentab01fef1c0ffddf09a20f90a910e5e068cf8c71e (diff)
downloadtangerine-wallet-browser-462c7ae21316cbb3a242f53a0b726194a0faa64e.tar
tangerine-wallet-browser-462c7ae21316cbb3a242f53a0b726194a0faa64e.tar.gz
tangerine-wallet-browser-462c7ae21316cbb3a242f53a0b726194a0faa64e.tar.bz2
tangerine-wallet-browser-462c7ae21316cbb3a242f53a0b726194a0faa64e.tar.lz
tangerine-wallet-browser-462c7ae21316cbb3a242f53a0b726194a0faa64e.tar.xz
tangerine-wallet-browser-462c7ae21316cbb3a242f53a0b726194a0faa64e.tar.zst
tangerine-wallet-browser-462c7ae21316cbb3a242f53a0b726194a0faa64e.zip
Merge branch 'master' into i765-gaslimits
Diffstat (limited to 'app/scripts/keyring-controller.js')
-rw-r--r--app/scripts/keyring-controller.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index b30161003..e1b1c4335 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -5,10 +5,11 @@ const EventEmitter = require('events').EventEmitter
const ObservableStore = require('obs-store')
const filter = require('promise-filter')
const encryptor = require('browser-passworder')
-const normalizeAddress = require('./lib/sig-util').normalize
+const sigUtil = require('eth-sig-util')
+const normalizeAddress = sigUtil.normalize
// Keyrings:
-const SimpleKeyring = require('./keyrings/simple')
-const HdKeyring = require('./keyrings/hd')
+const SimpleKeyring = require('eth-simple-keyring')
+const HdKeyring = require('eth-hd-keyring')
const keyringTypes = [
SimpleKeyring,
HdKeyring,
@@ -262,6 +263,21 @@ class KeyringController extends EventEmitter {
})
}
+ // Sign Personal Message
+ // @object msgParams
+ //
+ // returns Promise(@buffer rawSig)
+ //
+ // Attempts to sign the provided @object msgParams.
+ // Prefixes the hash before signing as per the new geth behavior.
+ signPersonalMessage (msgParams) {
+ const address = normalizeAddress(msgParams.from)
+ return this.getKeyringForAccount(address)
+ .then((keyring) => {
+ return keyring.signPersonalMessage(address, msgParams.data)
+ })
+ }
+
// PRIVATE METHODS
//
// THESE METHODS ARE ONLY USED INTERNALLY TO THE KEYRING-CONTROLLER
@@ -471,6 +487,7 @@ class KeyringController extends EventEmitter {
// the specified `address` if one exists.
getKeyringForAccount (address) {
const hexed = normalizeAddress(address)
+ log.debug(`KeyringController - getKeyringForAccount: ${hexed}`)
return Promise.all(this.keyrings.map((keyring) => {
return Promise.all([