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:
+1
-1
@@ -57,7 +57,7 @@ def generate_token(action_id: str, purpose: 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]:
|
||||
|
||||
Reference in New Issue
Block a user