mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-25 08:51:20 +00:00
refactor(identity): leverage Copy
impl for ed25519 public key
No need for function calls to `to_bytes` and `from_bytes` if the type is `Copy`. Related: #3649. Pull-Request: #3706.
This commit is contained in:
parent
972ba4ca08
commit
75f967f4da
@ -89,9 +89,11 @@ impl Clone for Keypair {
|
||||
let secret = SecretKey::from_bytes(&mut sk_bytes)
|
||||
.expect("ed25519::SecretKey::from_bytes(to_bytes(k)) != k")
|
||||
.0;
|
||||
let public = ed25519::PublicKey::from_bytes(&self.0.public.to_bytes())
|
||||
.expect("ed25519::PublicKey::from_bytes(to_bytes(k)) != k");
|
||||
Keypair(ed25519::Keypair { secret, public })
|
||||
|
||||
Keypair(ed25519::Keypair {
|
||||
secret,
|
||||
public: self.0.public,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user