Skip to content

Commit

Permalink
Remove ed25519_public_key_to_address
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Jan 6, 2025
1 parent 7d8297d commit e58005e
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions xmtp_cryptography/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,6 @@ pub fn h160addr_to_string(bytes: H160) -> String {
s.to_lowercase()
}

// This should ONLY be used for ed25519 keys, not ethereum/secp256k1 keys.
// See: https://sourcegraph.com/github.com/gakonst/ethers-rs@40cc8cc54f7d36aa24147c937772600e5b119399/-/blob/ethers-core/src/types/signature.rs?L110-111
pub fn ed25519_public_key_to_address(bytes: &[u8]) -> String {
let hash = ethers::utils::keccak256(bytes);
let mut s = String::from("x:"); // TODO verify XMTP installation addressing scheme
s.push_str(&hex::encode(&hash[12..]));
s
}

/// Check if an string is a valid ethereum address (valid hex and length 20).
pub fn is_valid_ethereum_address<S: AsRef<str>>(address: S) -> bool {
let address = address.as_ref();
Expand Down

0 comments on commit e58005e

Please sign in to comment.