pub struct RelayStorageProvider {
pub token: Arc<RwLock<Option<String>>>,
/* private fields */
}Fields§
§token: Arc<RwLock<Option<String>>>Implementations§
Source§impl RelayStorageProvider
impl RelayStorageProvider
pub fn new(endpoint: impl Into<String>) -> Self
Sourcepub async fn authenticate(
&self,
user_id: &str,
sign_fn: impl Fn(&[u8]) -> StorageResult<String>,
) -> StorageResult<()>
pub async fn authenticate( &self, user_id: &str, sign_fn: impl Fn(&[u8]) -> StorageResult<String>, ) -> StorageResult<()>
Perform the two-step challenge-response auth and store the session token.
Sourcepub async fn authenticate_with_identity(
&self,
vault_dir: &Path,
) -> StorageResult<()>
pub async fn authenticate_with_identity( &self, vault_dir: &Path, ) -> StorageResult<()>
Register identity on the relay (idempotent) then authenticate.
vault_dir is the .vyn/ directory (contains identity.toml).
pub fn clear_cached_token(vault_dir: &Path)
Source§impl RelayStorageProvider
impl RelayStorageProvider
Sourcepub async fn list_vaults(&self) -> StorageResult<Vec<String>>
pub async fn list_vaults(&self) -> StorageResult<Vec<String>>
Lists all vault IDs on the relay (requires auth token).
Sourcepub async fn list_blobs(&self) -> StorageResult<Vec<(String, u64)>>
pub async fn list_blobs(&self) -> StorageResult<Vec<(String, u64)>>
Lists all blobs on the relay (requires auth token).
Trait Implementations§
Source§impl Clone for RelayStorageProvider
impl Clone for RelayStorageProvider
Source§fn clone(&self) -> RelayStorageProvider
fn clone(&self) -> RelayStorageProvider
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 StorageProvider for RelayStorageProvider
impl StorageProvider for RelayStorageProvider
async fn get_manifest(&self, project_id: &str) -> StorageResult<Option<Vec<u8>>>
async fn put_manifest( &self, project_id: &str, manifest_payload: &[u8], ) -> StorageResult<()>
async fn upload_blob(&self, hash: &str, data: Vec<u8>) -> StorageResult<()>
async fn download_blob(&self, hash: &str) -> StorageResult<Option<Vec<u8>>>
async fn create_invite( &self, user_id: &str, vault_id: &str, payload: Vec<u8>, ) -> StorageResult<()>
async fn get_invites( &self, user_id: &str, vault_id: &str, ) -> StorageResult<Vec<Vec<u8>>>
Auto Trait Implementations§
impl Freeze for RelayStorageProvider
impl !RefUnwindSafe for RelayStorageProvider
impl Send for RelayStorageProvider
impl Sync for RelayStorageProvider
impl Unpin for RelayStorageProvider
impl UnsafeUnpin for RelayStorageProvider
impl !UnwindSafe for RelayStorageProvider
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.