mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
38 lines
817 B
TypeScript
38 lines
817 B
TypeScript
import { Enums, Data } from '@bitwarden/jslib';
|
|
|
|
import { CipherString } from './cipherString';
|
|
import Domain from './domain';
|
|
|
|
class Field extends Domain {
|
|
name: CipherString;
|
|
vault: CipherString;
|
|
type: Enums.FieldType;
|
|
|
|
constructor(obj?: Data.Field, 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, {
|
|
name: null,
|
|
value: null,
|
|
}, orgId);
|
|
}
|
|
}
|
|
|
|
export { Field };
|
|
(window as any).Field = Field;
|