diff options
Merge branch 'master' into display_network
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/idStore.js | 11 | ||||
-rw-r--r-- | app/scripts/lib/notifications.js | 43 |
2 files changed, 38 insertions, 16 deletions
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 85e8c8301..33d842d54 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -59,6 +59,13 @@ IdentityStore.prototype.createNewVault = function(password, entropy, cb){ }) } +IdentityStore.prototype.recoverSeed = function(cb){ + configManager.setShowSeedWords(true) + if (!this._idmgmt) return cb(new Error('Unauthenticated. Please sign in.')) + var seedWords = this._idmgmt.getSeed() + cb(null, seedWords) +} + IdentityStore.prototype.recoverFromSeed = function(password, seed, cb){ this._createIdmgmt(password, seed, null, (err) => { if (err) return cb(err) @@ -156,7 +163,7 @@ IdentityStore.prototype.setLocked = function(cb){ } IdentityStore.prototype.submitPassword = function(password, cb){ - this._tryPassword(password, (err) => { + this.tryPassword(password, (err) => { if (err) return cb(err) // load identities before returning... this._loadIdentities() @@ -372,7 +379,7 @@ IdentityStore.prototype._mayBeFauceting = function(i) { // keyStore managment - unlocking + deserialization // -IdentityStore.prototype._tryPassword = function(password, cb){ +IdentityStore.prototype.tryPassword = function(password, cb){ this._createIdmgmt(password, null, null, cb) } diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js index d011d778b..90edaea12 100644 --- a/app/scripts/lib/notifications.js +++ b/app/scripts/lib/notifications.js @@ -8,24 +8,35 @@ module.exports = { createMsgNotification: createMsgNotification, } -// notification button press -chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex){ - var handlers = notificationHandlers[notificationId] - if (buttonIndex === 0) { - handlers.confirm() - } else { - handlers.cancel() - } - chrome.notifications.clear(notificationId) -}) +setupListeners() + +function setupListeners(){ + + // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 + if (!chrome.notifications) return console.error('Chrome notifications API missing...') + + // notification button press + chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex){ + var handlers = notificationHandlers[notificationId] + if (buttonIndex === 0) { + handlers.confirm() + } else { + handlers.cancel() + } + chrome.notifications.clear(notificationId) + }) + + // notification teardown + chrome.notifications.onClosed.addListener(function(notificationId){ + delete notificationHandlers[notificationId] + }) -// notification teardown -chrome.notifications.onClosed.addListener(function(notificationId){ - delete notificationHandlers[notificationId] -}) +} // creation helper function createUnlockRequestNotification(opts){ + // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 + if (!chrome.notifications) return console.error('Chrome notifications API missing...') var message = 'An Ethereum app has requested a signature. Please unlock your account.' var id = createId() @@ -39,6 +50,8 @@ function createUnlockRequestNotification(opts){ } function createTxNotification(opts){ + // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 + if (!chrome.notifications) return console.error('Chrome notifications API missing...') var message = [ 'Submitted by '+opts.txParams.origin, 'to: '+uiUtils.addressSummary(opts.txParams.to), @@ -67,6 +80,8 @@ function createTxNotification(opts){ } function createMsgNotification(opts){ + // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 + if (!chrome.notifications) return console.error('Chrome notifications API missing...') var message = [ 'Submitted by '+opts.msgParams.origin, 'to be signed by: '+uiUtils.addressSummary(opts.msgParams.from), |