refactor: move PKCE pair generatio for airtable

- Removed the `generate_pkce_pair` function from `airtable_add_connector_route.py` and relocated it to `oauth_security.py` for better organization.
- Updated imports in `airtable_add_connector_route.py` to reflect the new location of the PKCE generation function.
This commit is contained in:
Anish Sarkar 2026-04-04 03:36:54 +05:30
parent 8e6b1c77ea
commit e814540727
2 changed files with 12 additions and 25 deletions

View file

@ -29,6 +29,17 @@ def generate_code_verifier(length: int = 128) -> str:
return "".join(_PKCE_RNG.choice(_PKCE_CHARS) for _ in range(length))
def generate_pkce_pair(length: int = 128) -> tuple[str, str]:
"""Generate a PKCE code_verifier and its S256 code_challenge."""
verifier = generate_code_verifier(length)
challenge = (
base64.urlsafe_b64encode(hashlib.sha256(verifier.encode()).digest())
.decode()
.rstrip("=")
)
return verifier, challenge
class OAuthStateManager:
"""Manages secure OAuth state parameters with HMAC signatures."""