pub struct HsDesc { /* private fields */ }
hs-common
only.Expand description
A decrypted, decoded onion service descriptor.
This object includes information from both the outer (plaintext) document of the descriptor, and the inner (encrypted) documents. It tells the client the information it needs to contact the onion service, including necessary introduction points and public keys.
Implementations§
Source§impl HsDesc
impl HsDesc
Sourcepub fn parse(
input: &str,
blinded_onion_id: &HsBlindId,
) -> Result<UncheckedEncryptedHsDesc>
pub fn parse( input: &str, blinded_onion_id: &HsBlindId, ) -> Result<UncheckedEncryptedHsDesc>
Parse the outermost document of the descriptor in input
, and validate
that its identity is consistent with blinded_onion_id
.
On success, the caller will get a wrapped object which they must validate and then decrypt.
Use HsDesc::parse_decrypt_validate
if you just need an HsDesc
and don’t want to
handle the validation/decryption of the wrapped object yourself.
§Example
// Parse the descriptor
let unchecked_desc = HsDesc::parse(unparsed_desc, &blinded_id)?;
// Validate the signature and timeliness of the outer document
let checked_desc = unchecked_desc
.check_signature()?
.check_valid_at(×tamp)?;
// Decrypt the outer and inner layers of the descriptor
let unchecked_decrypted_desc = checked_desc.decrypt(&subcredential, None)?;
// Validate the signature and timeliness of the inner document
let hsdesc = unchecked_decrypted_desc
.check_valid_at(×tamp)?
.check_signature()?;
Sourcepub fn parse_decrypt_validate(
input: &str,
blinded_onion_id: &HsBlindId,
valid_at: SystemTime,
subcredential: &Subcredential,
hsc_desc_enc: Option<&HsClientDescEncKeypair>,
) -> StdResult<TimerangeBound<Self>, HsDescError>
pub fn parse_decrypt_validate( input: &str, blinded_onion_id: &HsBlindId, valid_at: SystemTime, subcredential: &Subcredential, hsc_desc_enc: Option<&HsClientDescEncKeypair>, ) -> StdResult<TimerangeBound<Self>, HsDescError>
A convenience function for parsing, decrypting and validating HS descriptors.
This function:
- parses the outermost document of the descriptor in
input
, and validates that its identity is consistent withblinded_onion_id
. - decrypts both layers of encryption in the onion service descriptor. If
hsc_desc_enc
is provided, we use it to decrypt the inner encryption layer; otherwise, we require that the inner document is encrypted using the “no restricted discovery” method. - checks if both layers are valid at the
valid_at
timestamp - validates the signatures on both layers
Returns an error if the descriptor cannot be parsed, or if one of the validation steps fails.
Sourcepub fn intro_points(&self) -> &[IntroPointDesc]
pub fn intro_points(&self) -> &[IntroPointDesc]
One or more introduction points used to contact the onion service.
Always returns at least one introduction point,
and never more than NUM_INTRO_POINT_MAX
.
(Descriptors which have fewer or more are dealt with during parsing.)
Accessor function.
Sourcepub fn is_single_onion_service(&self) -> bool
pub fn is_single_onion_service(&self) -> bool
Return true if this onion service claims to be a non-anonymous “single onion service”.
(We should always anonymize our own connection to an onion service.)
Sourcepub fn requires_intro_authentication(&self) -> bool
pub fn requires_intro_authentication(&self) -> bool
Return true if this onion service claims that it needs user authentication of some kind in its INTRODUCE messages.
(Arti does not currently support sending this kind of authentication.)
Sourcepub fn pow_params(&self) -> &[PowParams]
pub fn pow_params(&self) -> &[PowParams]
Get a list of offered proof-of-work parameters, at most one per type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HsDesc
impl RefUnwindSafe for HsDesc
impl Send for HsDesc
impl Sync for HsDesc
impl Unpin for HsDesc
impl UnwindSafe for HsDesc
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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>
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>
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