arnaucube
arnaucube/arkeddsaPublic Self-hosted repository
export secret
kilic onurkilic1004@gmail.com
Fri, 02 Aug 2024 14:01:59 +0300
commit

27f3058df3ce4aedc394b852e06637968bd73c7f

parent

6988f0bfaafce44550826acc6690fe0815e04633

1 files changed, 7 insertions(+), 3 deletions(-)

jump to
M src/eddsa.rs → src/eddsa.rs

@@ -38,8 +38,8 @@ pub fn to_bytes(&self) -> [u8; 32] {

self.0 } - pub fn from_bytes(bytes: [u8; 32]) -> Self { - Self(bytes) + pub fn from_bytes(bytes: &[u8; 32]) -> Self { + Self(bytes.clone()) } }

@@ -91,9 +91,13 @@

Ok(signing_key) } - pub fn from_bytes<D: Digest>(bytes: [u8; 32]) -> Result<Self, Error> { + pub fn from_bytes<D: Digest>(bytes: &[u8; 32]) -> Result<Self, Error> { let secret_key = SecretKey::from_bytes(bytes); Self::new::<D>(&secret_key) + } + + pub fn to_bytes(&self) -> [u8; 32] { + self.secret_key.to_bytes() } pub fn generate<D: Digest>(rng: &mut impl CryptoRngCore) -> Result<Self, Error> {