mirror of
https://gitlab.com/pulsechaincom/staking-deposit-cli.git
synced 2024-12-23 11:57:19 +00:00
Create uuid at execution time instead of class attribute
This commit is contained in:
parent
49a8bded42
commit
e9fa2192df
@ -65,7 +65,7 @@ class Keystore(BytesDataclass):
|
|||||||
crypto: KeystoreCrypto = KeystoreCrypto()
|
crypto: KeystoreCrypto = KeystoreCrypto()
|
||||||
pubkey: str = ''
|
pubkey: str = ''
|
||||||
path: str = ''
|
path: str = ''
|
||||||
uuid: str = str(uuid4()) # Generate a new uuid
|
uuid: str = ''
|
||||||
version: int = 4
|
version: int = 4
|
||||||
|
|
||||||
def kdf(self, **kwargs: Any) -> bytes:
|
def kdf(self, **kwargs: Any) -> bytes:
|
||||||
@ -96,6 +96,7 @@ class Keystore(BytesDataclass):
|
|||||||
kdf_salt: bytes=randbits(256).to_bytes(32, 'big'),
|
kdf_salt: bytes=randbits(256).to_bytes(32, 'big'),
|
||||||
aes_iv: bytes=randbits(128).to_bytes(16, 'big')) -> 'Keystore':
|
aes_iv: bytes=randbits(128).to_bytes(16, 'big')) -> 'Keystore':
|
||||||
keystore = cls()
|
keystore = cls()
|
||||||
|
keystore.uuid = str(uuid4())
|
||||||
keystore.crypto.kdf.params['salt'] = kdf_salt
|
keystore.crypto.kdf.params['salt'] = kdf_salt
|
||||||
decryption_key = keystore.kdf(password=password, **keystore.crypto.kdf.params)
|
decryption_key = keystore.kdf(password=password, **keystore.crypto.kdf.params)
|
||||||
keystore.crypto.cipher.params['iv'] = aes_iv
|
keystore.crypto.cipher.params['iv'] = aes_iv
|
||||||
|
Loading…
Reference in New Issue
Block a user