Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions signer/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ impl Keypair {
PublicKey(self.0.public_key().serialize())
}

/// Obtain the [`SecretKey`] part of this key pair. This should be kept secret.
pub fn secret_key(&self) -> SecretKeyBytes {
*self.0.secret_key().as_ref()
}

/// Sign some message. These bytes can be used directly in a Substrate `MultiSignature::Ecdsa(..)`.
pub fn sign(&self, message: &[u8]) -> Signature {
self.sign_prehashed(&sp_crypto_hashing::blake2_256(message))
Expand Down
5 changes: 5 additions & 0 deletions signer/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ impl Keypair {
.map_err(|_| Error::InvalidSeed)
}

/// Obtain the [`ecdsa::SecretKeyBytes`] of this keypair.
pub fn secret_key(&self) -> SecretKeyBytes {
self.0.secret_key()
}

/// Obtain the [`eth::PublicKey`] of this keypair.
pub fn public_key(&self) -> PublicKey {
let uncompressed = self.0 .0.public_key().serialize_uncompressed();
Expand Down