feat(sync): paginate Android sync with change tokens
Lint / Lint (push) Successful in 1m8s
Tests / Go backend (push) Failing after 1m23s
Tests / Dashboard checks (push) Failing after 38s
Docker / Docker Build & Push (push) Failing after 6m29s

This commit is contained in:
Gabriel20xx committed 2026-10-20 15:27:53 +00:00
1 parent 0ff94f9b10
commit 97c237be80
76 files changed
+3401 -851

No files matched your search

@@ -22,7 +22,7 @@ from shared_backend.postgres import (
retry_startup,
)
from shared_backend.tokens import hash_token, new_session_token
from shared_backend.totp import totp_provisioning_uri, verify_totp
from shared_backend.totp import totp_provisioning_uri, verify_totp, verify_totp_step
class SharedBackendTests(unittest.TestCase):
@@ -61,6 +61,19 @@ class SharedBackendTests(unittest.TestCase):
self.assertTrue(verify_password("correct horse battery staple", upgraded))
self.assertFalse(password_hash_needs_upgrade(upgraded))
def test_long_legacy_pbkdf2_password_migrates_without_truncation(self):
import hashlib
password = "legacy:" + "x" * 80
salt = "0123456789abcdef0123456789abcdef"
expected = hashlib.pbkdf2_hmac("sha256", password.encode(), salt.encode(), 100_000).hex()
legacy = f"{salt}:{expected}"
valid, upgraded = verify_and_upgrade_password(password, legacy)
self.assertTrue(valid)
self.assertTrue(upgraded.startswith("bcrypt-sha256$$2b$12$"))
self.assertTrue(verify_password(password, upgraded))
self.assertFalse(verify_password(password + "x", upgraded))
def test_a_cost_below_the_current_policy_is_upgraded(self):
low_cost = "bcrypt$" + bcrypt.hashpw(
b"correct horse battery staple", bcrypt.gensalt(rounds=4)
@@ -151,6 +164,8 @@ class SharedBackendTests(unittest.TestCase):
]
for timestamp, code in vectors:
self.assertTrue(verify_totp(secret, code, timestamp))
self.assertEqual(verify_totp_step(secret, code, timestamp), timestamp // 30)
self.assertEqual(verify_totp_step(secret, code, timestamp), timestamp // 30)
self.assertTrue(
totp_provisioning_uri("Example App", "admin@example.com", secret).startswith(
"otpauth://totp/"