-
Notifications
You must be signed in to change notification settings - Fork 16
Feature: Implement KMS Wallet #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Added KMS wallet support to handle Ethereum transactions securely using AWS Key Management Service. - Updated configuration to allow KMS key IDs and region settings. - Refactored AdminWallet and Web3Wallet to support KMS-based transaction signing. - Introduced KMSWallet class to encapsulate KMS operations. - Added tests for KMS transaction submission and wallet functionality.
- Updated KMSWallet and Web3Wallet to store and retrieve wallet addresses in a case-insensitive manner. - Removed unnecessary console log from KMSWallet during transaction signing. - Adjusted tests to ensure KMS wallet address normalization is correctly handled.
…just Jest configuration
…ated package versions in package.json and package-lock.json
|
|
||
| const sendTx = this.mainnetWeb3.eth.sendSignedTransaction(signedTx) | ||
|
|
||
| return new Promise((res, rej) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reduce duplicate code
| const region = this.getRegion(address) | ||
|
|
||
| try { | ||
| if (transaction.rpcUrl != undefined && transaction.rpcUrl.includes('localhost')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write a comment why you do this
| this.networkId = networkId | ||
| this.numberOfAdminWalletAccounts = conf.privateKey ? 1 : conf.numberOfAdminWalletAccounts | ||
| // Determine number of accounts based on configuration | ||
| let kmsKeyIds = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just read existing kmskeys from aws? maybe read keys by tags?
| if (conf.kmsKeyIds) { | ||
| kmsKeyIds = conf.kmsKeyIds | ||
| .split(',') | ||
| .map(k => k.trim()) | ||
| .filter(k => k) | ||
| } | ||
| if (kmsKeyIds && kmsKeyIds.length > 0) { | ||
| this.numberOfAdminWalletAccounts = kmsKeyIds.length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be moved to initialize and keys should be fetched by group/tag
| this.wallets[normalizedAddress] = { address, kmsKeyId, isKMS: true } | ||
| } | ||
|
|
||
| getKMSKeyIds() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be fetched from aws by group/tag
|
|
||
| getKMSKeyIds() { | ||
| // Support comma-separated list of keys | ||
| if (this.conf.kmsKeyIds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of kmskeyids use kmsKeysTag
| addresses.forEach(address => { | ||
| const keyId = this.kmsWallet.getKeyId(address) | ||
| this.addKMSWallet(address, keyId) | ||
| // Add KMS addresses to filledAddresses (they don't need admin verification) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not true, need same checks as in mnemonic.
dont duplicate code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure balance check are run for these addresses also
| * Send transaction using KMS signing | ||
| * @private | ||
| */ | ||
| async sendTransactionWithKMS( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deduplicate code like in AdminWallet you have just one sendTransaction method
| env: 'PRIVATE_KEY', | ||
| default: undefined | ||
| }, | ||
| kmsKeyIds: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use kmsKeysTag
Description
Added the KMS wallet, which signs transactions using keys stored in AWS KMS.
The
kms-ethereum-signingdependency is the modularized PoC project I previously built.About # (link your issue here)
How Has This Been Tested?
The KMS wallet is tested in
adminWalletKMS.test.ts.Checklist: