Add AWS KMS signing backend - #118
Open
valentevidal wants to merge 1 commit into
Open
Conversation
Adds a new kmsWallet signing backend that uses AWS KMS with
ECC_SECGP256K1 keys for secp256k1 (Ethereum) signing. The key
material never leaves the KMS hardware — the signer calls the
KMS Sign API with a pre-hashed message and reconstructs the
Ethereum R/S/V signature from the DER-encoded response.
New config section kmsWallet (alongside fileWallet):
kmsWallet:
enabled: true
keyId: <kms-key-id-or-alias>
region: <aws-region>
endpoint: <optional-endpoint-for-localstack>
When kmsWallet.enabled is true, the KMS wallet takes precedence
over the file wallet. Defaults to false (backwards-compatible).
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.
Feature Request: Add AWS KMS signing backend
Summary
Add an AWS KMS signing backend so the FireFly Signer can sign Ethereum transactions using keys stored in AWS KMS, without the key material ever leaving the KMS hardware.
Motivation
Currently, FireFly Signer only supports a file-based wallet (
fileWallet) where signing keys live on disk. For enterprise and regulated deployments (financial services, tokenised assets, etc.), there is a strong requirement to use hardware-backed key management:AWS KMS supports asymmetric keys on the
ECC_SECGP256K1curve (the secp256k1 curve used by Ethereum), so KMS can produce valid Ethereum signatures.Proposed Implementation
I have a working implementation ready as a PR. It adds:
pkg/kmswallet/— a newKMSWallettype that implements the existingethsigner.Walletinterface. Internally it:kms:GetPublicKeyat startup to derive the Ethereum address from the KMS public key.kms:SignwithMessageType: DigestandSigningAlgorithm: ECDSA_SHA_256for each signing request.pkg/kmswallet/kmssigner.go— akmsSignerthat implements thesecp256k1.Signerandsecp256k1.SignerDirectinterfaces, so it slots into the existing transaction signing path without changes.Config section
kmsWalletalongsidefileWallet:When
kmsWallet.enabledis true, it takes precedence overfileWallet. Defaults to false (backwards-compatible).Design Decisions
Digest. KMS does not re-hash it.fileWalletremains the default.kmsWalletis opt-in.eth_accounts). Multi-key support can be added later by mapping addresses to KMS key IDs.Testing
The PR includes the implementation and passes all existing tests. I plan to add integration tests with LocalStack (via the
endpointconfig) in a follow-up if there's interest from maintainers.Open Questions for Maintainers
kmsWalletbe under a broaderwalletssection, or is a top-level section fine?