Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: update tests to use new _get_key_from_password signature

LearningCircuit84a65f60cd48
diff --git a/tests/auth_tests/test_sqlcipher_key_derivation.py b/tests/auth_tests/test_sqlcipher_key_derivation.py
index 8ae0abd29c..d7434cae64 100644
--- a/tests/auth_tests/test_sqlcipher_key_derivation.py
+++ b/tests/auth_tests/test_sqlcipher_key_derivation.py
@@ -47,8 +47,12 @@ class TestKeyDerivation:
# Clear cache to ensure fresh derivation
_get_key_from_password.cache_clear()
- key1 = _get_key_from_password(password)
- key2 = _get_key_from_password(password)
+ key1 = _get_key_from_password(
+ password, get_sqlcipher_settings()["kdf_iterations"]
+ )
+ key2 = _get_key_from_password(
+ password, get_sqlcipher_settings()["kdf_iterations"]
+ )
assert key1 == key2, "Same password should always produce same key"
@@ -56,8 +60,12 @@ class TestKeyDerivation:
"""Verify different passwords produce different keys."""
_get_key_from_password.cache_clear()
- key1 = _get_key_from_password("password1")
- key2 = _get_key_from_password("password2")
+ key1 = _get_key_from_password(
+ "password1", get_sqlcipher_settings()["kdf_iterations"]
+ )
+ key2 = _get_key_from_password(
+ "password2", get_sqlcipher_settings()["kdf_iterations"]
+ )
assert key1 != key2, "Different passwords should produce different keys"
@@ -66,14 +74,18 @@ class TestKeyDerivation:
_get_key_from_password.cache_clear()
password = "cached_test_password"
- key1 = _get_key_from_password(password)
+ key1 = _get_key_from_password(
+ password, get_sqlcipher_settings()["kdf_iterations"]
+ )
# Check cache info
cache_info = _get_key_from_password.cache_info()
assert cache_info.misses >= 1, "First call should be a cache miss"
# Second call should hit cache
- key2 = _get_key_from_password(password)
+ key2 = _get_key_from_password(
+ password, get_sqlcipher_settings()["kdf_iterations"]
+ )
cache_info_after = _get_key_from_password.cache_info()
assert cache_info_after.hits >= 1, "Second call should be a cache hit"
@@ -83,7 +95,9 @@ class TestKeyDerivation:
"""Verify derived key only contains hex characters (SQL injection safe)."""
_get_key_from_password.cache_clear()
- key = _get_key_from_password("any_password")
+ key = _get_key_from_password(
+ "any_password", get_sqlcipher_settings()["kdf_iterations"]
+ )
hex_string = key.hex()
# Verify only hex characters
@@ -111,7 +125,9 @@ class TestKeyDerivation:
keys = []
for password in special_passwords:
try:
- key = _get_key_from_password(password)
+ key = _get_key_from_password(
+ password, get_sqlcipher_settings()["kdf_iterations"]
+ )
keys.append(key)
# Verify key is valid bytes
assert isinstance(key, bytes), (
@@ -130,7 +146,9 @@ class TestKeyDerivation:
"""Verify derived key has correct length (64 bytes = 512 bits for SHA512)."""
_get_key_from_password.cache_clear()
- key = _get_key_from_password("test_password")
+ key = _get_key_from_password(
+ "test_password", get_sqlcipher_settings()["kdf_iterations"]
+ )
# SHA512-based PBKDF2 produces 64-byte key (512 bits)
assert len(key) == 64, f"Key should be 64 bytes, got {len(key)}"
@@ -141,7 +159,9 @@ class TestKeyDerivation:
# Note: Empty password validation happens in DatabaseManager, not in key derivation
# The key derivation function itself should work with any input
- key = _get_key_from_password("")
+ key = _get_key_from_password(
+ "", get_sqlcipher_settings()["kdf_iterations"]
+ )
assert isinstance(key, bytes), (
"Empty password should still produce bytes"
)
@@ -278,7 +298,9 @@ class TestKeyDerivationSecurity:
_get_key_from_password.cache_clear()
password = "my_secret_password"
- key = _get_key_from_password(password)
+ key = _get_key_from_password(
+ password, get_sqlcipher_settings()["kdf_iterations"]
+ )
# Key should be bytes, not string
assert isinstance(key, bytes), "Key should be bytes"
@@ -298,9 +320,13 @@ class TestKeyDerivationSecurity:
_get_key_from_password.cache_clear()
# Same password should always produce same key (fixed salt)
- key1 = _get_key_from_password("test")
+ key1 = _get_key_from_password(
+ "test", get_sqlcipher_settings()["kdf_iterations"]
+ )
_get_key_from_password.cache_clear()
- key2 = _get_key_from_password("test")
+ key2 = _get_key_from_password(
+ "test", get_sqlcipher_settings()["kdf_iterations"]
+ )
assert key1 == key2, (
"Fixed salt ensures consistent key derivation for database compatibility"