pub struct SignedUrlGenerator { /* private fields */ }Expand description
Signs and verifies blob and variant URLs.
Implementations§
Source§impl SignedUrlGenerator
impl SignedUrlGenerator
Sourcepub fn new(
base_url: impl AsRef<str>,
secret: impl Into<Vec<u8>>,
) -> Result<Self, SignedUrlError>
pub fn new( base_url: impl AsRef<str>, secret: impl Into<Vec<u8>>, ) -> Result<Self, SignedUrlError>
Sourcepub fn variant_url(
&self,
variant: &Variant,
expires_in: Duration,
) -> Result<Url, SignedUrlError>
pub fn variant_url( &self, variant: &Variant, expires_in: Duration, ) -> Result<Url, SignedUrlError>
Sourcepub fn redirect_url(
&self,
location: &Url,
expires_in: Duration,
) -> Result<Url, SignedUrlError>
pub fn redirect_url( &self, location: &Url, expires_in: Duration, ) -> Result<Url, SignedUrlError>
Sourcepub fn verify(&self, url: &Url) -> Result<SignedResource, SignedUrlError>
pub fn verify(&self, url: &Url) -> Result<SignedResource, SignedUrlError>
Verifies a signed URL at the current time.
§Errors
Returns an error when the signature is invalid, the payload cannot be decoded, or the URL has expired.
Sourcepub fn verify_at(
&self,
url: &Url,
now: DateTime<Utc>,
) -> Result<SignedResource, SignedUrlError>
pub fn verify_at( &self, url: &Url, now: DateTime<Utc>, ) -> Result<SignedResource, SignedUrlError>
Verifies a signed URL at the supplied instant.
§Errors
Returns an error when the signature is invalid, the payload cannot be decoded, or the URL has expired.
Trait Implementations§
Source§impl Clone for SignedUrlGenerator
impl Clone for SignedUrlGenerator
Source§fn clone(&self) -> SignedUrlGenerator
fn clone(&self) -> SignedUrlGenerator
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 moreAuto Trait Implementations§
impl Freeze for SignedUrlGenerator
impl RefUnwindSafe for SignedUrlGenerator
impl Send for SignedUrlGenerator
impl Sync for SignedUrlGenerator
impl Unpin for SignedUrlGenerator
impl UnsafeUnpin for SignedUrlGenerator
impl UnwindSafe for SignedUrlGenerator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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