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:
Thomas Eizinger 2023-03-30 13:07:37 +02:00 committed by GitHub
parent 972ba4ca08
commit 75f967f4da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,
})
}
}