def test_scrypt_keyfile_creation():
    keyfile_json = create_keyfile_json(
        PRIVATE_KEY,
        password=PASSWORD,
        kdf='scrypt',
        iterations=2,
    )
    derived_private_key = decode_keyfile_json(keyfile_json, PASSWORD)
    assert derived_private_key == PRIVATE_KEY
def test_scrypt_keyfile_address():
    keyfile_json = create_keyfile_json(
        PRIVATE_KEY,
        password=PASSWORD,
        kdf='scrypt',
        iterations=2,
    )
    assert keyfile_json[
        'address'] == '008aeeda4d805471df9b2a5b0f38a0c3bcba786b'
def test_pbkdf2_keyfile_salt32_creation():
    keyfile_json = create_keyfile_json(
        PRIVATE_KEY,
        password=PASSWORD,
        kdf='pbkdf2',
        iterations=1,
        salt_size=32,
    )
    assert len(keyfile_json['crypto']['kdfparams']['salt']) == 32 * 2
    derived_private_key = decode_keyfile_json(keyfile_json, PASSWORD)
    assert derived_private_key == PRIVATE_KEY
def keyfile_json(request):
    _keyfile_json = create_keyfile_json(PRIVATE_KEY,
                                        PASSWORD,
                                        kdf=request.param,
                                        iterations=2)
    return _keyfile_json