Skip to main content

AutoAcceptPolicy

Struct AutoAcceptPolicy 

Source
pub struct AutoAcceptPolicy {
    pub pairing: bool,
    pub pre_pair: bool,
    pub store_share: bool,
    pub verify_share: bool,
    pub discovery: bool,
    pub get_share: bool,
    pub unpair: bool,
    pub update_channel_info: bool,
}
Expand description

Per-flow opt-in for auto-accepting incoming requests.

Default = every field false (no flow auto-accepted; process() emits DeRecEvent::ActionRequired like today). When a field is true, process() invokes the equivalent of super::DeRecProtocol::accept internally and emits DeRecEvent::AutoAccepted in place of DeRecEvent::ActionRequired, followed by the same flow events the caller would have seen from a manual accept.

Wire the policy through super::DeRecProtocolBuilder::with_auto_accept.

§Per-flow notes

  • Self::pairing covers both standard and replica pairing. Standard pairing transitions the channel to Paired immediately; auto-accepting it skips any UI confirmation of “User X wants to pair.” Replica pairing leaves the channel in Pending until both sides run verify_fingerprint(), so auto-accept here is benign (channel is inert until the out-of-band fingerprint match).
  • Self::pre_pair gates the plaintext PrePair leg of HashedKeys pairing. The MITM defence is on the scanner side (binding-hash check) and is unaffected by this flag, but enabling it turns the initiator into a request-amplification oracle: any party that knows the contact’s nonce + channel_id can elicit a key-publish response. Prefer to keep this off unless you control both ends of the transport (LAN, integration tests).
  • Self::unpair is destructive — accepting deletes the local channel record and any shares/secrets associated with it. The DeRecEvent::Unpaired event still fires (after the deletion), so observability is preserved, but the user has no chance to intervene before the data is gone. Apps that want a “are you sure?” gate should keep this off.
  • Self::update_channel_info silently overwrites the stored channel record with the peer’s new transport / communication info. Cryptographically safe (only the paired peer can send it), but a compromised peer key gets weaponised faster — outbound traffic on the channel re-routes to whatever endpoint the peer announced.

All other fields wrap routine request/response flows and have no security-sensitive caveats beyond “the caller decided not to gate them.”

Fields§

§pairing: bool§pre_pair: bool§store_share: bool§verify_share: bool§discovery: bool§get_share: bool§unpair: bool§update_channel_info: bool

Implementations§

Source§

impl AutoAcceptPolicy

Source

pub fn all() -> Self

Enable auto-accept for every flow. Equivalent to setting every field to true — read the field-level docs on AutoAcceptPolicy before using this in production; several flows are state-changing or expose a request-amplification surface.

Source

pub fn allows(&self, action: &PendingAction) -> bool

true when the policy opts in to auto-accepting the given action. Used by super::DeRecProtocol::process at the auto-accept intercept site.

Trait Implementations§

Source§

impl Clone for AutoAcceptPolicy

Source§

fn clone(&self) -> AutoAcceptPolicy

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 Copy for AutoAcceptPolicy

Source§

impl Debug for AutoAcceptPolicy

Source§

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

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

impl Default for AutoAcceptPolicy

Source§

fn default() -> AutoAcceptPolicy

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

impl Eq for AutoAcceptPolicy

Source§

impl PartialEq for AutoAcceptPolicy

Source§

fn eq(&self, other: &AutoAcceptPolicy) -> 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 AutoAcceptPolicy

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V