Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions gotrue/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ def generate_pkce_verifier(length=64):
# Define characters that can be used in the PKCE verifier
charset = string.ascii_letters + string.digits + "-._~"

# Generate a random PKCE verifier using the secrets module
verifier = "".join(secrets.choice(charset) for _ in range(length))

return verifier
return "".join(secrets.choice(charset) for _ in range(length))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function generate_pkce_verifier refactored with the following changes:

This removes the following comments ( why? ):

# Generate a random PKCE verifier using the secrets module



def generate_pkce_challenge(code_verifier):
Expand All @@ -149,7 +146,4 @@ def generate_pkce_challenge(code_verifier):
verifier_bytes = verifier.encode("utf-8")
sha256_hash = hashlib.sha256(verifier_bytes).digest()

# Encode the hash as URL-safe base64
base64_encoded = base64.urlsafe_b64encode(sha256_hash).rstrip(b"=").decode("utf-8")

return base64_encoded
return base64.urlsafe_b64encode(sha256_hash).rstrip(b"=").decode("utf-8")
Comment on lines -152 to +149
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function generate_pkce_challenge refactored with the following changes:

This removes the following comments ( why? ):

# Encode the hash as URL-safe base64