pub struct Signer { /* private fields */ }Expand description
HMAC signer for API authentication
Supports both base64-encoded and raw string secrets, with configurable output format.
Implementations§
Source§impl Signer
impl Signer
Sourcepub fn new(secret: &str) -> Result<Self, String>
pub fn new(secret: &str) -> Result<Self, String>
Create a new signer from base64-encoded secret
Attempts to decode the secret using multiple base64 formats in order:
- URL-safe without padding (most common for API keys)
- URL-safe with padding
- Standard base64
- Falls back to raw bytes if all decoding attempts fail
Sourcepub fn from_raw(secret: &str) -> Self
pub fn from_raw(secret: &str) -> Self
Create a new signer from raw string secret (no base64 decoding)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Signer
impl RefUnwindSafe for Signer
impl Send for Signer
impl Sync for Signer
impl Unpin for Signer
impl UnsafeUnpin for Signer
impl UnwindSafe for Signer
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