Struct tor_client_lib::key::TorServiceId
source · pub struct TorServiceId(/* private fields */);Expand description
The service ID for the onion service.
Basically the service ID is the part of the onion address before the “.onion” part. This is an encoding of the onion service’s public key into a string. As such, you can convert from the service ID to the public key, and vice-versa.
Implementations§
source§impl TorServiceId
impl TorServiceId
sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a new ED25519 public key, and the corresponding TorServiceId
sourcepub fn verifying_key(&self) -> Result<VerifyingKey, TorError>
pub fn verifying_key(&self) -> Result<VerifyingKey, TorError>
Retrieve the public ED25519 verifying key from the TorServiceId
pub fn as_str(&self) -> &str
sourcepub fn onion_hostname(&self) -> String
pub fn onion_hostname(&self) -> String
Generate the corresponding onion hostname (by tacking on the “.onion” part)
Trait Implementations§
source§impl Clone for TorServiceId
impl Clone for TorServiceId
source§fn clone(&self) -> TorServiceId
fn clone(&self) -> TorServiceId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for TorServiceId
impl Debug for TorServiceId
source§impl<'de> Deserialize<'de> for TorServiceId
impl<'de> Deserialize<'de> for TorServiceId
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 Display for TorServiceId
impl Display for TorServiceId
source§impl From<TorServiceId> for String
impl From<TorServiceId> for String
Convert the service ID to a String
source§fn from(id: TorServiceId) -> String
fn from(id: TorServiceId) -> String
source§impl From<VerifyingKey> for TorServiceId
impl From<VerifyingKey> for TorServiceId
Generate the Tor service ID from an ed25519_dalek verifying (public) key From section 6 of https://github.com/torproject/torspec/blob/main/rend-spec-v3.txt
source§fn from(verifying_key: VerifyingKey) -> Self
fn from(verifying_key: VerifyingKey) -> Self
source§impl FromStr for TorServiceId
impl FromStr for TorServiceId
Parse a String into a service ID. Note that this does a good bit of verification that the service ID is indeed a service ID
source§impl Hash for TorServiceId
impl Hash for TorServiceId
source§impl Ord for TorServiceId
impl Ord for TorServiceId
source§fn cmp(&self, other: &TorServiceId) -> Ordering
fn cmp(&self, other: &TorServiceId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for TorServiceId
impl PartialEq for TorServiceId
source§fn eq(&self, other: &TorServiceId) -> bool
fn eq(&self, other: &TorServiceId) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for TorServiceId
impl PartialOrd for TorServiceId
source§fn partial_cmp(&self, other: &TorServiceId) -> Option<Ordering>
fn partial_cmp(&self, other: &TorServiceId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more