From 77c3daed0edea89caa380a44196e7a863ef4ef65 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 18 Oct 2017 16:10:28 -0400 Subject: [PATCH] remove deprecated code --- src/models/dataModels.js | 37 +---------- src/models/domainModels.js | 131 ------------------------------------- 2 files changed, 2 insertions(+), 166 deletions(-) diff --git a/src/models/dataModels.js b/src/models/dataModels.js index 6dd914f178..6c86b0944d 100644 --- a/src/models/dataModels.js +++ b/src/models/dataModels.js @@ -15,39 +15,6 @@ var FolderData = function (response, userId) { this.revisionDate = response.revisionDate; }; -// deprecated -var LoginData = function (response, userId) { - this.id = response.id; - this.organizationId = response.organizationId; - this.folderId = response.folderId; - this.userId = userId; - this.edit = response.edit; - this.organizationUseTotp = response.organizationUseTotp; - this.name = response.data.Name; - this.uri = response.data.Uri; - this.username = response.data.Username; - this.password = response.data.Password; - this.notes = response.notes = response.data.Notes; - this.totp = response.notes = response.data.Totp; - this.favorite = response.favorite; - this.revisionDate = response.revisionDate; - - var i; - if (response.data.Fields) { - this.fields = []; - for (i = 0; i < response.data.Fields.length; i++) { - this.fields.push(new FieldData(response.data.Fields[i])); - } - } - - if (response.attachments) { - this.attachments = []; - for (i = 0; i < response.attachments.length; i++) { - this.attachments.push(new AttachmentData(response.attachments[i])); - } - } -}; - var CipherData = function (response, userId) { this.id = response.id; this.organizationId = response.organizationId; @@ -65,7 +32,7 @@ var CipherData = function (response, userId) { var constantsService = chrome.extension.getBackgroundPage().bg_constantsService; switch (this.type) { case constantsService.cipherType.login: - this.login = new LoginData2(response.data); + this.login = new LoginData(response.data); break; case constantsService.cipherType.secureNote: this.secureNote = new SecureNoteData(response.data); @@ -110,7 +77,7 @@ var FieldData = function (response) { this.value = response.Value; }; -var LoginData2 = function (data) { +var LoginData = function (data) { this.uri = data.Uri; this.username = data.Username; this.password = data.Password; diff --git a/src/models/domainModels.js b/src/models/domainModels.js index 52d4f36126..252b326347 100644 --- a/src/models/domainModels.js +++ b/src/models/domainModels.js @@ -89,55 +89,6 @@ var CipherString = function () { } }; -// deprecated -var Login = function (obj, alreadyEncrypted, localData) { - this.id = obj.id ? obj.id : null; - this.organizationId = obj.organizationId ? obj.organizationId : null; - this.folderId = obj.folderId ? obj.folderId : null; - this.favorite = obj.favorite ? true : false; - this.organizationUseTotp = obj.organizationUseTotp ? true : false; - this.edit = obj.edit ? true : false; - this.localData = localData; - - if (alreadyEncrypted === true) { - this.name = obj.name ? obj.name : null; - this.uri = obj.uri ? obj.uri : null; - this.username = obj.username ? obj.username : null; - this.password = obj.password ? obj.password : null; - this.notes = obj.notes ? obj.notes : null; - this.totp = obj.totp ? obj.totp : null; - } - else { - this.name = obj.name ? new CipherString(obj.name) : null; - this.uri = obj.uri ? new CipherString(obj.uri) : null; - this.username = obj.username ? new CipherString(obj.username) : null; - this.password = obj.password ? new CipherString(obj.password) : null; - this.notes = obj.notes ? new CipherString(obj.notes) : null; - this.totp = obj.totp ? new CipherString(obj.totp) : null; - } - - var i; - if (obj.attachments) { - this.attachments = []; - for (i = 0; i < obj.attachments.length; i++) { - this.attachments.push(new Attachment(obj.attachments[i], alreadyEncrypted)); - } - } - else { - this.attachments = null; - } - - if (obj.fields) { - this.fields = []; - for (i = 0; i < obj.fields.length; i++) { - this.fields.push(new Field(obj.fields[i], alreadyEncrypted)); - } - } - else { - this.fields = null; - } -}; - var Cipher = function (obj, alreadyEncrypted, localData) { this.constantsService = chrome.extension.getBackgroundPage().bg_constantsService; this.utilsService = chrome.extension.getBackgroundPage().bg_utilsService; @@ -300,88 +251,6 @@ function buildDomainModel(model, obj, map, alreadyEncrypted, notEncList) { }); }; - // deprecated - Login.prototype.decrypt = function () { - var self = this; - var model = { - id: self.id, - organizationId: self.organizationId, - folderId: self.folderId, - favorite: self.favorite, - localData: self.localData - }; - - var attachments = []; - var fields = []; - - return self.name.decrypt(self.organizationId).then(function (val) { - model.name = val; - if (self.uri) { - return self.uri.decrypt(self.organizationId); - } - return null; - }).then(function (val) { - model.uri = val; - - var utilsService = chrome.extension.getBackgroundPage().bg_utilsService; - model.domain = utilsService.getDomain(val); - - if (self.username) { - return self.username.decrypt(self.organizationId); - } - return null; - }).then(function (val) { - model.username = val; - if (self.password) { - return self.password.decrypt(self.organizationId); - } - return null; - }).then(function (val) { - model.password = val; - if (self.notes) { - return self.notes.decrypt(self.organizationId); - } - return null; - }).then(function (val) { - model.notes = val; - if (self.totp) { - return self.totp.decrypt(self.organizationId); - } - return null; - }).then(function (val) { - model.totp = val; - - if (self.attachments) { - return self.attachments.reduce(function (promise, attachment) { - return promise.then(function () { - return attachment.decrypt(self.organizationId); - }).then(function (decAttachment) { - attachments.push(decAttachment); - }); - }, Q()); - } - return; - }).then(function () { - model.attachments = attachments.length ? attachments : null; - - if (self.fields) { - return self.fields.reduce(function (promise, field) { - return promise.then(function () { - return field.decrypt(self.organizationId); - }).then(function (decField) { - fields.push(decField); - }); - }, Q()); - } - return; - }).then(function () { - model.fields = fields.length ? fields : null; - return model; - }, function (e) { - console.log(e); - }); - }; - Cipher.prototype.decrypt = function () { var self = this;