pub struct SendReceiveClient {
client: Client,
}Expand description
Client dedicated to receiving (anonymously accessing) a Send.
Receiving is the only Send operation that may target a different Bitwarden instance than the
one the user is signed into: the target server is dictated by the Send link itself (e.g. a
self-hosted or other-region server). This client is therefore built from its own
[ClientSettings] and carries no user identity, tokens, or key store. Creating and editing
Sends never needs this, and should go through the regular
SendClient.
Fields§
§client: ClientImplementations§
Source§impl SendReceiveClient
impl SendReceiveClient
Sourcepub fn new(settings: Option<ClientSettings>) -> Self
pub fn new(settings: Option<ClientSettings>) -> Self
Create a receive client targeting the instance described by settings.
Sourcepub async fn request_send_access_token(
&self,
request: SendAccessTokenRequest,
) -> Result<SendAccessTokenResponse, SendAccessTokenError>
pub async fn request_send_access_token( &self, request: SendAccessTokenRequest, ) -> Result<SendAccessTokenResponse, SendAccessTokenError>
Requests a send access token from the identity server of the instance this client targets.
For a password-protected Send, the request’s credentials carry the hash returned by
Self::hash_send_password. Minting the token here, rather than through a signed-in
client, guarantees it (and any password hash) is only ever sent to the server that hosts
the Send.
Sourcepub fn hash_send_password(
&self,
key_b64: String,
password: String,
) -> Result<String, SendAccessKeyError>
pub fn hash_send_password( &self, key_b64: String, password: String, ) -> Result<String, SendAccessKeyError>
Hash password with the URL-safe-base64 send key into the password_hash_b64 credential
expected by Self::request_send_access_token.
Sourcepub async fn access_send(
&self,
access_token: String,
) -> Result<SendAccessResponse, AccessSendError>
pub async fn access_send( &self, access_token: String, ) -> Result<SendAccessResponse, AccessSendError>
Accesses a send, authenticated with a send access token.
The returned SendAccessResponse contains encrypted fields that must be decrypted
with Self::decrypt_send_access using the key from the URL fragment.
Sourcepub async fn get_file_download_data(
&self,
access_token: String,
file_id: String,
) -> Result<SendFileDownloadData, GetFileDownloadDataError>
pub async fn get_file_download_data( &self, access_token: String, file_id: String, ) -> Result<SendFileDownloadData, GetFileDownloadDataError>
Gets file download data for a file send, authenticated with a send access token.
Sourcepub fn decrypt_send_access(
&self,
key_b64: String,
response: SendAccessResponse,
) -> Result<SendAccessView, SendAccessDecryptError>
pub fn decrypt_send_access( &self, key_b64: String, response: SendAccessResponse, ) -> Result<SendAccessView, SendAccessDecryptError>
Decrypt a SendAccessResponse into a SendAccessView using the URL-safe-base64 send
key from the trailing segment of the send URL fragment.
Sourcepub fn decrypt_send_access_file(
&self,
key_b64: String,
buffer: &[u8],
) -> Result<Vec<u8>, SendAccessDecryptError>
pub fn decrypt_send_access_file( &self, key_b64: String, buffer: &[u8], ) -> Result<Vec<u8>, SendAccessDecryptError>
Decrypt a downloaded file-send blob using the URL-safe-base64 send key.
Trait Implementations§
Source§impl From<SendReceiveClient> for JsValue
impl From<SendReceiveClient> for JsValue
Source§fn from(value: SendReceiveClient) -> Self
fn from(value: SendReceiveClient) -> Self
Source§impl FromWasm for SendReceiveClient
Available on crate feature wasm only.
impl FromWasm for SendReceiveClient
wasm only.Source§impl FromWasmAbi for SendReceiveClient
impl FromWasmAbi for SendReceiveClient
Source§impl IntoWasmAbi for SendReceiveClient
impl IntoWasmAbi for SendReceiveClient
Source§type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
Source§impl LongRefFromWasmAbi for SendReceiveClient
impl LongRefFromWasmAbi for SendReceiveClient
Source§type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<SendReceiveClient>
type Anchor = RcRef<SendReceiveClient>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl RefFromWasmAbi for SendReceiveClient
impl RefFromWasmAbi for SendReceiveClient
Source§type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
Self are recovered from.Source§type Anchor = RcRef<SendReceiveClient>
type Anchor = RcRef<SendReceiveClient>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for SendReceiveClient
impl RefMutFromWasmAbi for SendReceiveClient
Source§type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
type Abi = WasmPtr<WasmRefCell<SendReceiveClient>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<SendReceiveClient>
type Anchor = RcRefMut<SendReceiveClient>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for SendReceiveClient
impl SupportsInstanceProperty for SendReceiveClient
impl SupportsStaticProperty for SendReceiveClient
Source§impl ToWasm for SendReceiveClient
Available on crate feature wasm only.
impl ToWasm for SendReceiveClient
wasm only.Source§impl TryFromJsValue for SendReceiveClient
impl TryFromJsValue for SendReceiveClient
Source§fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
Source§const NULLABLE: bool = false
const NULLABLE: bool = false
Self accepts null as a distinct value space, as
Nullable<T> does. An enclosing Option then passes null through
instead of reading it as None, so Option<T> is itself nullable
exactly when T is not. JsValue does not set this: it accepts
null as one value among all of them, not as a distinct space, and
Option<JsValue> reads it as None like the ABI does. This is the
JS-value side of NullableFromWasmAbi, which claims null at the
ABI.Source§impl VectorFromWasmAbi for SendReceiveClient
impl VectorFromWasmAbi for SendReceiveClient
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SendReceiveClient]>
Source§impl VectorIntoWasmAbi for SendReceiveClient
impl VectorIntoWasmAbi for SendReceiveClient
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[SendReceiveClient]>) -> Self::Abi
Source§impl WasmDescribe for SendReceiveClient
impl WasmDescribe for SendReceiveClient
Auto Trait Implementations§
impl !RefUnwindSafe for SendReceiveClient
impl !UnwindSafe for SendReceiveClient
impl Freeze for SendReceiveClient
impl Send for SendReceiveClient
impl Sync for SendReceiveClient
impl Unpin for SendReceiveClient
impl UnsafeUnpin for SendReceiveClient
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> 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> ⓘ
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> ⓘ
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> ⓘ
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> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
Source§type MaybeAbi = <T as FromWasmAbi>::Abi
type MaybeAbi = <T as FromWasmAbi>::Abi
Option<Self>.Source§unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn try_from_maybe_abi( js: <T as FromWasmAbi>::Abi, ) -> Result<T, &'static str>
Source§impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
Source§type MaybeAbi = <T as IntoWasmAbi>::Abi
type MaybeAbi = <T as IntoWasmAbi>::Abi
Option<Self>.Source§fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
Option<Self> ABI.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.