From c11450651f60b3d4f85ed897a646287b2f9b8db9 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 30 Nov 2018 11:01:29 +0100 Subject: Remove get/setFxAMigrationSentinel --- services/sync/modules/service.js | 86 ---------------------------------------- 1 file changed, 86 deletions(-) (limited to 'services') diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 6369cbba2..15884aca0 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -1320,92 +1320,6 @@ Sync11Service.prototype = { this.recordManager.set(this.metaURL, meta); }, - /** - * 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. -- cgit v1.2.3