pub struct HmacConfig {
pub secret: SecretBox<[u8]>,
pub max_age_seconds: i64,
pub bind_htu_htm: bool,
pub bind_jkt: bool,
pub bind_client: bool,
}Expand description
Configuration for HMAC-based nonce mode.
Stateless HMAC-based nonces: encode ts+rand+ctx and MAC it.
Fields§
§secret: SecretBox<[u8]>§max_age_seconds: i64§bind_htu_htm: bool§bind_jkt: bool§bind_client: boolImplementations§
Source§impl HmacConfig
impl HmacConfig
Sourcepub fn new<S>(
secret: S,
max_age_seconds: i64,
bind_htu_htm: bool,
bind_jkt: bool,
bind_client: bool,
) -> Selfwhere
S: IntoSecretBox,
pub fn new<S>(
secret: S,
max_age_seconds: i64,
bind_htu_htm: bool,
bind_jkt: bool,
bind_client: bool,
) -> Selfwhere
S: IntoSecretBox,
Create a new HMAC configuration with a secret that can be converted to SecretBox<[u8]>.
Accepts either a SecretBox<[u8]> or any type that can be converted to bytes
(e.g., &[u8], Vec<u8>). Non-boxed types will be automatically converted to
SecretBox internally.
§Example
use dpop_verifier::{HmacConfig, NonceMode};
// With a byte array (b"..." syntax)
let config = HmacConfig::new(b"my-secret-key", 300, true, true, true);
let mode = NonceMode::Hmac(config);
// With a byte slice
let secret_slice: &[u8] = b"my-secret-key";
let config = HmacConfig::new(secret_slice, 300, true, true, true);
// With a Vec<u8>
let secret = b"my-secret-key".to_vec();
let config = HmacConfig::new(&secret, 300, true, true, true);
// With a SecretBox (already boxed)
use secrecy::SecretBox;
let secret_box = SecretBox::from(b"my-secret-key".to_vec());
let config = HmacConfig::new(&secret_box, 300, true, true, true);Trait Implementations§
Source§impl Clone for HmacConfig
impl Clone for HmacConfig
Source§fn clone(&self) -> HmacConfig
fn clone(&self) -> HmacConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HmacConfig
impl RefUnwindSafe for HmacConfig
impl Send for HmacConfig
impl Sync for HmacConfig
impl Unpin for HmacConfig
impl UnwindSafe for HmacConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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