-
Notifications
You must be signed in to change notification settings - Fork 0
Add to_rsa_format function to normalize private key #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new utility function to normalize private keys into RSA format and updates the authentication clients to support reading configuration from environment variables. The changes improve flexibility by allowing credentials to be provided via multiple environment variable names and ensuring private keys are properly formatted.
Key changes:
- New
to_rsa_formatutility function handles private keys with various formatting (missing newlines, spaces instead of newlines, or no formatting) - Both
MAuthHttpxandMAuthclients now accept default values from environment variables viaConfig - Environment variable support expanded to include
MAUTH_APP_UUIDandMAUTH_PRIVATE_KEYas alternatives
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mauth_client/utils.py | Implements to_rsa_format function to normalize private key formatting with proper headers, footers, and newlines |
| mauth_client/config.py | Updates environment variable loading to use to_rsa_format and support alternative variable names |
| mauth_client/requests_mauth/client.py | Changes constructor to accept default values from Config for app_uuid and private_key_data |
| mauth_client/httpx_mauth/client.py | Changes constructor parameters to use Config defaults for app_uuid and private_key_data |
| tests/utils_test.py | Adds comprehensive test coverage for the new to_rsa_format function |
| tests/httpx_mauth/client_test.py | Refactors tests to use shared key loading utility instead of inline file reading |
| README.md | Documents new environment variable options and fixes table formatting |
| CHANGELOG.md | Documents the new features in version 1.8.0 |
| pyproject.toml | Bumps version to 1.8.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
cmcinnes-mdsol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
also, update requests_mauth and httpx_mauth to support reading configuration from environment variables