mirror of
https://github.com/bitwarden/browser
synced 2026-01-06 10:33:57 +00:00
convert cipher service to ts
This commit is contained in:
@@ -33,7 +33,7 @@ class Attachment extends Domain {
|
||||
url: this.url,
|
||||
};
|
||||
|
||||
return this.decryptObj(model, this, {
|
||||
return this.decryptObj(model, {
|
||||
fileName: null,
|
||||
}, orgId);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Card extends Domain {
|
||||
}
|
||||
|
||||
decrypt(orgId: string): Promise<any> {
|
||||
return this.decryptObj({}, this, {
|
||||
return this.decryptObj({}, {
|
||||
cardholderName: null,
|
||||
brand: null,
|
||||
number: null,
|
||||
|
||||
@@ -103,7 +103,7 @@ class Cipher extends Domain {
|
||||
fields: null as any[],
|
||||
};
|
||||
|
||||
await this.decryptObj(model, this, {
|
||||
await this.decryptObj(model, {
|
||||
name: null,
|
||||
notes: null,
|
||||
}, this.organizationId);
|
||||
|
||||
@@ -16,8 +16,10 @@ export default abstract class Domain {
|
||||
}
|
||||
}
|
||||
|
||||
protected async decryptObj(model: any, self: any, map: any, orgId: string) {
|
||||
protected async decryptObj(model: any, map: any, orgId: string) {
|
||||
const promises = [];
|
||||
const self: any = this;
|
||||
|
||||
for (const prop in map) {
|
||||
if (!map.hasOwnProperty(prop)) {
|
||||
continue;
|
||||
@@ -33,7 +35,6 @@ export default abstract class Domain {
|
||||
return null;
|
||||
}).then((val: any) => {
|
||||
model[theProp] = val;
|
||||
return;
|
||||
});
|
||||
promises.push(p);
|
||||
})(prop);
|
||||
|
||||
@@ -28,7 +28,7 @@ class Field extends Domain {
|
||||
type: this.type,
|
||||
};
|
||||
|
||||
return this.decryptObj(model, this, {
|
||||
return this.decryptObj(model, {
|
||||
name: null,
|
||||
value: null,
|
||||
}, orgId);
|
||||
|
||||
@@ -24,7 +24,7 @@ class Folder extends Domain {
|
||||
id: this.id,
|
||||
};
|
||||
|
||||
return this.decryptObj(model, this, {
|
||||
return this.decryptObj(model, {
|
||||
name: null,
|
||||
}, null);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class Identity extends Domain {
|
||||
}
|
||||
|
||||
decrypt(orgId: string): Promise<any> {
|
||||
return this.decryptObj({}, this, {
|
||||
return this.decryptObj({}, {
|
||||
title: null,
|
||||
firstName: null,
|
||||
middleName: null,
|
||||
|
||||
@@ -24,7 +24,7 @@ class Login extends Domain {
|
||||
}
|
||||
|
||||
decrypt(orgId: string): Promise<any> {
|
||||
return this.decryptObj({}, this, {
|
||||
return this.decryptObj({}, {
|
||||
uri: null,
|
||||
username: null,
|
||||
password: null,
|
||||
|
||||
Reference in New Issue
Block a user