use zeroize::Zeroizing;
pub struct SecretKey(Zeroizing<[u8; 32]>);
impl SecretKey {
pub(crate) fn as_bytes(&self) -> &[u8; 32] {
&self.0
}
}
impl From<[u8; 32]> for SecretKey {
fn from(bytes: [u8; 32]) -> Self {
Self(Zeroizing::new(bytes))
}
}
pub struct MasterKey(pub(crate) Zeroizing<[u8; 32]>);
impl MasterKey {
pub(crate) fn from_bytes(bytes: [u8; 32]) -> Self {
Self(Zeroizing::new(bytes))
}
pub(crate) fn as_bytes(&self) -> &[u8; 32] {
&self.0
}
}
impl Clone for MasterKey {
fn clone(&self) -> Self {
Self(Zeroizing::new(*self.0))
}
}
pub struct DerivedKey(pub(crate) Zeroizing<[u8; 32]>);
impl DerivedKey {
pub(crate) fn from_bytes(bytes: [u8; 32]) -> Self {
Self(Zeroizing::new(bytes))
}
pub(crate) fn as_bytes(&self) -> &[u8; 32] {
&self.0
}
}
impl Clone for DerivedKey {
fn clone(&self) -> Self {
Self(Zeroizing::new(*self.0))
}
}