-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc1e748
commit 1ab173a
Showing
1 changed file
with
8 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
import pkce | ||
|
||
from rippling_cli.constants import CODE_CHALLENGE_METHOD | ||
|
||
|
||
class PKCE: | ||
@staticmethod | ||
def generate_code_verifier(length=43): | ||
code_verifier = pkce.generate_code_verifier(length=length) | ||
return code_verifier | ||
|
||
@staticmethod | ||
def get_code_challenge(code_verifier, method=CODE_CHALLENGE_METHOD): | ||
if method == CODE_CHALLENGE_METHOD: | ||
code_challenge = pkce.get_code_challenge(code_verifier) | ||
return code_challenge | ||
else: | ||
raise ValueError("Unsupported code challenge method") | ||
|
||
""" | ||
PKCE class for generating PKCE code verifier and code challenge | ||
""" | ||
@staticmethod | ||
def generate_pkce_pair(code_verifier_length=43): | ||
""" | ||
Generate PKCE code verifier and code challenge pair | ||
:param code_verifier_length: | ||
:return: | ||
""" | ||
code_verifier, code_challenge = pkce.generate_pkce_pair(code_verifier_length) | ||
return code_verifier, code_challenge |