pub struct PublicKey(/* private fields */);key only.Expand description
A public key.
The key itself is stored as the CompressedEdwards y coordinate of the public key
It is verified to decompress into a valid key when created.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub const LENGTH: usize = ed25519_dalek::PUBLIC_KEY_LENGTH
pub const LENGTH: usize = ed25519_dalek::PUBLIC_KEY_LENGTH
The length of an ed25519 PublicKey, in bytes.
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Result<Self, KeyParsingError>
pub fn from_bytes(bytes: &[u8; 32]) -> Result<Self, KeyParsingError>
Construct a PublicKey from a slice of bytes.
§Warning
This will return a SignatureError if the bytes passed into this method do not represent
a valid ed25519_dalek curve point. Will never fail for bytes return from Self::as_bytes.
See VerifyingKey::from_bytes for details.
Sourcepub fn verify(
&self,
message: &[u8],
signature: &Signature,
) -> Result<(), SignatureError>
pub fn verify( &self, message: &[u8], signature: &Signature, ) -> Result<(), SignatureError>
Verify a signature on a message with this secret key’s public key.
§Return
Returns Ok(()) if the signature is valid, and Err otherwise.
Sourcepub fn fmt_short(&self) -> impl Display + Copy + 'static
pub fn fmt_short(&self) -> impl Display + Copy + 'static
Convert to a hex string limited to the first 5 bytes for a friendly string representation of the key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl From<PublicKey> for EndpointAddr
impl From<PublicKey> for EndpointAddr
Source§fn from(endpoint_id: EndpointId) -> Self
fn from(endpoint_id: EndpointId) -> Self
Source§impl FromStr for PublicKey
Deserialises the PublicKey from it’s base32 encoding.
impl FromStr for PublicKey
Deserialises the PublicKey from it’s base32 encoding.
Display is capable of serialising this format.