Skip to content

Commit

Permalink
Fix seed encrypt migration (#405)
Browse files Browse the repository at this point in the history
* print

* print before ledger

* print

* remove decryption

* make format
  • Loading branch information
callebtc authored Mar 14, 2024
1 parent 6cb967f commit 752ab3c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cashu/mint/decrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.")
Expand Down

0 comments on commit 752ab3c

Please sign in to comment.