From 752ab3c4c54b755933116f5e2d1d15aba0bc0fe4 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Thu, 14 Mar 2024 12:21:21 +0100 Subject: [PATCH] Fix seed encrypt migration (#405) * print * print before ledger * print * remove decryption * make format --- cashu/mint/decrypt.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cashu/mint/decrypt.py b/cashu/mint/decrypt.py index 71247bf6..53c4b63f 100644 --- a/cashu/mint/decrypt.py +++ b/cashu/mint/decrypt.py @@ -68,14 +68,7 @@ def decrypt(encrypted, key): @click.option("--no-dry-run", is_flag=True, help="Dry run.", default=False) async def migrate(no_dry_run): """Migrate the database to encrypted seeds.""" - ledger = Ledger( - db=Database("mint", settings.mint_database), - seed=settings.mint_private_key, - seed_decryption_key=settings.mint_seed_decryption_key, - derivation_path=settings.mint_derivation_path, - backends={}, - crud=LedgerCrudSqlite(), - ) + click.echo(f"Database: directory: {settings.mint_database}") assert settings.mint_seed_decryption_key, "MINT_SEED_DECRYPTION_KEY not set." assert ( len(settings.mint_seed_decryption_key) > 12 @@ -84,7 +77,16 @@ async def migrate(no_dry_run): "Decryption key:" f" {settings.mint_seed_decryption_key[0]}{'*'*10}{settings.mint_seed_decryption_key[-1]}" ) - + click.echo( + f"Seed: {settings.mint_private_key[0]}{'*'*10}{settings.mint_private_key[-1]}" + ) + ledger = Ledger( + db=Database("mint", settings.mint_database), + seed=settings.mint_private_key, + derivation_path=settings.mint_derivation_path, + backends={}, + crud=LedgerCrudSqlite(), + ) aes = AESCipher(settings.mint_seed_decryption_key) click.echo("Making sure that db is migrated to latest version first.")