pub struct NotificationHeaders {
pub ttl: i64,
pub topic: Option<String>,
pub encoding: Option<String>,
pub encryption: Option<String>,
pub encryption_key: Option<String>,
pub crypto_key: Option<String>,
}
Expand description
Extractor and validator for notification headers
Fields§
§ttl: i64
§topic: Option<String>
§encoding: Option<String>
§encryption: Option<String>
§encryption_key: Option<String>
§crypto_key: Option<String>
Implementations§
source§impl NotificationHeaders
impl NotificationHeaders
sourcepub fn from_request(req: &HttpRequest, has_data: bool) -> Result<Self, ApiError>
pub fn from_request(req: &HttpRequest, has_data: bool) -> Result<Self, ApiError>
Extract the notification headers from a request.
This can not be implemented as a FromRequest
impl because we need to
know if the payload has data, without actually advancing the payload
stream.
sourcefn strip_header(header: String) -> String
fn strip_header(header: String) -> String
Remove Base64 padding and double-quotes
sourcefn validate_encryption(&self) -> Result<(), ApiError>
fn validate_encryption(&self) -> Result<(), ApiError>
Validate the encryption headers according to the various WebPush standard versions
sourcefn validate_encryption_04_rules(&self) -> Result<(), ApiError>
fn validate_encryption_04_rules(&self) -> Result<(), ApiError>
Validates encryption headers according to draft-ietf-webpush-encryption-04
sourcefn validate_encryption_06_rules(&self) -> Result<(), ApiError>
fn validate_encryption_06_rules(&self) -> Result<(), ApiError>
Validates encryption headers according to draft-ietf-httpbis-encryption-encoding-06 (the encryption values are in the payload, so there shouldn’t be any in the headers)
Trait Implementations§
source§impl Clone for NotificationHeaders
impl Clone for NotificationHeaders
source§fn clone(&self) -> NotificationHeaders
fn clone(&self) -> NotificationHeaders
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 NotificationHeaders
impl Debug for NotificationHeaders
source§impl From<NotificationHeaders> for HashMap<String, String>
impl From<NotificationHeaders> for HashMap<String, String>
source§fn from(headers: NotificationHeaders) -> Self
fn from(headers: NotificationHeaders) -> Self
Converts to this type from the input type.
source§impl PartialEq for NotificationHeaders
impl PartialEq for NotificationHeaders
source§fn eq(&self, other: &NotificationHeaders) -> bool
fn eq(&self, other: &NotificationHeaders) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Validate for NotificationHeaders
impl Validate for NotificationHeaders
source§impl<'v_a> ValidateArgs<'v_a> for NotificationHeaders
impl<'v_a> ValidateArgs<'v_a> for NotificationHeaders
impl Eq for NotificationHeaders
impl StructuralPartialEq for NotificationHeaders
Auto Trait Implementations§
impl Freeze for NotificationHeaders
impl RefUnwindSafe for NotificationHeaders
impl Send for NotificationHeaders
impl Sync for NotificationHeaders
impl Unpin for NotificationHeaders
impl UnwindSafe for NotificationHeaders
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
§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<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