fix: _pad() wrong for reject tokens (6-char purpose)

4 - len(s) % 4 = 4 when len % 4 == 0, adding 4 padding chars instead of 0.
-len(s) % 4 correctly returns 0 in that case.
This commit is contained in:
2026-05-27 13:14:07 +00:00
parent bbf05089cd
commit 3896af2a43
+1 -1
View File
@@ -57,7 +57,7 @@ def generate_token(action_id: str, purpose: str) -> str:
def _pad(s: str) -> str: def _pad(s: str) -> str:
return s + "=" * (4 - len(s) % 4) return s + "=" * (-len(s) % 4) # 0 when already aligned, not 4
def verify_token(token: str) -> tuple[str, str]: def verify_token(token: str) -> tuple[str, str]: