mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-08 22:02:24 +00:00
fix(python): TOTP codes must honor the entry's period and digits
TotpManager built pyotp.TOTP(secret) with library defaults (6 digits, 30s) and ignored what the entry recorded, so any imported or derived entry using other values produced codes the issuing service rejects. The service was configured from the entry's values -- those govern the code. - current_code_from_secret and current_code take period/digits - EntryManager.get_totp_code passes the entry's values for both the derived and imported paths - display_service, menu_handler (totp_list now carries digits) and the GUI updated at every call site - regression tests for imported and deterministic entries with custom parameters, asserting against pyotp with the matching interval/digits, and confirming default entries are byte-identical to before Found by scripts/cross_impl_check.py, which flagged it as a divergence against the TypeScript port. That allowance is now removed: the suite asserts TOTP equality and reports 30/30 with zero divergences. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
b4f20d417a
commit
5dcd779a6f
9 files changed
+132
-62
No files matched your search
@@ -403,6 +403,7 @@ class TotpViewerWindow(toga.Window):
|
||||
entry = self.entries.retrieve_entry(idx)
|
||||
|
||||
period = int(entry.get("period", 30)) if entry else 30
|
||||
digits = int(entry.get("digits", 6)) if entry else 6
|
||||
remaining = TotpManager.time_remaining(period)
|
||||
if hasattr(self.entries, "get_totp_secret"):
|
||||
if idx in self._secret_cache:
|
||||
@@ -414,7 +415,9 @@ class TotpViewerWindow(toga.Window):
|
||||
except Exception:
|
||||
# Skip entries where secret cannot be derived (e.g. no seed)
|
||||
continue
|
||||
code = TotpManager.current_code_from_secret(secret)
|
||||
code = TotpManager.current_code_from_secret(
|
||||
secret, period=period, digits=digits
|
||||
)
|
||||
else:
|
||||
# Compatibility path for services exposing code retrieval directly.
|
||||
code = self.entries.get_totp_code(idx)
|
||||
|
||||
Reference in new issue
Block a user