diff options
author | Florian Dold <florian@dold.me> | 2021-01-07 18:56:09 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-01-07 18:56:09 +0100 |
commit | 265034104241eabffab32693f3a5a1af85cd7749 (patch) | |
tree | bce9e6b418fb23b4ca561cf6c94be8c1a0d19345 /packages/taler-wallet-cli | |
parent | b2e213bae6c8f9d6a7629f3b9a1e474fb33bdb24 (diff) |
implement backup encryption, some more CLI commands
Diffstat (limited to 'packages/taler-wallet-cli')
-rw-r--r-- | packages/taler-wallet-cli/src/index.ts | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index f4970e73d..87e0e00d1 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -409,6 +409,29 @@ backupCli.subcommand("exportPlain", "export-plain").action(async (args) => { }); }); +backupCli + .subcommand("export", "export") + .requiredArgument("filename", clk.STRING, { + help: "backup filename", + }) + .action(async (args) => { + await withWallet(args, async (wallet) => { + const backup = await wallet.exportBackupEncrypted(); + fs.writeFileSync(args.export.filename, backup); + }); + }); + +backupCli + .subcommand("import", "import") + .requiredArgument("filename", clk.STRING, { + help: "backup filename", + }) + .action(async (args) => { + await withWallet(args, async (wallet) => { + const backupEncBlob = fs.readFileSync(args.import.filename); + await wallet.importBackupEncrypted(backupEncBlob); + }); + }); backupCli.subcommand("importPlain", "import-plain").action(async (args) => { await withWallet(args, async (wallet) => { @@ -417,6 +440,36 @@ backupCli.subcommand("importPlain", "import-plain").action(async (args) => { }); }); +backupCli.subcommand("recoverySave", "save-recovery").action(async (args) => { + await withWallet(args, async (wallet) => { + const recoveryJson = await wallet.getBackupRecovery(); + console.log(JSON.stringify(recoveryJson, undefined, 2)); + }); +}); + +backupCli.subcommand("run", "run").action(async (args) => { + await withWallet(args, async (wallet) => { + await wallet.runBackupCycle(); + }); +}); + +backupCli + .subcommand("recoveryLoad", "load-recovery") + .action(async (args) => {}); + +backupCli.subcommand("status", "status").action(async (args) => {}); + +backupCli + .subcommand("addProvider", "add-provider") + .requiredArgument("url", clk.STRING) + .action(async (args) => { + await withWallet(args, async (wallet) => { + wallet.addBackupProvider({ + backupProviderBaseUrl: args.addProvider.url, + }); + }); + }); + const advancedCli = walletCli.subcommand("advancedArgs", "advanced", { help: "Subcommands for advanced operations (only use if you know what you're doing!).", |