Struct Path

Source
pub struct Path { /* private fields */ }
Expand description

A path in a Network.

A path is a sequence of Certifications where the target of a certification is the issuer of the next certification. Paths are built up gradually using Path::try_append. As such, a Path may just be a path prefix. For this reason, the regular expression constraint is not enforced. However, the Path implementation does guarantee that the target of a certification is the issuer of the next certification in the path.

Implementations§

Source§

impl Path

Source

pub fn new<C>(root: C) -> Self
where C: Into<CertSynopsis>,

Instantiates a path starting at the specified root.

We assume that the root is ultimately trusted (its trust depth is unlimited and its trust amount is maximal).

Source

pub fn set_certification_network(&mut self, certification_network: bool)

Controls how path validity is determined.

In a certification network, trust depth and regular expressions are ignored and a certification isn’t just used to validate a binding, but also to designate the target certificate as a trusted introducer.

Source

pub fn certification_network(&self) -> bool

Returns how path validity is determined.

In a certification network, trust depth and regular expressions are ignored and a certification isn’t just used to validate a binding, but also to designate the target certificate as a trusted introducer.

Source

pub fn root(&self) -> &CertSynopsis

Returns the path’s root.

Source

pub fn target(&self) -> &CertSynopsis

Returns the last node in the path.

Source

pub fn certificates( &self, ) -> impl Iterator<Item = &CertSynopsis> + DoubleEndedIterator

Returns an iterator over the path’s certificates (the nodes).

The certificates are returned from the root towards the target.

Source

pub fn len(&self) -> usize

Returns the number of nodes in the path.

Source

pub fn certifications(&self) -> impl Iterator<Item = &Certification>

Returns the certifications.

The certifications are returned from the root towards the target.

Source

pub fn residual_depth(&self) -> Depth

Returns the residual trust depth.

The residual trust depth is calculated by taking the trust depth of root and reducing it by one for each certification in the path. If passing a certification with a lower trust depth than the current trust value, the lower value is used from that point on.

Source

pub fn amount(&self) -> usize

Returns the amount that the target is trusted.

120 usually means fully trusted. This function checks that each certification’s depth parameter is sufficient for the rest of the path. It does not check any regular expressions, as the regular expressions only apply to the User ID being authenticated, and that may not yet have been added to the path (i.e., the path may be a path prefix).

Source

pub fn append(&mut self, certification: Certification) -> Result<()>

Appends the certification to the path.

This checks that the target of the last certification is the issuer of the new certification, but it does not check the depth constraints, nor does it check for cycles. To ensure that the path is a valid path prefix, use Path::try_append instead.

Source

pub fn try_append(&mut self, certification: Certification) -> Result<()>

Appends the certification to the path if the path allows it.

This will fail if the trust depth is insufficient, or adding the certificate would induce a cycle. This function does not check any regular expressions, as the regular expressions only apply to the User ID being authenticated, and that may not yet have been added to the path (i.e., the path may be a path prefix).

Source

pub fn self_signature(&self) -> bool

Returns whether the path describes a self signature.

Trait Implementations§

Source§

impl Clone for Path

Source§

fn clone(&self) -> Path

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Path

Source§

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

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

impl<'a> From<&Path> for PathLints<'a>

Source§

fn from(path: &Path) -> PathLints<'a>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Path

§

impl RefUnwindSafe for Path

§

impl Send for Path

§

impl Sync for Path

§

impl Unpin for Path

§

impl UnwindSafe for Path

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<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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<T> ErasedDestructor for T
where T: 'static,