You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+33-3Lines changed: 33 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Project Overview
6
6
7
-
`solana-keychain` is a Rust library providing a unified interface for signing Solana transactions across multiple backend implementations. The architecture centers around a single `SolanaSigner` trait that abstracts over four different signing backends: Memory (local keypairs), Vault (HashiCorp), Privy, and Turnkey.
7
+
`solana-keychain` is a Rust library providing a unified interface for signing Solana transactions across multiple backend implementations. The architecture centers around a single `SolanaSigner` trait that abstracts over seven different signing backends: Memory (local keypairs), Vault (HashiCorp), Privy, Turnkey, AWS KMS, Fireblocks, and GCP KMS.
8
8
9
9
## Common Commands
10
10
@@ -24,6 +24,9 @@ cd rust && cargo test --features memory
24
24
cd rust && cargo test --features vault
25
25
cd rust && cargo test --features privy
26
26
cd rust && cargo test --features turnkey
27
+
cd rust && cargo test --features aws_kms
28
+
cd rust && cargo test --features fireblocks
29
+
cd rust && cargo test --features gcp_kms
27
30
28
31
# Run a single test
29
32
cd rust && cargo test test_name --all-features
@@ -136,6 +139,23 @@ All signers follow a consistent pattern but differ in where keys are stored:
136
139
- Response contains r,s signature components that must be padded to 32 bytes each
- Uses Google Cloud SDK with EdDSA (Ed25519) signing
155
+
- PureEdDSA mode with `EC_SIGN_ED25519` algorithm
156
+
- Automatic credential discovery via ADC
157
+
- Availability checked via `GetCryptoKeyVersion`
158
+
139
159
### Error Handling
140
160
141
161
All errors are centralized in [rust/src/error.rs](rust/src/error.rs) using `thiserror`. The `SignerError` enum covers key formats, signing failures, remote API errors, serialization, and configuration issues.
@@ -147,21 +167,29 @@ The library uses Cargo features for zero-cost abstraction:
147
167
-`vault` - Adds VaultSigner with reqwest, vaultrs, base64
148
168
-`privy` - Adds PrivySigner with reqwest, base64
149
169
-`turnkey` - Adds TurnkeySigner with reqwest, base64, p256, hex, chrono
170
+
-`aws_kms` - Adds KmsSigner with aws-sdk-kms
171
+
-`fireblocks` - Adds FireblocksSigner with reqwest, jsonwebtoken
172
+
-`gcp_kms` - Adds GcpKmsSigner with google-cloud-kms-v1, google-cloud-auth
150
173
-`all` - Enables all backends
151
174
152
175
At least one feature must be enabled (enforced by `compile_error!` in lib.rs).
153
176
154
177
## Testing
155
178
156
-
Tests are co-located with implementation code in each module. Remote signers (Vault, Privy, Turnkey) use `wiremock` to mock HTTP endpoints, avoiding actual API calls during testing. Tests cover:
179
+
Tests are co-located with implementation code in each module. Remote signers (Vault, Privy, Turnkey, AWS, Fireblocks, GCP) use `wiremock` to mock HTTP endpoints, avoiding actual API calls during testing. Tests cover:
157
180
- Constructor validation (invalid keys, etc.)
158
181
- Successful signing operations
159
182
- Error cases (unauthorized, malformed responses)
160
183
- Availability checks
161
184
162
185
Run specific backend tests:
163
186
```bash
187
+
cd rust && cargo test --features vault vault::tests
164
188
cd rust && cargo test --features privy privy::tests
189
+
cd rust && cargo test --features turnkey turnkey::tests
190
+
cd rust && cargo test --features aws_kms aws_kms::tests
191
+
cd rust && cargo test --features fireblocks fireblocks::tests
192
+
cd rust && cargo test --features gcp_kms gcp_kms::tests
165
193
```
166
194
167
195
## Key Implementation Notes
@@ -170,5 +198,7 @@ cd rust && cargo test --features privy privy::tests
170
198
- Privy and Turnkey use Base64 encoding for payloads/responses
171
199
- Vault uses Base64 for both input and output
172
200
- Turnkey requires special handling for signature component padding (see [rust/src/turnkey/mod.rs:125-136](rust/src/turnkey/mod.rs))
173
-
- PrivySigner must call `init()` before use; other signers are ready after construction
201
+
- PrivySigner and FireblocksSigner must call `init()` before use; other signers are ready after construction
202
+
- AWS KMS and GCP KMS use official cloud SDKs with automatic credential discovery
203
+
- GCP KMS operates in PureEdDSA mode with `EC_SIGN_ED25519` algorithm
174
204
- The unified `Signer` enum uses conditional compilation extensively with `#[cfg(feature = "...")]`
0 commit comments