pub struct AuditState {
pub halted: AtomicBool,
pub violation_count: AtomicU32,
/* private fields */
}Expand description
Shared audit state (overflow flag, alarm counter).
Lives in AppState and survives the lifetime of the server process.
Callers pass the database pool explicitly so the same state can be
used from any async context.
Fields§
§halted: AtomicBoolWhen true, EST operations MUST be rejected (FAU_STG.4 halt).
violation_count: AtomicU32Rolling count of consecutive security violations. Reset to 0 after a successful authentication.
Implementations§
Source§impl AuditState
impl AuditState
Sourcepub fn with_config(config: AuditConfig) -> Self
pub fn with_config(config: AuditConfig) -> Self
Build audit state from the [audit] config with the unkeyed
(SHA-256) hash chain. Equivalent to from_config with no key.
Sourcepub fn from_config(config: AuditConfig, integrity_key: Option<Vec<u8>>) -> Self
pub fn from_config(config: AuditConfig, integrity_key: Option<Vec<u8>>) -> Self
Build audit state from the [audit] config plus a resolved integrity
key (present only when signed = true). With a key the hash chain is
HMAC-SHA256 keyed; without one it is plain SHA-256.
Sourcepub fn is_halted(&self) -> bool
pub fn is_halted(&self) -> bool
Check whether EST operations should be rejected due to audit storage exhaustion (FAU_STG.4).
Sourcepub fn set_halted(&self, halted: bool)
pub fn set_halted(&self, halted: bool)
Set the halted flag (called when audit storage is full and
overflow policy is halt).
Sourcepub fn record_violation(&self) -> u32
pub fn record_violation(&self) -> u32
Increment the security violation counter and return the new count.
Sourcepub fn reset_violations(&self)
pub fn reset_violations(&self)
Reset the violation counter (called after successful authentication).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AuditState
impl !RefUnwindSafe for AuditState
impl Send for AuditState
impl Sync for AuditState
impl Unpin for AuditState
impl UnsafeUnpin for AuditState
impl !UnwindSafe for AuditState
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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