mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
support for encrypted json export (#216)
* support for encrypted json export * adjust filename prefix for encrypted formats * flip if logic * remove format param from encrypted export * encryptedFormat getter
This commit is contained in:
@@ -17,13 +17,17 @@ export class ExportComponent {
|
||||
|
||||
formPromise: Promise<string>;
|
||||
masterPassword: string;
|
||||
format: 'json' | 'csv' = 'json';
|
||||
format: 'json' | 'encrypted_json' | 'csv' = 'json';
|
||||
showPassword = false;
|
||||
|
||||
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService, protected exportService: ExportService,
|
||||
protected eventService: EventService, protected win: Window) { }
|
||||
|
||||
get encryptedFormat() {
|
||||
return this.format === 'encrypted_json';
|
||||
}
|
||||
|
||||
async submit() {
|
||||
if (this.masterPassword == null || this.masterPassword === '') {
|
||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||
@@ -63,7 +67,16 @@ export class ExportComponent {
|
||||
}
|
||||
|
||||
protected getFileName(prefix?: string) {
|
||||
return this.exportService.getFileName(prefix, this.format);
|
||||
let extension = this.format;
|
||||
if (this.format === 'encrypted_json') {
|
||||
if (prefix == null) {
|
||||
prefix = 'encrypted';
|
||||
} else {
|
||||
prefix = 'encrypted_' + prefix;
|
||||
}
|
||||
extension = 'json';
|
||||
}
|
||||
return this.exportService.getFileName(prefix, extension);
|
||||
}
|
||||
|
||||
protected async collectEvent(): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user