1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 03:33:54 +00:00

Feature/password protected export (#446)

* Update jslib

* Bumped version to 1.20.0 (#421)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 3e4aa8e476)

* password protected export

* Run Prettier

* Add importer to list of known file types

* Improve launch.json settings

* Turn on import from password protected file

* Run prettier

* Fix webpack source map path change

* Update getPassword helper to use new options class

* Prettier

* Add client type

* Remove master password requirement for export

Alter password optional argument to indicating the file should be password protected rather than account protected

* update jslib

* Handle passwordProtected automagically

* Remove passwordproteted type from import command

* Update src/utils.ts

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>

* Update src/vault.program.ts

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>

* Use new util method

* remove password protected format

* Update jslib

* Clarify export command

* Run prettier

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Gibson <gibson.matt10@gmail.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
Matt Gibson
2022-02-23 15:47:32 -06:00
committed by GitHub
parent 8e65d3e8d2
commit 323c3ee04a
10 changed files with 168 additions and 108 deletions

View File

@@ -447,17 +447,20 @@ export class VaultProgram extends Program {
private exportCommand(): program.Command {
return new program.Command("export")
.arguments("[password]")
.description("Export vault data to a CSV or JSON file.", {
password: "Optional: Your master password.",
})
.description("Export vault data to a CSV or JSON file.", {})
.option("--output <output>", "Output directory or filename.")
.option("--format <format>", "Export file format.")
.option(
"--password [password]",
"Use password to encrypt instead of your Bitwarden account encryption key. Only applies to the encrypted_json format."
)
.option("--organizationid <organizationid>", "Organization id for an organization.")
.on("--help", () => {
writeLn("\n Notes:");
writeLn("");
writeLn(" Valid formats are `csv`, `json`, `encrypted_json`. Default format is `csv`.");
writeLn(
" Valid formats are `csv`, `json`, and `encrypted_json`. Default format is `csv`."
);
writeLn("");
writeLn(
" If --raw option is specified and no output filename or directory is given, the"
@@ -477,15 +480,10 @@ export class VaultProgram extends Program {
);
writeLn("", true);
})
.action(async (password, options) => {
.action(async (options) => {
await this.exitIfLocked();
const command = new ExportCommand(
this.main.exportService,
this.main.policyService,
this.main.keyConnectorService,
this.main.userVerificationService
);
const response = await command.run(password, options);
const command = new ExportCommand(this.main.exportService, this.main.policyService);
const response = await command.run(options);
this.processResponse(response);
});
}