Add TOTP export via CLI and API

This commit is contained in:
thePR0M3TH3AN
2025-07-09 17:09:27 -04:00
parent a54fc3658e
commit 4f810ccbc3
7 changed files with 82 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
from pathlib import Path
from typing import Optional
import json
import typer
@@ -314,6 +315,17 @@ def entry_unarchive(ctx: typer.Context, entry_id: int) -> None:
typer.echo(str(entry_id))
@entry_app.command("export-totp")
def entry_export_totp(
ctx: typer.Context, file: str = typer.Option(..., help="Output file")
) -> None:
"""Export all TOTP secrets to a JSON file."""
pm = _get_pm(ctx)
data = pm.entry_manager.export_totp_entries(pm.parent_seed)
Path(file).write_text(json.dumps(data, indent=2))
typer.echo(str(file))
@vault_app.command("export")
def vault_export(
ctx: typer.Context, file: str = typer.Option(..., help="Output file")