feat(hlapi): keys can be derefed into their underlying keys

This commit is contained in:
twiby
2023-06-20 14:11:30 +02:00
committed by Thibault Balenbois
parent 8ae799c477
commit 7426e441ba
2 changed files with 14 additions and 0 deletions

View File

@@ -73,6 +73,13 @@ impl ClientKey {
}
}
#[cfg(feature = "integer")]
impl AsRef<crate::integer::ClientKey> for ClientKey {
fn as_ref(&self) -> &crate::integer::ClientKey {
self.integer_key.key.as_ref().unwrap()
}
}
/// Trait to be implemented on the client key types that have a corresponding member
/// in the `ClientKeyChain`.
///

View File

@@ -43,6 +43,13 @@ impl ServerKey {
}
}
#[cfg(feature = "integer")]
impl AsRef<crate::integer::ServerKey> for ServerKey {
fn as_ref(&self) -> &crate::integer::ServerKey {
self.integer_key.key.as_ref().unwrap()
}
}
// By default, serde does not derives Serialize/Deserialize for `Rc` and `Arc` types
// as they can result in mutiple copies, since serializing has to serialize the actual data
// not the pointer.