#[non_exhaustive]pub enum PublicKey {
Ed25519(VerifyingKey),
}Expand description
Algorithm-agnostic public key for signature verification.
Wraps algorithm-specific verifying key types in a single enum, enabling crypto-agility while maintaining zero-cost dispatch for the common Ed25519 case.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Ed25519(VerifyingKey)
Ed25519 public key (32 bytes)
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn verify(&self, data: &[u8], signature: &[u8]) -> Result<(), AuthError>
pub fn verify(&self, data: &[u8], signature: &[u8]) -> Result<(), AuthError>
Verify a signature over the given data.
Returns Ok(()) if the signature is valid, or Err if verification
fails for any reason (malformed signature, wrong key, etc.).
Sourcepub fn to_prefixed_string(&self) -> String
pub fn to_prefixed_string(&self) -> String
Format the public key as a prefixed string (e.g. "ed25519:base64...").
Sourcepub fn from_prefixed_string(s: &str) -> Result<Self, AuthError>
pub fn from_prefixed_string(s: &str) -> Result<Self, AuthError>
Parse a public key from a prefixed string (e.g. "ed25519:base64...").
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PublicKey
Deserializes from the prefixed string format (e.g. "ed25519:base64...").
impl<'de> Deserialize<'de> for PublicKey
Deserializes from the prefixed string format (e.g. "ed25519:base64...").
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for PublicKey
Serializes as the prefixed string format (e.g. "ed25519:base64...").
impl Serialize for PublicKey
Serializes as the prefixed string format (e.g. "ed25519:base64...").
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,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.