solana-keychain
Flexible, framework-agnostic Solana transaction signing for Rust applications
⚠️ SECURITY NOTICE: This library has not been audited. Use at your own risk. Not recommended for production use with real funds without a thorough security review. The authors and contributors are not responsible for any loss of funds or damages resulting from the use of this library.
solana-keychain provides a unified interface for signing Solana transactions with multiple backend implementations. Whether you need local keypairs for development, enterprise vault integration, or managed wallet services, this library offers a consistent API across all signing methods.
Features
- Unified Interface: Single
SolanaSignertrait for all backends - Async-First: Built with
async/awaitfor modern Rust applications - Modular: Feature flags for zero-cost backend selection
- Type-Safe: Compile-time guarantees and error handling
- Minimal Dependencies: Only include what you use
Supported Backends
| Backend | Use Case | Feature Flag |
|---|---|---|
| Memory | Local keypairs, development, testing | memory (default) |
| Vault | Enterprise key management with HashiCorp Vault | vault |
| Privy | Embedded wallets with Privy infrastructure | privy |
| Turnkey | Non-custodial key management via Turnkey | turnkey |
| AWS KMS | AWS Key Management Service with EdDSA (Ed25519) signing | aws_kms |
| Fireblocks | Fireblocks institutional custody platform | fireblocks |
| GCP KMS | Google Cloud Key Management Service with Ed25519 signing | gcp_kms |
| Para | MPC wallets with Para infrastructure | para |
| CDP | Coinbase Developer Platform managed wallet infrastructure | cdp |
Installation
[]
# Basic usage (memory signer only)
= "0.3"
# With CDP support
= { = "0.3", = ["cdp"] }
# With Vault support
= { = "0.3", = ["vault"] }
# All backends
= { = "0.3", = ["all"] }
Quick Start
Memory Signer (Local Development)
use ;
async
Note: CDP's sign_message API only accepts UTF-8 messages. Non-UTF-8 byte payloads will return an error.
AWS KMS Signer
use ;
async
CDP Signer (Coinbase Developer Platform)
use ;
async
Note: CDP's sign_message API only accepts UTF-8 messages. Non-UTF-8 byte payloads will return an error.
AWS Credentials
The AWS KMS signer uses the AWS default credential provider chain. Credentials are automatically loaded from:
- Environment variables:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN - Shared credentials file:
~/.aws/credentials - IAM role (automatic on EC2, ECS, Lambda)
- Web identity token (for EKS/Kubernetes with IRSA)
| Environment | Recommended Method |
|---|---|
| Production on AWS | IAM role (no explicit credentials needed) |
| Local development | Environment variables or ~/.aws/credentials |
| CI/CD pipelines | Environment variables or OIDC |
Creating an AWS KMS Key
Required IAM permissions:
Para Signer
use ;
async
Core API
All signers implement the SolanaSigner trait:
Contributing
Local Development
Local development and testing use Just as a build and development tool--make sure to install it before running any commands.
Adding a New Signer Backend
Interested in adding a new signer backend? Check out our guide for adding new signers. If you use Claude Code, the repo includes an add-signer skill that walks you through the full process.