Bug 1513781 - Use cached keys in FxA commands registration. r=vladikoff,rfkelly

Differential Revision: https://phabricator.services.mozilla.com/D14782

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Edouard Oger 2018-12-17 21:44:42 +00:00
parent dc7c5aedef
commit 37b79a2c14

View File

@ -272,7 +272,11 @@ class SendTab {
publicKey: sendTabKeys.publicKey,
authSecret: sendTabKeys.authSecret,
};
const {kSync, kXCS} = await this._fxAccounts.getKeys();
// getEncryptedKey() can be called right after a sign-in/up to FxA:
// We get -cached- keys using getSignedInUser() instead of getKeys()
// because we will await on getKeys() which is already awaiting on
// the promise we return.
const {kSync, kXCS} = await this._fxAccounts.getSignedInUser();
if (!kSync || !kXCS) {
return null;
}