pub enum NonceMode {
Disabled,
RequireEqual {
expected_nonce: String,
},
Hmac {
secret: SecretBox<[u8]>,
max_age_seconds: i64,
bind_htu_htm: bool,
bind_jkt: bool,
bind_client: bool,
},
}Variants§
Disabled
RequireEqual
Require exact equality against expected_nonce
Hmac
Stateless HMAC-based nonces: encode ts+rand+ctx and MAC it
Implementations§
Source§impl NonceMode
impl NonceMode
Sourcepub fn hmac<S>(
secret: S,
max_age_seconds: i64,
bind_htu_htm: bool,
bind_jkt: bool,
bind_client: bool,
) -> Selfwhere
S: IntoSecretBox,
pub fn hmac<S>(
secret: S,
max_age_seconds: i64,
bind_htu_htm: bool,
bind_jkt: bool,
bind_client: bool,
) -> Selfwhere
S: IntoSecretBox,
Create an HMAC nonce mode 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::NonceMode;
// With a byte array (b"..." syntax)
let mode = NonceMode::hmac(b"my-secret-key", 300, true, true, true);
// With a byte slice
let secret_slice: &[u8] = b"my-secret-key";
let mode = NonceMode::hmac(secret_slice, 300, true, true, true);
// With a Vec<u8>
let secret = b"my-secret-key".to_vec();
let mode = NonceMode::hmac(&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 mode = NonceMode::hmac(&secret_box, 300, true, true, true);Trait Implementations§
Auto Trait Implementations§
impl Freeze for NonceMode
impl RefUnwindSafe for NonceMode
impl Send for NonceMode
impl Sync for NonceMode
impl Unpin for NonceMode
impl UnwindSafe for NonceMode
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