"""Change master password."""

import typer

from mb_stash.cli.context import use_context


def change_password(ctx: typer.Context) -> None:
    """Change master password."""
    app = use_context(ctx)
    old_password: str = typer.prompt("Current password", hide_input=True)
    new_password: str = typer.prompt("New password", hide_input=True, confirmation_prompt=True)
    app.core.service.change_password(old_password, new_password)
    app.out.print_password_changed()
