1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

remove deprecated code

This commit is contained in:
Kyle Spearrin
2017-10-18 16:10:28 -04:00
parent 23d1f076f4
commit 77c3daed0e
2 changed files with 2 additions and 166 deletions

View File

@@ -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;