Skip to main content

DefaultRecoveryPolicy

Struct DefaultRecoveryPolicy 

Source
pub struct DefaultRecoveryPolicy {
    pub reset_token_ttl: Duration,
    pub request_rate_limit: (u32, Duration),
    pub consume_rate_limit: (u32, Duration),
    pub strict_mailer_required: bool,
}
Expand description

Length-only / rate-limit-only baseline policy. Public fields plus chainable with_* setters so projects that want to tweak one knob don’t need to author a full trait impl.

Fields§

§reset_token_ttl: Duration§request_rate_limit: (u32, Duration)§consume_rate_limit: (u32, Duration)§strict_mailer_required: bool

Implementations§

Source§

impl DefaultRecoveryPolicy

Source

pub fn new() -> Self

New policy with the framework’s locked defaults (DESIGN_RECOVERY.md §17): TTL 1h, request 5/15min, consume 10/5min, strict-mailer guard off.

Source

pub fn with_reset_token_ttl(self, ttl: ChronoDuration) -> Self

Override the reset-token TTL. Projects that want shorter blast-radius windows pass Duration::minutes(30); projects that need user-friendlier deadlines pass Duration::hours(2).

Source

pub fn with_request_rate_limit(self, capacity: u32, window: StdDuration) -> Self

Override the request-endpoint rate-limit shape.

Source

pub fn with_consume_rate_limit(self, capacity: u32, window: StdDuration) -> Self

Override the consume-endpoint rate-limit shape.

Source

pub fn with_strict_mailer_required(self, required: bool) -> Self

Toggle the strict-mailer boot guard. When true, R1’s boot sequence (commits #7+) refuses to start with the default LogMailer. Default false.

Trait Implementations§

Source§

impl Clone for DefaultRecoveryPolicy

Source§

fn clone(&self) -> DefaultRecoveryPolicy

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 DefaultRecoveryPolicy

Source§

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

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

impl Default for DefaultRecoveryPolicy

Source§

fn default() -> Self

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

impl RecoveryPolicy for DefaultRecoveryPolicy

Source§

fn reset_token_ttl(&self) -> ChronoDuration

How long a freshly-issued reset token stays valid. Default 1 hour. Locked-decision per DESIGN_RECOVERY.md §17.
Source§

fn request_rate_limit(&self) -> (u32, StdDuration)

Per-IP rate-limit on POST /admin/forgot-password. Returned as (capacity, window): at most capacity requests within window. Default (5, 15min).
Source§

fn consume_rate_limit(&self) -> (u32, StdDuration)

Per-IP rate-limit on POST /admin/reset-password/<token>. Tighter than the request limit since the consume path is the brute-force surface. Default (10, 5min).
Source§

fn strict_mailer_required(&self) -> bool

When true, the framework refuses to start at boot if the registered mailer is still the default crate::email::LogMailer (production deployments must opt in to a real mailer). Default false. Enforcement lands when the recovery handlers ship (R1 commit #7+); this commit ships the declaration only.
Source§

fn public_site_url(&self, req: &Request) -> Option<String>

Derive the absolute base URL the reset email’s link should point at. Default: see [derive_public_site_url] + trust-boundary docs on this trait. Projects override this method to return a fixed string (e.g. read from config) when header derivation isn’t appropriate for their topology. Read more
Source§

fn login_throttle(&self) -> LoginThrottle

Auto-throttle parameters for the login flow. Default LoginThrottle::DEFAULT (5 / 10min / 15min). Projects override to relax for development environments (max_attempts: 100) or tighten for high-sensitivity deployments (max_attempts: 3, lock_minutes: 60). Read more
Source§

fn reauth_window(&self) -> ChronoDuration

Window during which a session that has cleared the re-auth wall (/admin/reauth) is considered elevated and may access destructive admin-recovery surfaces (admin-driven password reset, lock, unlock, revoke-sessions). Default 15 minutes (DESIGN_R2_ORGANISATIONAL.md §12 locked-decision). Read more
Source§

fn mfa_step_seconds(&self) -> u64

TOTP step interval in seconds. Locked at 30 per DESIGN_R3_MFA.md Appendix B — RFC 6238 industry standard for interop with every common authenticator app (Google Authenticator, Authy, 1Password, Bitwarden, Aegis, Raivo, etc.). Returning a different value would break the QR provisioning URL’s implicit period; the design treats this as a major-version concern. Read more
Source§

fn mfa_skew_steps(&self) -> u32

TOTP step skew tolerance, in steps. Locked at 1 per DESIGN_R3_MFA.md Appendix B — gives a 90-second total acceptance window at the canonical 30-second step (current ± 1[current - 1, current + 1]). The design treats wider skew as a security regression: 2-step skew would accept a code generated 60 seconds ago, which extends the network-replay window without improving UX for users with reasonable clock drift. Read more
Source§

fn scope_for(&self, _identity: &Identity) -> Option<SharedRecoveryPolicy>

Multi-tenant readiness hook. Returns Some(scoped_policy) to scope rate-limits / TTLs / lockout windows per tenant when an authenticated identity is in scope; returns None to mean “no scoping, the caller continues to use the Admin-bound recovery policy unchanged”. Read more

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<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> 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> 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

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