diff options
author | Dan Finlay <flyswatter@users.noreply.github.com> | 2017-02-28 02:36:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 02:36:48 +0800 |
commit | 5edb3db96939de2dee31fa19cb8e715dc649bfd6 (patch) | |
tree | 1509d7fd69ac6dee6fd466286cf85524ac7887f2 /app/scripts/keyring-controller.js | |
parent | ca5cf06ae9e3e417dd3488bb0d94cdeec74ca18c (diff) | |
parent | ab01fef1c0ffddf09a20f90a910e5e068cf8c71e (diff) | |
download | tangerine-wallet-browser-5edb3db96939de2dee31fa19cb8e715dc649bfd6.tar tangerine-wallet-browser-5edb3db96939de2dee31fa19cb8e715dc649bfd6.tar.gz tangerine-wallet-browser-5edb3db96939de2dee31fa19cb8e715dc649bfd6.tar.bz2 tangerine-wallet-browser-5edb3db96939de2dee31fa19cb8e715dc649bfd6.tar.lz tangerine-wallet-browser-5edb3db96939de2dee31fa19cb8e715dc649bfd6.tar.xz tangerine-wallet-browser-5edb3db96939de2dee31fa19cb8e715dc649bfd6.tar.zst tangerine-wallet-browser-5edb3db96939de2dee31fa19cb8e715dc649bfd6.zip |
Merge branch 'master' into i1144-moarrpc
Diffstat (limited to 'app/scripts/keyring-controller.js')
-rw-r--r-- | app/scripts/keyring-controller.js | 23 |
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([ |