mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-19 19:42:19 +02:00
impl Clone for {IdentityKey,IdentityKeyPair} (#5)
This commit is contained in:
parent
9ab28f91ac
commit
6a2a9ace05
@ -38,6 +38,14 @@ impl TryFrom<&[u8]> for IdentityKey {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for IdentityKey {
|
||||
fn clone(&self) -> Self {
|
||||
IdentityKey {
|
||||
public_key: curve::decode_point(&self.public_key.serialize()[..]).expect("Serialization round trips properly"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<T> for IdentityKey
|
||||
where
|
||||
T: curve::PublicKey + 'static,
|
||||
@ -74,6 +82,15 @@ pub struct IdentityKeyPair {
|
||||
private_key: Box<dyn curve::PrivateKey>,
|
||||
}
|
||||
|
||||
impl Clone for IdentityKeyPair {
|
||||
fn clone(&self) -> Self {
|
||||
IdentityKeyPair {
|
||||
identity_key: self.identity_key.clone(),
|
||||
private_key: curve::decode_private_point(&self.private_key.serialize()).expect("Serializion round trips"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IdentityKeyPair {
|
||||
pub fn new(identity_key: IdentityKey, private_key: Box<dyn curve::PrivateKey>) -> Self {
|
||||
Self {
|
||||
|
Loading…
Reference in New Issue
Block a user