Skip to content

Commit

Permalink
CHIA-1674 Remove no longer needed get_symmetric_key (Chia-Network#18770)
Browse files Browse the repository at this point in the history
Remove no longer needed get_symmetric_key.
  • Loading branch information
AmineKhaldi authored Oct 28, 2024
1 parent 03a41ac commit cfab9eb
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions chia/util/file_keyring.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import contextlib
import os
import shutil
import sys
import threading
from collections.abc import Iterator
from dataclasses import asdict, dataclass, field
Expand Down Expand Up @@ -55,18 +54,6 @@ def symmetric_key_from_passphrase(passphrase: str, salt: bytes) -> bytes:
return pbkdf2_hmac("sha256", passphrase.encode(), salt, HASH_ITERS)


def get_symmetric_key(salt: bytes) -> bytes:
from chia.cmds.passphrase_funcs import obtain_current_passphrase

try:
passphrase = obtain_current_passphrase(use_passphrase_cache=True)
except Exception as e:
print(f"Unable to unlock the keyring: {e}")
sys.exit(1)

return symmetric_key_from_passphrase(passphrase, salt)


def encrypt_data(input_data: bytes, key: bytes, nonce: bytes) -> bytes:
encryptor = ChaCha20Poly1305(key)
data = encryptor.encrypt(nonce, CHECKBYTES_VALUE + input_data, None)
Expand Down

0 comments on commit cfab9eb

Please sign in to comment.