feat(secret): add BIP-0032 secp256k1 derivation for Ethereum keys behind feature flag

Fix derive_ethereum_key to use BIP-0032 instead of SLIP-0010, which
incorrectly handled unhardened indices in the Ethereum path m/44'/60'/0'/0/0.
This commit is contained in:
2026-06-10 07:29:05 +00:00
parent 7bf0538416
commit f4cacdbcaf
4 changed files with 328 additions and 19 deletions

View File

@@ -26,6 +26,7 @@
//! - [`encryption`] — AES-256-GCM encrypt/decrypt and `EncryptedData` type
//! - [`protocol`] — `SecretProtocol` irpc service enum, `DerivedKey`, `KeyType`
//! - [`service`] — `SecretService` implementation with Unlock/Lock lifecycle
//! - [`ethereum`] — BIP-0032 secp256k1 HD key derivation (behind `secp256k1` feature)
pub mod derivation;
pub mod encryption;
@@ -33,9 +34,15 @@ pub mod mnemonic;
pub mod protocol;
pub mod service;
#[cfg(feature = "secp256k1")]
pub mod ethereum;
// Re-export primary public API
pub use derivation::{ExtendedPrivKey, PATHS};
pub use derivation::{DerivationError, ExtendedPrivKey, PATHS};
pub use encryption::{EncryptedData, EncryptionError};
pub use mnemonic::{Language, Mnemonic, Seed};
pub use protocol::{DerivedKey, KeyType, SecretMessage, SecretProtocol};
pub use service::{SecretService, SecretServiceError, SecretServiceHandle};
#[cfg(feature = "secp256k1")]
pub use ethereum::Secp256k1ExtendedPrivKey;