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:
39
src/models/domain/field.ts
Normal file
39
src/models/domain/field.ts
Normal 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;
|
||||
Reference in New Issue
Block a user