updates for encrypted export and import (#198)

* react to changes for encrypted import

* support encrypted json export

* default back to csv
This commit is contained in:
Kyle Spearrin 2020-12-08 12:35:37 -05:00 committed by GitHub
parent 16d53b7f6f
commit 30b7b93fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

2
jslib

@ -1 +1 @@
Subproject commit abb54f007305eabd77996623dd20cbe45345e82a
Subproject commit dcbd09e736b516b359369f9d9fe5b0f5a6c2a928

View File

@ -31,7 +31,10 @@ export class ExportCommand {
const keyHash = await this.cryptoService.hashPassword(password, null);
const storedKeyHash = await this.cryptoService.getKeyHash();
if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) {
const format = cmd.format !== 'json' ? 'csv' : 'json';
let format = cmd.format;
if (format !== 'encrypted_json' && format !== 'json') {
format = 'csv';
}
if (cmd.organizationid != null && !Utils.isGuid(cmd.organizationid)) {
return Response.error('`' + cmd.organizationid + '` is not a GUID.');
}

View File

@ -25,7 +25,7 @@ export class ImportCommand {
return Response.badRequest('`filepath` was not provided.');
}
const importer = await this.importService.getImporter(format, false);
const importer = await this.importService.getImporter(format, null);
if (importer === null) {
return Response.badRequest('Proper importer type required.');
}

View File

@ -546,7 +546,7 @@ export class Program extends BaseProgram {
.on('--help', () => {
writeLn('\n Notes:');
writeLn('');
writeLn(' Valid formats are `csv` and `json`. Default format is `csv`.');
writeLn(' Valid formats are `csv`, `json`, `encrypted_json`. Default format is `csv`.');
writeLn('');
writeLn(' If raw output is specified and no output filename or directory is given, the');
writeLn(' result is written to stdout.');