pub struct CatOptions {
pub keys: HashMap<String, Vec<u8>>,
pub expect_cwt_tag: bool,
}Expand description
Configuration options for creating a CAT instance.
This struct contains the cryptographic keys and format options used for token generation and validation.
§Examples
use common_access_token::CatOptions;
use std::collections::HashMap;
// Create options with a single key
let key = hex::decode("403697de87af64611c1d32a05dab0fe1fcb715a86ab435f1ec99192d79569388").unwrap();
let options = CatOptions {
keys: HashMap::from([("key-1".to_string(), key)]),
expect_cwt_tag: true,
};
// Create empty options (not useful until keys are added)
let empty_options = CatOptions::default();Fields§
§keys: HashMap<String, Vec<u8>>Map of key IDs to cryptographic keys.
Each entry maps a key identifier (kid) to the actual key material (as bytes). When generating or validating tokens, the key ID is used to look up the appropriate key in this map.
expect_cwt_tag: boolWhether tokens should include the CWT tag.
When true, tokens will be wrapped with the CWT tag (61) as defined in RFC 8392. This should be set to true for interoperability with other implementations.
Trait Implementations§
Source§impl Clone for CatOptions
impl Clone for CatOptions
Source§fn clone(&self) -> CatOptions
fn clone(&self) -> CatOptions
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 moreSource§impl Debug for CatOptions
impl Debug for CatOptions
Source§impl Default for CatOptions
impl Default for CatOptions
Source§fn default() -> CatOptions
fn default() -> CatOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CatOptions
impl RefUnwindSafe for CatOptions
impl Send for CatOptions
impl Sync for CatOptions
impl Unpin for CatOptions
impl UnwindSafe for CatOptions
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