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(
&self,
data: &[u8],
sig: SignatureRef<'_>,
start_time: DateTime<Utc>,
max_age: Duration,
) -> Result<VerifiedSignatureHeader, SignatureError>
pub fn verify( &self, data: &[u8], sig: SignatureRef<'_>, start_time: DateTime<Utc>, max_age: Duration, ) -> Result<VerifiedSignatureHeader, SignatureError>
Verifies the signature and returns the embedded signature header.
Returns SignatureError when the signature cannot be verified.
Sourcepub fn unpack<D: DeserializeOwned>(
&self,
data: &[u8],
signature: SignatureRef<'_>,
start_time: DateTime<Utc>,
max_age_diff: Duration,
) -> Result<D, UnpackError>
pub fn unpack<D: DeserializeOwned>( &self, data: &[u8], signature: SignatureRef<'_>, start_time: DateTime<Utc>, max_age_diff: Duration, ) -> Result<D, UnpackError>
Unpacks signed data and returns it with header.
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 UnsafeUnpin 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