pub struct SensitiveString(Sensitive<String>);Expand description
FFI-friendly concrete wrapper around a sensitive String. This is the type exposed across the
UniFFI / WASM boundary; bindings see it as an opaque tagged string. Debug and Display
delegate to the inner Sensitive, so output is redacted unless dangerous-crypto-debug
is enabled.
Tuple Fields§
§0: Sensitive<String>Implementations§
Source§impl SensitiveString
impl SensitiveString
Sourcepub fn as_bytes(&self) -> SensitiveSlice<'_>
pub fn as_bytes(&self) -> SensitiveSlice<'_>
Borrow the secret as a zero-copy SensitiveSlice over its UTF-8 bytes. The returned
slice borrows from this value and stays wrapped, so the bytes are never exposed and the
borrow cannot outlive self.
Trait Implementations§
Source§impl<UT> ConvertError<UT> for SensitiveString
impl<UT> ConvertError<UT> for SensitiveString
fn try_convert_unexpected_callback_error( e: UnexpectedUniFFICallbackError, ) -> Result<Self>
Source§impl Debug for SensitiveString
impl Debug for SensitiveString
Source§impl<'de> Deserialize<'de> for SensitiveString
impl<'de> Deserialize<'de> for SensitiveString
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SensitiveString
impl Display for SensitiveString
Source§impl ExposeSensitive for SensitiveString
impl ExposeSensitive for SensitiveString
Source§type Exposed = String
type Exposed = String
The type of the inner value that is being wrapped. This is used to define the return type of
the
expose and expose_owned methods.Source§fn expose(&self) -> &Self::Exposed
fn expose(&self) -> &Self::Exposed
Explicitly borrow the secret value. This exposes the secret to logging. This should be used
exactly only when interacting with APIs we do not control. Each usage of
expose MUST have
a comment justifying why it is necessary and acknowledging that the appropriate checks have
been performed.Source§fn expose_owned(self) -> Self::Exposed
fn expose_owned(self) -> Self::Exposed
Consume the wrapper and return the inner value. This exposes the secret to logging. This
should be used exactly only when interacting with APIs we do not control. Each usage of
expose MUST have a comment justifying why it is necessary and acknowledging that the
appropriate checks have been performed.Source§impl<UT> FfiConverter<UT> for SensitiveString
impl<UT> FfiConverter<UT> for SensitiveString
Source§const TYPE_ID_META: MetadataBuffer
const TYPE_ID_META: MetadataBuffer
Type ID metadata, serialized into a [MetadataBuffer].
Source§type FfiType = <String as Lower<UniFfiTag>>::FfiType
type FfiType = <String as Lower<UniFfiTag>>::FfiType
The low-level type used for passing values of this type over the FFI. Read more
Source§fn lower(obj: SensitiveString) -> Self::FfiType
fn lower(obj: SensitiveString) -> Self::FfiType
Lower a rust value of the target type, into an FFI value of type Self::FfiType. Read more
Source§fn try_lift(v: Self::FfiType) -> Result<SensitiveString>
fn try_lift(v: Self::FfiType) -> Result<SensitiveString>
Lift a rust value of the target type, from an FFI value of type Self::FfiType. Read more
Source§impl From<&str> for SensitiveString
impl From<&str> for SensitiveString
Source§impl From<SensitiveString> for JsValue
impl From<SensitiveString> for JsValue
Source§fn from(value: SensitiveString) -> Self
fn from(value: SensitiveString) -> Self
Converts to this type from the input type.
Source§impl From<String> for SensitiveString
impl From<String> for SensitiveString
Source§impl FromWasmAbi for SensitiveString
impl FromWasmAbi for SensitiveString
Source§impl IntoWasmAbi for SensitiveString
impl IntoWasmAbi for SensitiveString
Source§impl<UT> Lift<UT> for SensitiveString
impl<UT> Lift<UT> for SensitiveString
Source§impl<UT> LiftRef<UT> for SensitiveString
impl<UT> LiftRef<UT> for SensitiveString
type LiftType = SensitiveString
Source§impl<UT> LiftReturn<UT> for SensitiveString
impl<UT> LiftReturn<UT> for SensitiveString
Source§type ReturnType = <SensitiveString as Lift<UT>>::FfiType
type ReturnType = <SensitiveString as Lift<UT>>::FfiType
FFI return type for trait interfaces
Source§fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
Lift a successfully returned value from a trait interface
§fn lift_foreign_return(
ffi_return: Self::ReturnType,
call_status: RustCallStatus,
) -> Self
fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self
Lift a foreign returned value from a trait interface Read more
§fn lift_error(_buf: RustBuffer) -> Self
fn lift_error(_buf: RustBuffer) -> Self
Lift a Rust value for a callback interface method error result Read more
§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Lift a Rust value for an unexpected callback interface error Read more
Source§impl<UT> Lower<UT> for SensitiveString
impl<UT> Lower<UT> for SensitiveString
Source§impl<UT> LowerError<UT> for SensitiveString
impl<UT> LowerError<UT> for SensitiveString
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Lower this value for scaffolding function return Read more
Source§impl<UT> LowerReturn<UT> for SensitiveString
impl<UT> LowerReturn<UT> for SensitiveString
Source§type ReturnType = <SensitiveString as Lower<UT>>::FfiType
type ReturnType = <SensitiveString as Lower<UT>>::FfiType
The type that should be returned by scaffolding functions for this type. Read more
Source§fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
Lower the return value from an scaffolding call Read more
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Lower the return value for failed argument lifts Read more
Source§impl OptionFromWasmAbi for SensitiveString
impl OptionFromWasmAbi for SensitiveString
Source§impl OptionIntoWasmAbi for SensitiveString
impl OptionIntoWasmAbi for SensitiveString
Source§impl PartialEq for SensitiveString
impl PartialEq for SensitiveString
Source§impl Serialize for SensitiveString
impl Serialize for SensitiveString
Source§impl TryFrom<JsValue> for SensitiveString
impl TryFrom<JsValue> for SensitiveString
Source§impl<UT> TypeId<UT> for SensitiveString
impl<UT> TypeId<UT> for SensitiveString
const TYPE_ID_META: MetadataBuffer
Source§impl WasmDescribe for SensitiveString
impl WasmDescribe for SensitiveString
Auto Trait Implementations§
impl Freeze for SensitiveString
impl RefUnwindSafe for SensitiveString
impl Send for SensitiveString
impl Sync for SensitiveString
impl Unpin for SensitiveString
impl UnsafeUnpin for SensitiveString
impl UnwindSafe for SensitiveString
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
§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
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read moreSource§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
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.