feat: add async client base, AsyncHTTPClient, AsyncDescopeClient, and async TOTP#1562
Draft
LioriE wants to merge 4 commits into
Draft
feat: add async client base, AsyncHTTPClient, AsyncDescopeClient, and async TOTP#1562LioriE wants to merge 4 commits into
LioriE wants to merge 4 commits into
Conversation
… async TOTP Introduces an async execution layer alongside the existing sync client: - AsyncHTTPClient (httpx.AsyncClient-based) with retry, verbose, and lifecycle support - DescopeClientBase shared base for sync/async clients (init validation, pure-CPU helpers) - TOTPBase shared base for sign_up/sign_in_code/update_user validation logic - AsyncTOTP and AsyncDescopeClient as async-native counterparts - Unified pytest fixtures (conftest.py) and test suites covering both clients: test_async_http_client.py, test_totp_unified.py, test_descope_client_unified.py
Co-Authored-By: LioriE <lior.eliav@descope.com>
| client = client_factory.make(PROJECT_ID, PUBLIC_KEY_DICT) | ||
|
|
||
| data = json.loads( | ||
| """{"jwts": ["eyJhbGciOiJFUzM4NCIsImtpZCI6IjJCdDVXTGNjTFVleTFEcDd1dHB0WmIzRng5SyIsInR5cCI6IkpXVCJ9.eyJjb29raWVEb21haW4iOiIiLCJjb29raWVFeHBpcmF0aW9uIjoxNjYwMzg4MDc4LCJjb29raWVNYXhBZ2UiOjI1OTE5OTksImNvb2tpZU5hbWUiOiJEU1IiLCJjb29raWVQYXRoIjoiLyIsImV4cCI6MTY2MDIxNTI3OCwiaWF0IjoxNjU3Nzk2MDc4LCJpc3MiOiIyQnQ1V0xjY0xVZXkxRHA3dXRwdFpiM0Z4OUsiLCJzdWIiOiIyQnRFSGtnT3UwMmxtTXh6UElleGRNdFV3MU0ifQ.oAnvJ7MJvCyL_33oM7YCF12JlQ0m6HWRuteUVAdaswfnD4rHEBmPeuVHGljN6UvOP4_Cf0559o39UHVgm3Fwb-q7zlBbsu_nP1-PRl-F8NJjvBgC5RsAYabtJq7LlQmh"], "user": {"loginIds": ["guyp@descope.com"], "name": "", "email": "guyp@descope.com", "phone": "", "verifiedEmail": true, "verifiedPhone": false}, "firstSeen": false}""" |
There was a problem hiding this comment.
🛑 Gitleaks has detected a secret with rule-id jwt in commit e44fd59.
If this secret is a true positive, please rotate the secret ASAP.
If this secret is a false positive, you can add the fingerprint below to your .gitleaksignore file and commit the change to this branch.
echo e44fd5977ffd62c56f63c32e2422bf2c0e87c816:tests/test_descope_client_parity.py:jwt:761 >> .gitleaksignore
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_ClientBaseand_AuthBaseto extract shared sync/async logicAsyncHTTPClientwithhttpx.AsyncClientfor non-blocking HTTPAsyncDescopeClientas the async counterpart toDescopeClientAsyncTOTPbacked by a shared_TOTPBaseDescopeClientandTOTPto reuse the new base classesStatus
Draft / POC — async infrastructure is in place; remaining auth methods need to be ported to async.
Test plan
tests/test_async_http_client.py— AsyncHTTPClient unit teststests/test_descope_client_parity.py— sync/async client behaviour paritytests/test_totp_parity.py— sync/async TOTP parity