Skip to main content

Trust

Struct Trust 

Source
pub struct Trust {
    pub anchors: Vec<Pem>,
    pub pins: Vec<Fingerprint>,
}
Expand description

Whom a peer is accepted as.

A peer is accepted if its public-key fingerprint is one of pins, or its certificate chains to one of anchors and names the host that was dialled. An address that names a fingerprint (weida://sha256:…@host:port/path) overrides both: only that identity is accepted on that connection.

An empty Trust — Trust::by_address — accepts nothing but what the address names. Dialling an address without a fingerprint under it fails before any packet is sent. There is no platform root store and no verification bypass anywhere in the shipped code.

Fields§

§anchors: Vec<Pem>

PEM sources holding certificate-authority certificates.

§pins: Vec<Fingerprint>

Public-key fingerprints accepted outright.

Implementations§

Source§

impl Trust

Source

pub fn by_address() -> Trust

Trust only what each dialled address names.

Source

pub fn pin(fingerprint: Fingerprint) -> Trust

Trust one public-key fingerprint.

Source

pub fn anchor(pem: impl Into<Vec<u8>>) -> Trust

Trust the certificate authorities in one PEM buffer.

Source

pub fn anchor_file(path: impl Into<PathBuf>) -> Trust

Trust the certificate authorities in one PEM file.

Source

pub fn and_pin(self, fingerprint: Fingerprint) -> Trust

Adds a fingerprint.

Source

pub fn and_anchor(self, pem: impl Into<Vec<u8>>) -> Trust

Adds the certificate authorities in a PEM buffer.

Source

pub fn and_anchor_file(self, path: impl Into<PathBuf>) -> Trust

Adds the certificate authorities in a PEM file.

Source

pub fn is_empty(&self) -> bool

True when nothing is trusted beyond what an address names.

Trait Implementations§

Source§

impl Clone for Trust

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trust

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Trust

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Trust

Source§

impl From<Trust> for ClientTls

Source§

fn from(trust: Trust) -> ClientTls

Converts to this type from the input type.
Source§

impl From<Trust> for ClientTrust

Source§

fn from(trust: Trust) -> ClientTrust

Converts to this type from the input type.
Source§

impl From<Trust> for TrustSource

Source§

fn from(trust: Trust) -> TrustSource

Converts to this type from the input type.
Source§

impl Hash for Trust

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Trust

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Trust

Auto Trait Implementations§

§

impl Freeze for Trust

§

impl RefUnwindSafe for Trust

§

impl Send for Trust

§

impl Sync for Trust

§

impl Unpin for Trust

§

impl UnsafeUnpin for Trust

§

impl UnwindSafe for Trust

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more