A Go utility to sign Ethereum messages using AWS KMS, with support for message hashing and ECDSA signature adjustments according to Ethereum standards.
- Retrieve public keys from AWS KMS and convert them to Ethereum addresses.
- Generate Ethereum-compatible message hashes.
- Sign messages using AWS KMS.
- Adjust ECDSA signatures to meet Ethereum standards.
- Go 1.16+
- AWS SDK for Go
- AWS KMS setup with a suitable key
- Environment variables for AWS configuration
-
Clone the repository:
``` git clone https://github.com/Jamill-hallak/ethereum-aws-kms-signer.git
cd ethereum-aws-kms-signer ```
-
Install dependencies:
``` go mod tidy ```
Create a .env
file in the root directory with the following content:
``` AWS_REGION= your-aws-region AWS_KMS_KEY_ID= your-kms-key-id AWS_ACCESS_KEY_ID= your-access-key-id AWS_SECRET_ACCESS_KEY= your-secret-access-key ```
``` go run main.go ```
``` Authorized Signer Address: 0xYourSignerAddress Message Hash: 0xYourMessageHash EthSignedMessage Hash: 0xYourEthSignedMessageHash Signature: 0xYourSignature ```
The entry point of the application. It loads environment variables, retrieves the public key from AWS KMS, generates message hashes, and signs the message.
Contains the function to initialize the AWS KMS client using credentials from environment variables.
Contains utility functions related to AWS KMS operations, such as retrieving public keys and signing messages.
Contains utility functions related to Ethereum operations, such as generating message hashes and converting public keys to Ethereum addresses.
Handles Ethereum signature adjustments to conform to Ethereum's standards, including adjusting the S value and determining the recovery ID.
Feel free to submit issues, fork the repository, and send pull requests. We welcome all contributions!
This project is licensed under the MIT License.