Add read-only-auth example for pre-generating authentication tokens#61
Merged
Add read-only-auth example for pre-generating authentication tokens#61
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
|
Closing due to inactivity for more than 7 days. Configure here. |
Collaborator
|
No, no devin bad |
- Add setup.py to configure API key 253 for all accounts - Add generate.py to create auth tokens at 6-hour intervals - Add README.md with documentation and usage examples - Tokens generated for configurable duration with 8-hour expiry - Output format: auth-tokens.json with account_index -> timestamp -> token mapping Co-Authored-By: Alexandru Velea <dev@velea.cc>
e39e35b to
3b4d25a
Compare
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.
Add read-only-auth example for pre-generating authentication tokens
Summary
Adds a new example in
examples/read-only-auth/that enables users to pre-generate authentication tokens for read-only operations. This addresses the use case where users want to avoid exposing API private keys at runtime.What's included:
setup.py- Configures API key 253 for all accounts associated with an L1 addressgenerate.py- Pre-generates auth tokens at 6-hour intervals with 8-hour expiryREADME.md- Comprehensive documentation with usage examples and security considerationsKey features:
unix_timestamp // (6 * 3600) * (6 * 3600){account_index: {timestamp: token_string}}Review & Testing Checklist for Human
This PR contains untested code that requires end-to-end verification. Please complete the following:
python3 setup.py > config.jsonthenpython3 generate.pyto verify both scripts work correctlyauth-tokens.jsonhave timestamps aligned to 6-hour boundaries (divisible by 21600) and confirm the token lookup logic in README workssetup.pyand confirm that old tokens no longer work (validates the invalidation mechanism)Notes
examples/system_setup.pybut haven't been tested with real Lighter credentials(current_time // (6 * 3600)) * (6 * 3600)is critical - please verify tokens are generated for correct future time periodsasyncio.gather()with error handling, but edge cases might existcreate_auth_token_for_timestamp()is a local wrapper that doesn't modify the SignerClient class as requiredLink to Devin run: https://app.devin.ai/sessions/31ad4881808f461cb48c651583f49ace
Requested by: @alexvelea