pub enum Algorithm {
HmacSha256,
}
Expand description
Supported algorithms for token signing and verification.
This enum represents the cryptographic algorithms that can be used to sign and verify Common Access Tokens.
Currently, only HMAC-SHA256 is supported, but the design allows for easy extension to support additional algorithms in the future.
§Example
use common_access_token::Algorithm;
// Create a token with HMAC-SHA256 algorithm
let alg = Algorithm::HmacSha256;
assert_eq!(alg.identifier(), 5); // COSE algorithm identifier
Variants§
HmacSha256
HMAC with SHA-256 (COSE algorithm identifier: 5)
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub fn identifier(&self) -> i32
pub fn identifier(&self) -> i32
Get the algorithm identifier as defined in the COSE spec
Sourcepub fn from_identifier(id: i32) -> Option<Self>
pub fn from_identifier(id: i32) -> Option<Self>
Create an Algorithm from an identifier
Trait Implementations§
impl Copy for Algorithm
impl Eq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Freeze for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnwindSafe for Algorithm
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