mirror of
https://gitlab.com/pulsechaincom/staking-deposit-cli.git
synced 2025-01-10 21:11:21 +00:00
Adds tests for stripping of control chars for passwords
This commit is contained in:
parent
a13294741f
commit
8fe4ca8233
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import pytest
|
||||||
|
|
||||||
from eth2deposit.key_handling.keystore import (
|
from eth2deposit.key_handling.keystore import (
|
||||||
Keystore,
|
Keystore,
|
||||||
@ -56,3 +57,11 @@ def test_encrypt_decrypt_pbkdf2_random_iv() -> None:
|
|||||||
def test_encrypt_decrypt_scrypt_random_iv() -> None:
|
def test_encrypt_decrypt_scrypt_random_iv() -> None:
|
||||||
generated_keystore = ScryptKeystore.encrypt(secret=test_vector_secret, password=test_vector_password)
|
generated_keystore = ScryptKeystore.encrypt(secret=test_vector_secret, password=test_vector_password)
|
||||||
assert generated_keystore.decrypt(test_vector_password) == test_vector_secret
|
assert generated_keystore.decrypt(test_vector_password) == test_vector_secret
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'password,processed_password',
|
||||||
|
[['\a', b''], ['\b', b''], ['\t', b'']]
|
||||||
|
)
|
||||||
|
def test_process_password(password: str, processed_password: bytes) -> None:
|
||||||
|
assert Keystore._process_password(password) == processed_password
|
||||||
|
Loading…
Reference in New Issue
Block a user