From e9fa2192df374e3d2116c7c53bff268c970f944b Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 26 May 2020 21:09:20 +0800 Subject: [PATCH] Create uuid at execution time instead of class attribute --- eth2deposit/key_handling/keystore.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eth2deposit/key_handling/keystore.py b/eth2deposit/key_handling/keystore.py index 779f0f7..dde53cc 100644 --- a/eth2deposit/key_handling/keystore.py +++ b/eth2deposit/key_handling/keystore.py @@ -65,7 +65,7 @@ class Keystore(BytesDataclass): crypto: KeystoreCrypto = KeystoreCrypto() pubkey: str = '' path: str = '' - uuid: str = str(uuid4()) # Generate a new uuid + uuid: str = '' version: int = 4 def kdf(self, **kwargs: Any) -> bytes: @@ -96,6 +96,7 @@ class Keystore(BytesDataclass): kdf_salt: bytes=randbits(256).to_bytes(32, 'big'), aes_iv: bytes=randbits(128).to_bytes(16, 'big')) -> 'Keystore': keystore = cls() + keystore.uuid = str(uuid4()) keystore.crypto.kdf.params['salt'] = kdf_salt decryption_key = keystore.kdf(password=password, **keystore.crypto.kdf.params) keystore.crypto.cipher.params['iv'] = aes_iv