Struct PreflightRequest

Source
pub struct PreflightRequest {
    pub app_entry_hash: HoloHash<Entry>,
    pub signing_agents: Vec<(HoloHash<Agent>, Vec<Role>)>,
    pub optional_signing_agents: Vec<(HoloHash<Agent>, Vec<Role>)>,
    pub minimum_optional_signing_agents: u8,
    pub enzymatic: bool,
    pub session_times: CounterSigningSessionTimes,
    pub action_base: ActionBase,
    pub preflight_bytes: PreflightBytes,
}
Expand description

The same PreflightRequest is sent to every agent. Each agent signs this data as part of their PreflightResponse. Every preflight must be identical and signed by every agent for a session to be valid.

Fields§

§app_entry_hash: HoloHash<Entry>

The hash of the app entry, as if it were not countersigned. The final entry hash will include the countersigning session.

§signing_agents: Vec<(HoloHash<Agent>, Vec<Role>)>

The agents that are participating in this countersignature session.

§optional_signing_agents: Vec<(HoloHash<Agent>, Vec<Role>)>

The optional additional M of N signers. If there are additional signers then M MUST be the majority of N. If there are additional signers then the enzyme MUST be used and is the first signer in BOTH signing_agents and optional_signing_agents.

§minimum_optional_signing_agents: u8

The M in the M of N signers. M MUST be strictly greater than N / 2 and NOT larger than N.

§enzymatic: bool

The first signing agent (index 0) is acting as an enzyme. If true AND optional_signing_agents are set then the first agent MUST be the same in both signing_agents and optional_signing_agents.

§session_times: CounterSigningSessionTimes

The session times. Session actions must all have the same timestamp, which is the session offset.

§action_base: ActionBase

The action information that is shared by all agents. Contents depend on the action type, create, update, etc.

§preflight_bytes: PreflightBytes

The preflight bytes for session.

Implementations§

Source§

impl PreflightRequest

Source

pub fn try_new( app_entry_hash: HoloHash<Entry>, signing_agents: Vec<(HoloHash<Agent>, Vec<Role>)>, optional_signing_agents: Vec<(HoloHash<Agent>, Vec<Role>)>, minimum_optional_signing_agents: u8, enzymatic: bool, session_times: CounterSigningSessionTimes, action_base: ActionBase, preflight_bytes: PreflightBytes, ) -> Result<PreflightRequest, CounterSigningError>

Fallible constructor.

Source

pub fn check_integrity(&self) -> Result<(), CounterSigningError>

Combined integrity checks.

Source

pub fn check_agents_dupes(&self) -> Result<(), CounterSigningError>

Verify there are no duplicate agents to sign.

Source

pub fn check_agents_len(&self) -> Result<(), CounterSigningError>

Verify the number of signing agents is within the correct range.

Source

pub fn check_agents_optional(&self) -> Result<(), CounterSigningError>

Verify the optional signing agents.

Source

pub fn check_agents(&self) -> Result<(), CounterSigningError>

Verify the preflight request agents.

Source

pub fn check_enzyme(&self) -> Result<(), CounterSigningError>

Verify everything about the enzyme.

Source

pub fn fingerprint(&self) -> Result<Vec<u8>, SerializedBytesError>

Compute a fingerprint for this preflight request.

Trait Implementations§

Source§

impl Clone for PreflightRequest

Source§

fn clone(&self) -> PreflightRequest

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PreflightRequest

Source§

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

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

impl<'de> Deserialize<'de> for PreflightRequest

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<PreflightRequest, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for PreflightRequest

Source§

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

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 PreflightRequest

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PreflightRequest

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for PreflightRequest

Source§

impl StructuralPartialEq for PreflightRequest

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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> 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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,