1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-10-01 04:27:40 +02: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

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

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;