Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit 9ff2477

Browse files
committed
feat(signers): replace rusoto with aws-sdk
1 parent 5145992 commit 9ff2477

File tree

4 files changed

+144
-202
lines changed

4 files changed

+144
-202
lines changed

ethers-core/src/utils/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub use hex;
3838

3939
use crate::types::{Address, Bytes, ParseI256Error, H256, I256, U256};
4040
use ethabi::ethereum_types::FromDecStrErr;
41-
use k256::ecdsa::SigningKey;
41+
use k256::ecdsa::{SigningKey, VerifyingKey};
4242
use std::{
4343
collections::HashMap,
4444
convert::{TryFrom, TryInto},
@@ -390,17 +390,19 @@ pub fn get_create2_address_from_hash(
390390
Address::from(bytes)
391391
}
392392

393-
/// Converts a K256 SigningKey to an Ethereum Address
393+
/// Converts a K256 [SigningKey] to an Ethereum address.
394+
#[inline]
394395
pub fn secret_key_to_address(secret_key: &SigningKey) -> Address {
395-
let public_key = secret_key.verifying_key();
396+
public_key_to_address(secret_key.verifying_key())
397+
}
398+
399+
/// Converts a K256 [VerifyingKey] to an Ethereum address.
400+
pub fn public_key_to_address(public_key: &VerifyingKey) -> Address {
396401
let public_key = public_key.to_encoded_point(/* compress = */ false);
397402
let public_key = public_key.as_bytes();
398403
debug_assert_eq!(public_key[0], 0x04);
399404
let hash = keccak256(&public_key[1..]);
400-
401-
let mut bytes = [0u8; 20];
402-
bytes.copy_from_slice(&hash[12..]);
403-
Address::from(bytes)
405+
Address::from_slice(&hash[12..])
404406
}
405407

406408
/// Encodes an Ethereum address to its [EIP-55] checksum.

ethers-signers/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ futures-util = { workspace = true, optional = true }
4343
futures-executor = { workspace = true, optional = true }
4444

4545
# aws
46-
rusoto_core = { version = "0.48.0", default-features = false, optional = true }
47-
rusoto_kms = { version = "0.48.0", default-features = false, optional = true }
46+
aws-config = { version = "0.56", default-features = false, optional = true }
47+
aws-smithy-runtime-api = { version = "0.56", default-features = false, features = [
48+
"client",
49+
], optional = true }
50+
aws-sdk-kms = { version = "0.29", default-features = false, optional = true }
4851
spki = { workspace = true, optional = true }
4952

5053
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
@@ -80,5 +83,5 @@ optimism = ["ethers-core/optimism"]
8083

8184
ledger = ["coins-ledger", "futures", "semver"]
8285
trezor = ["trezor-client", "futures", "semver", "home"]
83-
aws = ["rusoto_core/rustls", "rusoto_kms/rustls", "spki"]
86+
aws = ["aws-config", "aws-sdk-kms", "aws-smithy-runtime-api", "spki"]
8487
yubi = ["yubihsm"]

0 commit comments

Comments
 (0)