Add as_bytes() method

This commit is contained in:
dlblv 2022-12-19 21:30:09 +05:00
parent 53bb1a3989
commit 50dbb9eb4d

View file

@ -190,6 +190,11 @@ impl StaticSecret {
pub fn to_bytes(&self) -> [u8; 32] { pub fn to_bytes(&self) -> [u8; 32] {
self.0.to_bytes() self.0.to_bytes()
} }
/// View this key as a byte array.
pub fn as_bytes(&self) -> &[u8; 32] {
self.0.as_bytes()
}
} }
impl From<[u8; 32]> for StaticSecret { impl From<[u8; 32]> for StaticSecret {