Skip to main content

WakeUpVerifier

Struct WakeUpVerifier 

Source
pub struct WakeUpVerifier<V> { /* private fields */ }
Expand description

Stateful verifier bound to one configured recipient and one GWA signer.

Retain one instance for its entire verification session. Replay state lives in memory by default. The optional wakeup-store feature can persist it across restarts and signing-key rotation. Rate limits are per instance. The timestamp rule also rejects authentic messages arriving out of order or within the same second.

use core::num::NonZeroU8;
use smgw::wakeup::verify::{BrainpoolP256Verifier, VerifyError, WakeUpVerifier};

fn commission<V: BrainpoolP256Verifier>(
    recipient: [u8; 9],
    trusted_key: V,
) -> Result<WakeUpVerifier<V>, VerifyError<V::Error>> {
    WakeUpVerifier::new(recipient, trusted_key, NonZeroU8::new(16).unwrap())
}

Implementations§

Source§

impl<V: BrainpoolP256Verifier> WakeUpVerifier<V>

Source

pub fn new( recipient: [u8; 9], key: V, attempts_per_minute: NonZeroU8, ) -> Result<Self, VerifyError<V::Error>>

Bind a recipient to the public key from its trusted, currently valid GWA_WAN_SIG_CRT. The caller owns certificate policy, path and revocation checks.

Source

pub fn with_replay_database( self, path: impl AsRef<Path>, ) -> Result<Self, VerifyError<V::Error>>

Share a durable replay watermark for this recipient across verifiers.

Opens or creates a redb file in an existing, trusted directory. Keep using the same file when the GWA signing key changes. Protect the file and directory against replacement and backup rollback. An accepted timestamp already held by this instance is carried into the database. A storage error rejects the operation. Rate limiting remains local to this instance.

The store uses redb multi-writer mode and immediate durability. Each claim waits up to 500 ms for writer contention. This budget excludes filesystem I/O, initial database opening and integrity verification.

Source

pub fn verify( &mut self, packet: &[u8], synchronized_unix_seconds: i64, monotonic: Duration, ) -> Result<i64, VerifyError<V::Error>>

Return the signed timestamp on success. Supply trusted synchronized UTC seconds and a monotonic time with a stable origin. No connection is opened.

Auto Trait Implementations§

§

impl<V> !RefUnwindSafe for WakeUpVerifier<V>

§

impl<V> !UnwindSafe for WakeUpVerifier<V>

§

impl<V> Freeze for WakeUpVerifier<V>
where V: Freeze,

§

impl<V> Send for WakeUpVerifier<V>
where V: Send,

§

impl<V> Sync for WakeUpVerifier<V>
where V: Sync,

§

impl<V> Unpin for WakeUpVerifier<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for WakeUpVerifier<V>
where V: UnsafeUnpin,

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

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.