pub struct VapidHeader {
pub scheme: String,
pub token: String,
pub version_data: VapidVersionData,
}Expand description
Parses the VAPID authorization header
Fields§
§scheme: String§token: String§version_data: VapidVersionDataImplementations§
Source§impl VapidHeader
impl VapidHeader
Sourcepub fn parse(header: &str) -> Result<VapidHeader, VapidError>
pub fn parse(header: &str) -> Result<VapidHeader, VapidError>
Parse the VAPID authorization header. The public key is available if the version is 2 (“vapid” scheme).
Sourcepub fn insecure_sub(&self) -> Result<Option<String>, VapidError>
pub fn insecure_sub(&self) -> Result<Option<String>, VapidError>
Return the claimed sub after doing some minimal checks for validity.
WARNING: THIS FUNCTION DOES NOT VALIDATE THE VAPID HEADER AND SHOULD
ONLY BE USED FOR LOGGING AND METRIC REPORTING FUNCTIONS.
Proper validation should be done by [crate::extractors::subscription::validate_vapid_jwt()]
pub fn claims(&self) -> Result<VapidClaims, VapidError>
Trait Implementations§
Source§impl Clone for VapidHeader
impl Clone for VapidHeader
Source§fn clone(&self) -> VapidHeader
fn clone(&self) -> VapidHeader
Returns a duplicate 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 VapidHeader
impl Debug for VapidHeader
Source§impl PartialEq for VapidHeader
impl PartialEq for VapidHeader
Source§impl TryFrom<VapidHeader> for VapidClaims
impl TryFrom<VapidHeader> for VapidClaims
Source§type Error = VapidError
type Error = VapidError
The type returned in the event of a conversion error.
impl Eq for VapidHeader
impl StructuralPartialEq for VapidHeader
Auto Trait Implementations§
impl Freeze for VapidHeader
impl RefUnwindSafe for VapidHeader
impl Send for VapidHeader
impl Sync for VapidHeader
impl Unpin for VapidHeader
impl UnwindSafe for VapidHeader
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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