Private Key Support (Optional) #13
Open
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 Private Key Authentication Support
Description
This PR adds support for private key authentication as an alternative to mnemonic-based authentication for the Akash MCP server. Users can now authenticate using either a mnemonic phrase or a raw private key, providing more flexibility in wallet management and integration scenarios.
Motivation
Current implementation only supports mnemonic-based authentication via
AKASH_MNEMONIC. This enhancement addresses several use cases:Changes
Modified Files (5 total):
privateKeyconfiguration fieldToolContextinterface typesKey Features:
Technical Implementation
Authentication Priority:
AKASH_MNEMONICenvironment variableAKASH_PRIVATE_KEYenvironment variableType System:
Uses union types (
DirectSecp256k1HdWallet | DirectSecp256k1Wallet) to maintain type safety while supporting both authentication methods. Both wallet types implement compatible interfaces for signing and account management.Private Key Format:
e4b1c2d3a5f60798b2e1f3c4d5a6b7c8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4Uint8Arrayfor wallet initializationTesting
Manual Testing:
Using privateKey authentication for AkashTest Environment:
Backward Compatibility
Environment Variables
New:
AKASH_PRIVATE_KEY # Optional: Hex-encoded private key (32 bytes/64 chars)Usage Examples:
Dependencies
@cosmjs/proto-signingpackageChecklist
Related Issues
N/A - Enhancement for authentication flexibility
Additional Notes
This implementation prioritizes mnemonic authentication over private key when both are provided.