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