Browse Source

Remove support for alreadyEncrypted (#762)

pull/784/head
Oscar Hinton 4 years ago committed by GitHub
parent
commit
f8ac1ed12b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      common/src/models/domain/attachment.ts
  2. 3
      common/src/models/domain/card.ts
  3. 15
      common/src/models/domain/cipher.ts
  4. 3
      common/src/models/domain/collection.ts
  5. 3
      common/src/models/domain/domainBase.ts
  6. 3
      common/src/models/domain/field.ts
  7. 3
      common/src/models/domain/folder.ts
  8. 3
      common/src/models/domain/identity.ts
  9. 5
      common/src/models/domain/login.ts
  10. 3
      common/src/models/domain/loginUri.ts
  11. 13
      common/src/models/domain/password.ts
  12. 7
      common/src/models/domain/send.ts
  13. 7
      common/src/models/domain/sendAccess.ts
  14. 3
      common/src/models/domain/sendFile.ts
  15. 3
      common/src/models/domain/sendText.ts
  16. 4
      common/src/services/cipher.service.ts

3
common/src/models/domain/attachment.ts

@ -15,7 +15,7 @@ export class Attachment extends Domain { @@ -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 { @@ -32,7 +32,6 @@ export class Attachment extends Domain {
fileName: null,
key: null,
},
alreadyEncrypted,
["id", "url", "sizeName"]
);
}

3
common/src/models/domain/card.ts

@ -13,7 +13,7 @@ export class Card extends Domain { @@ -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 { @@ -30,7 +30,6 @@ export class Card extends Domain {
expYear: null,
code: null,
},
alreadyEncrypted,
[]
);
}

15
common/src/models/domain/cipher.ts

@ -38,7 +38,7 @@ export class Cipher extends Domain { @@ -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 { @@ -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 { @@ -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;
}

3
common/src/models/domain/collection.ts

@ -12,7 +12,7 @@ export class Collection extends Domain { @@ -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 { @@ -29,7 +29,6 @@ export class Collection extends Domain {
readOnly: null,
hidePasswords: null,
},
alreadyEncrypted,
["id", "organizationId", "externalId", "readOnly", "hidePasswords"]
);
}

3
common/src/models/domain/domainBase.ts

@ -8,7 +8,6 @@ export default class Domain { @@ -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 { @@ -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;

3
common/src/models/domain/field.ts

@ -13,7 +13,7 @@ export class Field extends Domain { @@ -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 { @@ -28,7 +28,6 @@ export class Field extends Domain {
name: null,
value: null,
},
alreadyEncrypted,
[]
);
}

3
common/src/models/domain/folder.ts

@ -9,7 +9,7 @@ export class Folder extends Domain { @@ -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 { @@ -22,7 +22,6 @@ export class Folder extends Domain {
id: null,
name: null,
},
alreadyEncrypted,
["id"]
);

3
common/src/models/domain/identity.ts

@ -25,7 +25,7 @@ export class Identity extends Domain { @@ -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 { @@ -54,7 +54,6 @@ export class Identity extends Domain {
passportNumber: null,
licenseNumber: null,
},
alreadyEncrypted,
[]
);
}

5
common/src/models/domain/login.ts

@ -14,7 +14,7 @@ export class Login extends Domain { @@ -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 { @@ -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));
});
}
}

3
common/src/models/domain/loginUri.ts

@ -10,7 +10,7 @@ export class LoginUri extends Domain { @@ -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 { @@ -23,7 +23,6 @@ export class LoginUri extends Domain {
{
uri: null,
},
alreadyEncrypted,
[]
);
}

13
common/src/models/domain/password.ts

@ -9,20 +9,15 @@ export class Password extends Domain { @@ -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);
}

7
common/src/models/domain/send.ts

@ -28,7 +28,7 @@ export class Send extends Domain { @@ -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 { @@ -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 { @@ -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;

7
common/src/models/domain/sendAccess.ts

@ -17,7 +17,7 @@ export class SendAccess extends Domain { @@ -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 { @@ -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 { @@ -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;

3
common/src/models/domain/sendFile.ts

@ -11,7 +11,7 @@ export class SendFile extends Domain { @@ -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 { @@ -26,7 +26,6 @@ export class SendFile extends Domain {
sizeName: null,
fileName: null,
},
alreadyEncrypted,
["id", "sizeName"]
);
}

3
common/src/models/domain/sendText.ts

@ -9,7 +9,7 @@ export class SendText extends Domain { @@ -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 { @@ -22,7 +22,6 @@ export class SendText extends Domain {
{
text: null,
},
alreadyEncrypted,
[]
);
}

4
common/src/services/cipher.service.ts

@ -306,7 +306,7 @@ export class CipherService implements CipherServiceAbstraction { @@ -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 { @@ -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…
Cancel
Save