Skip to content

Commit

Permalink
add missing keypair functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Oct 16, 2024
1 parent 93fa716 commit 3d918cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions identity/src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ impl Keypair {
self.try_into()
}

#[cfg(feature = "sr25519")]
pub fn try_into_sr25519(self) -> Result<sr25519::Keypair, OtherVariantError> {
self.try_into()
}

#[cfg(feature = "secp256k1")]
pub fn try_into_secp256k1(self) -> Result<secp256k1::Keypair, OtherVariantError> {
self.try_into()
Expand Down
4 changes: 4 additions & 0 deletions identity/src/sr25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ impl SecretKey {
Ok(SecretKey(secret))
}

pub fn inner_key(&self) -> &RistrettoSecretKey {
&self.0
}

// Not great, leaves the secret key in stack memory (all key types not just Sr25519)
pub(crate) fn to_bytes(&self) -> [u8; 32] {
let mut buf = [0u8; 32];
Expand Down

0 comments on commit 3d918cc

Please sign in to comment.