pub struct SecretString(/* private fields */);Expand description
A decrypted secret whose Debug output and serde form never contain the
plaintext.
SQLx encoding/decoding encrypts and decrypts the column value. Serialize
emits an authenticated RULLST:v2 envelope under the configured
RULLST_ENCRYPTION_KEY (and fails without one); Deserialize decrypts such
an envelope and still accepts any other string as plaintext input.
Because the envelope binds no model, field or owner, Deserialize is for
trusted stores only: deserialize client input with
deserialize_plaintext_secret or deserialize_optional_plaintext_secret.
Generated ORM audit, event and search projections serialize it as "***".
Use SecretString::reveal_audited for deliberate exposure.
Implementations§
Source§impl SecretString
impl SecretString
Trait Implementations§
Source§impl Clone for SecretString
impl Clone for SecretString
Source§impl Debug for SecretString
impl Debug for SecretString
Source§impl<'r> Decode<'r, Any> for SecretString
Available on neither crate feature strict-mysql nor crate feature strict-postgres nor crate feature strict-sqlite.
impl<'r> Decode<'r, Any> for SecretString
strict-mysql nor crate feature strict-postgres nor crate feature strict-sqlite.Source§impl<'de> Deserialize<'de> for SecretString
impl<'de> Deserialize<'de> for SecretString
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Decrypts an envelope written by Serialize (current key or keyring).
Any other string is accepted as plaintext input; a malformed or
unauthenticated envelope is rejected.
Source§impl<'q> Encode<'q, Any> for SecretString
Available on neither crate feature strict-mysql nor crate feature strict-postgres nor crate feature strict-sqlite.
impl<'q> Encode<'q, Any> for SecretString
strict-mysql nor crate feature strict-postgres nor crate feature strict-sqlite.Source§fn encode_by_ref(
&self,
buf: &mut <Any as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
impl Eq for SecretString
Source§impl PartialEq for SecretString
impl PartialEq for SecretString
Source§impl Serialize for SecretString
impl Serialize for SecretString
impl StructuralPartialEq for SecretString
Source§impl Type<Any> for SecretString
Available on neither crate feature strict-mysql nor crate feature strict-postgres nor crate feature strict-sqlite.
impl Type<Any> for SecretString
strict-mysql nor crate feature strict-postgres nor crate feature strict-sqlite.Auto Trait Implementations§
impl Freeze for SecretString
impl RefUnwindSafe for SecretString
impl Send for SecretString
impl Sync for SecretString
impl Unpin for SecretString
impl UnsafeUnpin for SecretString
impl UnwindSafe for SecretString
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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