pub struct DirectUploadManager { /* private fields */ }Expand description
Creates and verifies direct upload tokens.
Implementations§
Source§impl DirectUploadManager
impl DirectUploadManager
Sourcepub fn new(secret: impl Into<Vec<u8>>) -> Self
pub fn new(secret: impl Into<Vec<u8>>) -> Self
Creates a new manager using the provided signing secret.
Sourcepub async fn prepare<S: StorageService + ?Sized>(
&self,
blob: Blob,
service: &S,
expires_in: Duration,
) -> Result<DirectUploadRequest, DirectUploadError>
pub async fn prepare<S: StorageService + ?Sized>( &self, blob: Blob, service: &S, expires_in: Duration, ) -> Result<DirectUploadRequest, DirectUploadError>
Prepares a direct upload request for a blob.
§Errors
Returns an error when the storage service cannot generate an upload URL or the token cannot be signed.
Sourcepub fn prepare_sync<S: StorageService + ?Sized>(
&self,
blob: Blob,
service: &S,
expires_in: Duration,
) -> Result<DirectUploadRequest, DirectUploadError>
pub fn prepare_sync<S: StorageService + ?Sized>( &self, blob: Blob, service: &S, expires_in: Duration, ) -> Result<DirectUploadRequest, DirectUploadError>
Prepares a direct upload request for a blob using the thread-local runtime.
§Errors
Returns an error when the storage service cannot generate an upload URL or the token cannot be signed.
Sourcepub fn verify(
&self,
token: &str,
now: DateTime<Utc>,
) -> Result<DirectUploadTokenClaims, DirectUploadError>
pub fn verify( &self, token: &str, now: DateTime<Utc>, ) -> Result<DirectUploadTokenClaims, DirectUploadError>
Trait Implementations§
Source§impl Clone for DirectUploadManager
impl Clone for DirectUploadManager
Source§fn clone(&self) -> DirectUploadManager
fn clone(&self) -> DirectUploadManager
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 DirectUploadManager
impl RefUnwindSafe for DirectUploadManager
impl Send for DirectUploadManager
impl Sync for DirectUploadManager
impl Unpin for DirectUploadManager
impl UnsafeUnpin for DirectUploadManager
impl UnwindSafe for DirectUploadManager
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