1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

move domain models to ts

This commit is contained in:
Kyle Spearrin
2017-11-04 22:43:07 -04:00
parent 8e998ff179
commit bdd40d8755
15 changed files with 545 additions and 442 deletions

View File

@@ -0,0 +1,39 @@
import { FieldType } from '../../enums/fieldType.enum';
import { FieldData } from '../data/fieldData';
import { CipherString } from './cipherString';
import Domain from './domain';
class Field extends Domain {
name: CipherString;
vault: CipherString;
type: FieldType;
constructor(obj?: FieldData, alreadyEncrypted: boolean = false) {
super();
if (obj == null) {
return;
}
this.type = obj.type;
this.buildDomainModel(this, obj, {
name: null,
value: null,
}, alreadyEncrypted, []);
}
decrypt(orgId: string): Promise<any> {
const model = {
type: this.type,
};
return this.decryptObj(model, this, {
name: null,
value: null,
}, orgId);
}
}
export { Field };
(window as any).Field = Field;