Struct relay_auth::PublicKey
source · pub struct PublicKey { /* private fields */ }
Expand description
Represents the public key of a Relay.
Public keys are based on ed25519 but this should be considered an implementation detail for now. We only ever represent public keys on the wire as opaque ascii encoded strings of arbitrary format or length.
Implementations§
source§impl PublicKey
impl PublicKey
sourcepub fn verify_meta(&self, data: &[u8], sig: &str) -> Option<SignatureHeader>
pub fn verify_meta(&self, data: &[u8], sig: &str) -> Option<SignatureHeader>
Verifies the signature and returns the embedded signature header.
sourcepub fn verify(&self, data: &[u8], sig: &str) -> bool
pub fn verify(&self, data: &[u8], sig: &str) -> bool
Verifies a signature but discards the header.
sourcepub fn verify_timestamp(
&self,
data: &[u8],
sig: &str,
max_age: Option<Duration>,
) -> bool
pub fn verify_timestamp( &self, data: &[u8], sig: &str, max_age: Option<Duration>, ) -> bool
Verifies a signature and checks the timestamp.
sourcepub fn unpack_meta<D: DeserializeOwned>(
&self,
data: &[u8],
signature: &str,
) -> Result<(SignatureHeader, D), UnpackError>
pub fn unpack_meta<D: DeserializeOwned>( &self, data: &[u8], signature: &str, ) -> Result<(SignatureHeader, D), UnpackError>
Unpacks signed data and returns it with header.
sourcepub fn unpack<D: DeserializeOwned>(
&self,
data: &[u8],
signature: &str,
max_age: Option<Duration>,
) -> Result<D, UnpackError>
pub fn unpack<D: DeserializeOwned>( &self, data: &[u8], signature: &str, max_age: Option<Duration>, ) -> Result<D, UnpackError>
Unpacks the data and verifies that it’s not too old, then throws away the wrapper.
If no max_age
is set, the embedded timestamp does not get validated.
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>,
Deserialize this value from the given Serde deserializer. Read more
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)