summaryrefslogtreecommitdiffstats
path: root/services/sync
diff options
context:
space:
mode:
Diffstat (limited to 'services/sync')
-rw-r--r--services/sync/modules/service.js86
1 files changed, 0 insertions, 86 deletions
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
@@ -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.
*