feat: Allow creation of secret key from bytes (#224)
This commit is contained in:
parent
a81fc101fe
commit
9fd00a9e5e
1 changed files with 24 additions and 0 deletions
|
|
@ -311,6 +311,30 @@ impl From<[u8; Self::SIZE]> for Signature {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<[u8; Self::SIZE]> for SecretKey {
|
||||
fn from(bytes: [u8; Self::SIZE]) -> Self {
|
||||
Self(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SecretKey> for [u8; SecretKey::SIZE] {
|
||||
fn from(sk: SecretKey) -> Self {
|
||||
sk.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[u8; Self::SIZE]> for SecretKeyExtended {
|
||||
fn from(bytes: [u8; Self::SIZE]) -> Self {
|
||||
Self(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SecretKeyExtended> for [u8; SecretKeyExtended::SIZE] {
|
||||
fn from(ske: SecretKeyExtended) -> Self {
|
||||
ske.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a [u8]> for PublicKey {
|
||||
type Error = TryFromPublicKeyError;
|
||||
fn try_from(value: &'a [u8]) -> Result<Self, Self::Error> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue