mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
Remove support for alreadyEncrypted (#762)
This commit is contained in:
parent
3f56834716
commit
f8ac1ed12b
@ -15,7 +15,7 @@ export class Attachment extends Domain {
|
||||
key: EncString;
|
||||
fileName: EncString;
|
||||
|
||||
constructor(obj?: AttachmentData, alreadyEncrypted = false) {
|
||||
constructor(obj?: AttachmentData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -32,7 +32,6 @@ export class Attachment extends Domain {
|
||||
fileName: null,
|
||||
key: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
["id", "url", "sizeName"]
|
||||
);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ export class Card extends Domain {
|
||||
expYear: EncString;
|
||||
code: EncString;
|
||||
|
||||
constructor(obj?: CardData, alreadyEncrypted = false) {
|
||||
constructor(obj?: CardData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -30,7 +30,6 @@ export class Card extends Domain {
|
||||
expYear: null,
|
||||
code: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export class Cipher extends Domain {
|
||||
deletedDate: Date;
|
||||
reprompt: CipherRepromptType;
|
||||
|
||||
constructor(obj?: CipherData, alreadyEncrypted = false, localData: any = null) {
|
||||
constructor(obj?: CipherData, localData: any = null) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -55,7 +55,6 @@ export class Cipher extends Domain {
|
||||
name: null,
|
||||
notes: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
["id", "userId", "organizationId", "folderId"]
|
||||
);
|
||||
|
||||
@ -76,35 +75,35 @@ export class Cipher extends Domain {
|
||||
|
||||
switch (this.type) {
|
||||
case CipherType.Login:
|
||||
this.login = new Login(obj.login, alreadyEncrypted);
|
||||
this.login = new Login(obj.login);
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
this.secureNote = new SecureNote(obj.secureNote);
|
||||
break;
|
||||
case CipherType.Card:
|
||||
this.card = new Card(obj.card, alreadyEncrypted);
|
||||
this.card = new Card(obj.card);
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
this.identity = new Identity(obj.identity, alreadyEncrypted);
|
||||
this.identity = new Identity(obj.identity);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (obj.attachments != null) {
|
||||
this.attachments = obj.attachments.map((a) => new Attachment(a, alreadyEncrypted));
|
||||
this.attachments = obj.attachments.map((a) => new Attachment(a));
|
||||
} else {
|
||||
this.attachments = null;
|
||||
}
|
||||
|
||||
if (obj.fields != null) {
|
||||
this.fields = obj.fields.map((f) => new Field(f, alreadyEncrypted));
|
||||
this.fields = obj.fields.map((f) => new Field(f));
|
||||
} else {
|
||||
this.fields = null;
|
||||
}
|
||||
|
||||
if (obj.passwordHistory != null) {
|
||||
this.passwordHistory = obj.passwordHistory.map((ph) => new Password(ph, alreadyEncrypted));
|
||||
this.passwordHistory = obj.passwordHistory.map((ph) => new Password(ph));
|
||||
} else {
|
||||
this.passwordHistory = null;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ export class Collection extends Domain {
|
||||
readOnly: boolean;
|
||||
hidePasswords: boolean;
|
||||
|
||||
constructor(obj?: CollectionData, alreadyEncrypted = false) {
|
||||
constructor(obj?: CollectionData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -29,7 +29,6 @@ export class Collection extends Domain {
|
||||
readOnly: null,
|
||||
hidePasswords: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
["id", "organizationId", "externalId", "readOnly", "hidePasswords"]
|
||||
);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ export default class Domain {
|
||||
domain: D,
|
||||
dataObj: any,
|
||||
map: any,
|
||||
alreadyEncrypted: boolean,
|
||||
notEncList: any[] = []
|
||||
) {
|
||||
for (const prop in map) {
|
||||
@ -18,7 +17,7 @@ export default class Domain {
|
||||
}
|
||||
|
||||
const objProp = dataObj[map[prop] || prop];
|
||||
if (alreadyEncrypted === true || notEncList.indexOf(prop) > -1) {
|
||||
if (notEncList.indexOf(prop) > -1) {
|
||||
(domain as any)[prop] = objProp ? objProp : null;
|
||||
} else {
|
||||
(domain as any)[prop] = objProp ? new EncString(objProp) : null;
|
||||
|
@ -13,7 +13,7 @@ export class Field extends Domain {
|
||||
type: FieldType;
|
||||
linkedId: LinkedIdType;
|
||||
|
||||
constructor(obj?: FieldData, alreadyEncrypted = false) {
|
||||
constructor(obj?: FieldData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -28,7 +28,6 @@ export class Field extends Domain {
|
||||
name: null,
|
||||
value: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export class Folder extends Domain {
|
||||
name: EncString;
|
||||
revisionDate: Date;
|
||||
|
||||
constructor(obj?: FolderData, alreadyEncrypted = false) {
|
||||
constructor(obj?: FolderData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -22,7 +22,6 @@ export class Folder extends Domain {
|
||||
id: null,
|
||||
name: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
["id"]
|
||||
);
|
||||
|
||||
|
@ -25,7 +25,7 @@ export class Identity extends Domain {
|
||||
passportNumber: EncString;
|
||||
licenseNumber: EncString;
|
||||
|
||||
constructor(obj?: IdentityData, alreadyEncrypted = false) {
|
||||
constructor(obj?: IdentityData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -54,7 +54,6 @@ export class Identity extends Domain {
|
||||
passportNumber: null,
|
||||
licenseNumber: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ export class Login extends Domain {
|
||||
totp: EncString;
|
||||
autofillOnPageLoad: boolean;
|
||||
|
||||
constructor(obj?: LoginData, alreadyEncrypted = false) {
|
||||
constructor(obj?: LoginData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -31,14 +31,13 @@ export class Login extends Domain {
|
||||
password: null,
|
||||
totp: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
[]
|
||||
);
|
||||
|
||||
if (obj.uris) {
|
||||
this.uris = [];
|
||||
obj.uris.forEach((u) => {
|
||||
this.uris.push(new LoginUri(u, alreadyEncrypted));
|
||||
this.uris.push(new LoginUri(u));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export class LoginUri extends Domain {
|
||||
uri: EncString;
|
||||
match: UriMatchType;
|
||||
|
||||
constructor(obj?: LoginUriData, alreadyEncrypted = false) {
|
||||
constructor(obj?: LoginUriData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -23,7 +23,6 @@ export class LoginUri extends Domain {
|
||||
{
|
||||
uri: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
@ -9,20 +9,15 @@ export class Password extends Domain {
|
||||
password: EncString;
|
||||
lastUsedDate: Date;
|
||||
|
||||
constructor(obj?: PasswordHistoryData, alreadyEncrypted = false) {
|
||||
constructor(obj?: PasswordHistoryData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.buildDomainModel(
|
||||
this,
|
||||
obj,
|
||||
{
|
||||
password: null,
|
||||
},
|
||||
alreadyEncrypted
|
||||
);
|
||||
this.buildDomainModel(this, obj, {
|
||||
password: null,
|
||||
});
|
||||
this.lastUsedDate = new Date(obj.lastUsedDate);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ export class Send extends Domain {
|
||||
disabled: boolean;
|
||||
hideEmail: boolean;
|
||||
|
||||
constructor(obj?: SendData, alreadyEncrypted = false) {
|
||||
constructor(obj?: SendData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -45,7 +45,6 @@ export class Send extends Domain {
|
||||
notes: null,
|
||||
key: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
["id", "accessId", "userId"]
|
||||
);
|
||||
|
||||
@ -61,10 +60,10 @@ export class Send extends Domain {
|
||||
|
||||
switch (this.type) {
|
||||
case SendType.Text:
|
||||
this.text = new SendText(obj.text, alreadyEncrypted);
|
||||
this.text = new SendText(obj.text);
|
||||
break;
|
||||
case SendType.File:
|
||||
this.file = new SendFile(obj.file, alreadyEncrypted);
|
||||
this.file = new SendFile(obj.file);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -17,7 +17,7 @@ export class SendAccess extends Domain {
|
||||
expirationDate: Date;
|
||||
creatorIdentifier: string;
|
||||
|
||||
constructor(obj?: SendAccessResponse, alreadyEncrypted = false) {
|
||||
constructor(obj?: SendAccessResponse) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -32,7 +32,6 @@ export class SendAccess extends Domain {
|
||||
expirationDate: null,
|
||||
creatorIdentifier: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
["id", "expirationDate", "creatorIdentifier"]
|
||||
);
|
||||
|
||||
@ -40,10 +39,10 @@ export class SendAccess extends Domain {
|
||||
|
||||
switch (this.type) {
|
||||
case SendType.Text:
|
||||
this.text = new SendText(obj.text, alreadyEncrypted);
|
||||
this.text = new SendText(obj.text);
|
||||
break;
|
||||
case SendType.File:
|
||||
this.file = new SendFile(obj.file, alreadyEncrypted);
|
||||
this.file = new SendFile(obj.file);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -11,7 +11,7 @@ export class SendFile extends Domain {
|
||||
sizeName: string;
|
||||
fileName: EncString;
|
||||
|
||||
constructor(obj?: SendFileData, alreadyEncrypted = false) {
|
||||
constructor(obj?: SendFileData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -26,7 +26,6 @@ export class SendFile extends Domain {
|
||||
sizeName: null,
|
||||
fileName: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
["id", "sizeName"]
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export class SendText extends Domain {
|
||||
text: EncString;
|
||||
hidden: boolean;
|
||||
|
||||
constructor(obj?: SendTextData, alreadyEncrypted = false) {
|
||||
constructor(obj?: SendTextData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
@ -22,7 +22,6 @@ export class SendText extends Domain {
|
||||
{
|
||||
text: null,
|
||||
},
|
||||
alreadyEncrypted,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
}
|
||||
|
||||
const localData = await this.stateService.getLocalData();
|
||||
return new Cipher(ciphers[id], false, localData ? localData[id] : null);
|
||||
return new Cipher(ciphers[id], localData ? localData[id] : null);
|
||||
}
|
||||
|
||||
async getAll(): Promise<Cipher[]> {
|
||||
@ -316,7 +316,7 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
for (const id in ciphers) {
|
||||
// eslint-disable-next-line
|
||||
if (ciphers.hasOwnProperty(id)) {
|
||||
response.push(new Cipher(ciphers[id], false, localData ? localData[id] : null));
|
||||
response.push(new Cipher(ciphers[id], localData ? localData[id] : null));
|
||||
}
|
||||
}
|
||||
return response;
|
||||
|
Loading…
Reference in New Issue
Block a user