mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 01:21:21 +00:00
to/into consistency for PublicKey and PeerId (#2145)
- Change `PublicKey::into_protobuf_encoding` to `PublicKey::to_protobuf_encoding`. - Change `PublicKey::into_peer_id` to `PublicKey::to_peer_id`. - Change `PeerId::from_public_key(PublicKey)` to `PeerId::from_public_key(&PublicKey)`. - Add `From<&PublicKey> for PeerId`. Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -169,7 +169,7 @@ impl From<MessageAuthenticity> for PublishConfig {
|
||||
match authenticity {
|
||||
MessageAuthenticity::Signed(keypair) => {
|
||||
let public_key = keypair.public();
|
||||
let key_enc = public_key.clone().into_protobuf_encoding();
|
||||
let key_enc = public_key.to_protobuf_encoding();
|
||||
let key = if key_enc.len() <= 42 {
|
||||
// The public key can be inlined in [`rpc_proto::Message::from`], so we don't include it
|
||||
// specifically in the [`rpc_proto::Message::key`] field.
|
||||
@ -181,7 +181,7 @@ impl From<MessageAuthenticity> for PublishConfig {
|
||||
|
||||
PublishConfig::Signing {
|
||||
keypair,
|
||||
author: public_key.into_peer_id(),
|
||||
author: public_key.to_peer_id(),
|
||||
inline_key: key,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user