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>
impl<V: BrainpoolP256Verifier> WakeUpVerifier<V>
Sourcepub fn new(
recipient: [u8; 9],
key: V,
attempts_per_minute: NonZeroU8,
) -> Result<Self, VerifyError<V::Error>>
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.
Sourcepub fn with_replay_database(
self,
path: impl AsRef<Path>,
) -> Result<Self, VerifyError<V::Error>>
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.