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::pairingcovers both standard and replica pairing. Standard pairing transitions the channel toPairedimmediately; auto-accepting it skips any UI confirmation of “User X wants to pair.” Replica pairing leaves the channel inPendinguntil both sides runverify_fingerprint(), so auto-accept here is benign (channel is inert until the out-of-band fingerprint match).Self::pre_pairgates the plaintextPrePairleg 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’snonce+channel_idcan elicit a key-publish response. Prefer to keep this off unless you control both ends of the transport (LAN, integration tests).Self::unpairis destructive — accepting deletes the local channel record and any shares/secrets associated with it. TheDeRecEvent::Unpairedevent 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_infosilently 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§discovery: bool§unpair: bool§update_channel_info: boolImplementations§
Source§impl AutoAcceptPolicy
impl AutoAcceptPolicy
Sourcepub fn all() -> Self
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.
Sourcepub fn allows(&self, action: &PendingAction) -> bool
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
impl Clone for AutoAcceptPolicy
Source§fn clone(&self) -> AutoAcceptPolicy
fn clone(&self) -> AutoAcceptPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AutoAcceptPolicy
Source§impl Debug for AutoAcceptPolicy
impl Debug for AutoAcceptPolicy
Source§impl Default for AutoAcceptPolicy
impl Default for AutoAcceptPolicy
Source§fn default() -> AutoAcceptPolicy
fn default() -> AutoAcceptPolicy
impl Eq for AutoAcceptPolicy
Source§impl PartialEq for AutoAcceptPolicy
impl PartialEq for AutoAcceptPolicy
impl StructuralPartialEq for AutoAcceptPolicy
Auto Trait Implementations§
impl Freeze for AutoAcceptPolicy
impl RefUnwindSafe for AutoAcceptPolicy
impl Send for AutoAcceptPolicy
impl Sync for AutoAcceptPolicy
impl Unpin for AutoAcceptPolicy
impl UnsafeUnpin for AutoAcceptPolicy
impl UnwindSafe for AutoAcceptPolicy
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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