pub enum SendAuthType {
None,
Password {
password: String,
},
HashedPassword {
key_b64: String,
},
Emails {
emails: Vec<String>,
},
}Expand description
Type-safe authentication method for a Send, including the authentication data. This ensures that password and email authentication are mutually exclusive.
Variants§
None
No authentication required
Password
Password-based authentication. The SDK derives the wire-format keyB64 via PBKDF2
over the send key.
HashedPassword
Pre-derived password. The caller has already run PBKDF2 client-side and supplies the
resulting base64-encoded hash; the SDK forwards it verbatim. Use this when the
hashing happens outside the SDK (e.g. the legacy TypeScript clients that derive in
SendService.encrypt). For new code that holds a plaintext password, use
Password { ... } and let the SDK do the derivation.
Emails
Email-based OTP authentication
Implementations§
Source§impl SendAuthType
impl SendAuthType
Sourcepub fn from_plaintext_password(password: String) -> Self
pub fn from_plaintext_password(password: String) -> Self
Construct a Password variant from a plaintext password. The SDK will run PBKDF2
during encryption.
Sourcepub fn from_hashed_password(key_b64: String) -> Self
pub fn from_hashed_password(key_b64: String) -> Self
Construct a HashedPassword variant from an already-derived keyB64. The SDK
forwards it verbatim — no further derivation. Misuse (passing plaintext here)
produces an unsatisfiable server-side hash.
Sourcepub fn auth_type(&self) -> AuthType
pub fn auth_type(&self) -> AuthType
Returns the AuthType discriminant for this authentication method
Sourcepub(crate) fn validate(&self) -> Result<(), EmptyEmailListError>
pub(crate) fn validate(&self) -> Result<(), EmptyEmailListError>
Validates that the auth configuration is valid.
Returns an error if Emails is used with an empty list.
Trait Implementations§
Source§impl Clone for SendAuthType
impl Clone for SendAuthType
Source§fn clone(&self) -> SendAuthType
fn clone(&self) -> SendAuthType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<UT> ConvertError<UT> for SendAuthType
impl<UT> ConvertError<UT> for SendAuthType
fn try_convert_unexpected_callback_error( e: UnexpectedUniFFICallbackError, ) -> Result<Self>
Source§impl Debug for SendAuthType
impl Debug for SendAuthType
Source§impl<'de> Deserialize<'de> for SendAuthType
impl<'de> Deserialize<'de> for SendAuthType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<UT> FfiConverter<UT> for SendAuthType
impl<UT> FfiConverter<UT> for SendAuthType
Source§const TYPE_ID_META: MetadataBuffer
const TYPE_ID_META: MetadataBuffer
Source§type FfiType = RustBuffer
type FfiType = RustBuffer
Source§fn lower(v: Self) -> RustBuffer
fn lower(v: Self) -> RustBuffer
Source§fn try_lift(buf: RustBuffer) -> Result<Self>
fn try_lift(buf: RustBuffer) -> Result<Self>
Source§impl From<SendAuthType> for JsValuewhere
SendAuthType: Serialize,
impl From<SendAuthType> for JsValuewhere
SendAuthType: Serialize,
Source§fn from(value: SendAuthType) -> Self
fn from(value: SendAuthType) -> Self
Source§impl FromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
impl FromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
Source§impl IntoWasmAbi for &SendAuthTypewhere
SendAuthType: Serialize,
impl IntoWasmAbi for &SendAuthTypewhere
SendAuthType: Serialize,
Source§impl IntoWasmAbi for SendAuthTypewhere
SendAuthType: Serialize,
impl IntoWasmAbi for SendAuthTypewhere
SendAuthType: Serialize,
Source§impl<UT> Lift<UT> for SendAuthType
impl<UT> Lift<UT> for SendAuthType
Source§impl<UT> LiftRef<UT> for SendAuthType
impl<UT> LiftRef<UT> for SendAuthType
type LiftType = SendAuthType
Source§impl<UT> LiftReturn<UT> for SendAuthType
impl<UT> LiftReturn<UT> for SendAuthType
Source§type ReturnType = <SendAuthType as Lift<UT>>::FfiType
type ReturnType = <SendAuthType as Lift<UT>>::FfiType
Source§fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
§fn lift_foreign_return(
ffi_return: Self::ReturnType,
call_status: RustCallStatus,
) -> Self
fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self
§fn lift_error(_buf: RustBuffer) -> Self
fn lift_error(_buf: RustBuffer) -> Self
§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Source§impl<UT> Lower<UT> for SendAuthType
impl<UT> Lower<UT> for SendAuthType
Source§impl<UT> LowerError<UT> for SendAuthType
impl<UT> LowerError<UT> for SendAuthType
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for SendAuthType
impl<UT> LowerReturn<UT> for SendAuthType
Source§type ReturnType = <SendAuthType as Lower<UT>>::FfiType
type ReturnType = <SendAuthType as Lower<UT>>::FfiType
Source§fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl OptionFromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
impl OptionFromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
Source§impl OptionIntoWasmAbi for SendAuthTypewhere
SendAuthType: Serialize,
impl OptionIntoWasmAbi for SendAuthTypewhere
SendAuthType: Serialize,
Source§impl PartialEq for SendAuthType
impl PartialEq for SendAuthType
Source§impl RefFromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
impl RefFromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
Source§type Abi = <JsType as RefFromWasmAbi>::Abi
type Abi = <JsType as RefFromWasmAbi>::Abi
Self are recovered from.Source§type Anchor = SelfOwner<SendAuthType>
type Anchor = SelfOwner<SendAuthType>
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 Serialize for SendAuthType
impl Serialize for SendAuthType
Source§impl Tsify for SendAuthType
impl Tsify for SendAuthType
const DECL: &'static str = "/**\n * Type-safe authentication method for a Send, including the authentication data.\n * This ensures that password and email authentication are mutually exclusive.\n */\nexport type SendAuthType = { type: \"none\" } | { type: \"password\"; password: string } | { type: \"hashedPassword\"; keyB64: string } | { type: \"emails\"; emails: string[] };"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Source§impl<UT> TypeId<UT> for SendAuthType
impl<UT> TypeId<UT> for SendAuthType
const TYPE_ID_META: MetadataBuffer
Source§impl VectorFromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
impl VectorFromWasmAbi for SendAuthTypewhere
Self: DeserializeOwned,
type Abi = <JsType as VectorFromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>
Source§impl VectorIntoWasmAbi for SendAuthTypewhere
SendAuthType: Serialize,
impl VectorIntoWasmAbi for SendAuthTypewhere
SendAuthType: Serialize,
type Abi = <JsType as VectorIntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi
Source§impl WasmDescribe for SendAuthType
impl WasmDescribe for SendAuthType
Source§impl WasmDescribeVector for SendAuthType
impl WasmDescribeVector for SendAuthType
impl Eq for SendAuthType
impl StructuralPartialEq for SendAuthType
Auto Trait Implementations§
impl Freeze for SendAuthType
impl RefUnwindSafe for SendAuthType
impl Send for SendAuthType
impl Sync for SendAuthType
impl Unpin for SendAuthType
impl UnsafeUnpin for SendAuthType
impl UnwindSafe for SendAuthType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§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
§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
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
§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>
§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>
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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt 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.