From 098658dc8b74759416854d2de8497b406a3c0193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Meier?= Date: Sun, 27 Aug 2023 22:28:06 +0200 Subject: [PATCH] ed: Add `SigningKey::as_bytes` (#561) Allows to get a reference to the secret bytes without making a copy. --- ed25519-dalek/src/signing.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ed25519-dalek/src/signing.rs b/ed25519-dalek/src/signing.rs index f89e537..c141e6d 100644 --- a/ed25519-dalek/src/signing.rs +++ b/ed25519-dalek/src/signing.rs @@ -110,6 +110,12 @@ impl SigningKey { self.secret_key } + /// Convert this [`SigningKey`] into a [`SecretKey`] reference + #[inline] + pub fn as_bytes(&self) -> &SecretKey { + &self.secret_key + } + /// Construct a [`SigningKey`] from the bytes of a `VerifyingKey` and `SecretKey`. /// /// # Inputs