From 3d918ccbf5ae1cbec0815a2156079b0fba4ba558 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Wed, 16 Oct 2024 08:36:26 +0400 Subject: [PATCH] add missing keypair functions --- identity/src/keypair.rs | 5 +++++ identity/src/sr25519.rs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/identity/src/keypair.rs b/identity/src/keypair.rs index 4cb4c4f2a9c..48530f668b5 100644 --- a/identity/src/keypair.rs +++ b/identity/src/keypair.rs @@ -147,6 +147,11 @@ impl Keypair { self.try_into() } + #[cfg(feature = "sr25519")] + pub fn try_into_sr25519(self) -> Result { + self.try_into() + } + #[cfg(feature = "secp256k1")] pub fn try_into_secp256k1(self) -> Result { self.try_into() diff --git a/identity/src/sr25519.rs b/identity/src/sr25519.rs index d8b4962fa52..717192468eb 100644 --- a/identity/src/sr25519.rs +++ b/identity/src/sr25519.rs @@ -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];