pub enum PublicKey {
Ed25519(PublicKey),
}
Expand description
The public key of a node’s identity keypair.
Variants§
Implementations§
source§impl PublicKey
impl PublicKey
sourcepub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
pub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
Verify a signature for a message using this public key, i.e. check that the signature has been produced by the corresponding private key (authenticity), and that the message has not been tampered with (integrity).
sourcepub fn to_protobuf_encoding(&self) -> Vec<u8> ⓘ
pub fn to_protobuf_encoding(&self) -> Vec<u8> ⓘ
Encode the public key into a protobuf structure for storage or exchange with other nodes.
sourcepub fn from_protobuf_encoding(bytes: &[u8]) -> Result<PublicKey, ParseError>
pub fn from_protobuf_encoding(bytes: &[u8]) -> Result<PublicKey, ParseError>
Decode a public key from a protobuf structure, e.g. read from storage or received from another node.
sourcepub fn to_peer_id(&self) -> PeerId
pub fn to_peer_id(&self) -> PeerId
Convert the PublicKey
into the corresponding PeerId
.
Trait Implementations§
source§impl PartialEq for PublicKey
impl PartialEq for PublicKey
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.