diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-11-30 11:01:29 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-11-30 11:01:29 +0100 |
commit | c11450651f60b3d4f85ed897a646287b2f9b8db9 (patch) | |
tree | 986d40229b99709b75d3ebc77e7f5df6b324f397 /services | |
parent | b3586bb4b76e833d987eb207d1a17d7855439a60 (diff) | |
download | uxp-c11450651f60b3d4f85ed897a646287b2f9b8db9.tar.gz |
Remove get/setFxAMigrationSentinel
Diffstat (limited to 'services')
-rw-r--r-- | services/sync/modules/service.js | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 6369cbba21..15884aca00 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -1321,92 +1321,6 @@ Sync11Service.prototype = { }, /** - * Get a migration sentinel for the Firefox Accounts migration. - * Returns a JSON blob - it is up to callers of this to make sense of the - * data. - * - * Returns a promise that resolves with the sentinel, or null. - */ - getFxAMigrationSentinel: function() { - if (this._shouldLogin()) { - this._log.debug("In getFxAMigrationSentinel: should login."); - if (!this.login()) { - this._log.debug("Can't get migration sentinel: login returned false."); - return Promise.resolve(null); - } - } - if (!this.identity.syncKeyBundle) { - this._log.error("Can't get migration sentinel: no syncKeyBundle."); - return Promise.resolve(null); - } - try { - let collectionURL = this.storageURL + "meta/fxa_credentials"; - let cryptoWrapper = this.recordManager.get(collectionURL); - if (!cryptoWrapper || !cryptoWrapper.payload) { - // nothing to decrypt - .decrypt is noisy in that case, so just bail - // now. - return Promise.resolve(null); - } - // If the payload has a sentinel it means we must have put back the - // decrypted version last time we were called. - if (cryptoWrapper.payload.sentinel) { - return Promise.resolve(cryptoWrapper.payload.sentinel); - } - // If decryption fails it almost certainly means the key is wrong - but - // it's not clear if we need to take special action for that case? - let payload = cryptoWrapper.decrypt(this.identity.syncKeyBundle); - // After decrypting the ciphertext is lost, so we just stash the - // decrypted payload back into the wrapper. - cryptoWrapper.payload = payload; - return Promise.resolve(payload.sentinel); - } catch (ex) { - this._log.error("Failed to fetch the migration sentinel: ${}", ex); - return Promise.resolve(null); - } - }, - - /** - * Set a migration sentinel for the Firefox Accounts migration. - * Accepts a JSON blob - it is up to callers of this to make sense of the - * data. - * - * Returns a promise that resolves with a boolean which indicates if the - * sentinel was successfully written. - */ - setFxAMigrationSentinel: function(sentinel) { - if (this._shouldLogin()) { - this._log.debug("In setFxAMigrationSentinel: should login."); - if (!this.login()) { - this._log.debug("Can't set migration sentinel: login returned false."); - return Promise.resolve(false); - } - } - if (!this.identity.syncKeyBundle) { - this._log.error("Can't set migration sentinel: no syncKeyBundle."); - return Promise.resolve(false); - } - try { - let collectionURL = this.storageURL + "meta/fxa_credentials"; - let cryptoWrapper = new CryptoWrapper("meta", "fxa_credentials"); - cryptoWrapper.cleartext.sentinel = sentinel; - - cryptoWrapper.encrypt(this.identity.syncKeyBundle); - - let res = this.resource(collectionURL); - let response = res.put(cryptoWrapper.toJSON()); - - if (!response.success) { - throw response; - } - this.recordManager.set(collectionURL, cryptoWrapper); - } catch (ex) { - this._log.error("Failed to set the migration sentinel: ${}", ex); - return Promise.resolve(false); - } - return Promise.resolve(true); - }, - - /** * If we have a passphrase, rather than a 25-alphadigit sync key, * use the provided sync ID to bootstrap it using PBKDF2. * |