mirror of
https://github.com/bitwarden/jslib
synced 2025-12-22 11:13:17 +00:00
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { CardData } from '../data';
|
|
|
|
import { CipherString } from './cipherString';
|
|
import Domain from './domain';
|
|
|
|
import { CardView } from '../view';
|
|
|
|
export class Card extends Domain {
|
|
cardholderName: CipherString;
|
|
brand: CipherString;
|
|
number: CipherString;
|
|
expMonth: CipherString;
|
|
expYear: CipherString;
|
|
code: CipherString;
|
|
|
|
constructor(obj?: CardData, alreadyEncrypted: boolean = false) {
|
|
super();
|
|
if (obj == null) {
|
|
return;
|
|
}
|
|
|
|
this.buildDomainModel(this, obj, {
|
|
cardholderName: null,
|
|
brand: null,
|
|
number: null,
|
|
expMonth: null,
|
|
expYear: null,
|
|
code: null,
|
|
}, alreadyEncrypted, []);
|
|
}
|
|
|
|
decrypt(orgId: string): Promise<CardView> {
|
|
return this.decryptObj(new CardView(this), {
|
|
cardholderName: null,
|
|
brand: null,
|
|
number: null,
|
|
expMonth: null,
|
|
expYear: null,
|
|
code: null,
|
|
}, orgId);
|
|
}
|
|
}
|