pub struct SecretString { /* private fields */ }Expand description
Redacted secret wrapper for runtime and connector configuration.
Implementations§
Source§impl SecretString
impl SecretString
Sourcepub fn from_provider(
provider_name: impl Into<String>,
reference: impl Into<String>,
provider: Arc<dyn SecretProvider>,
) -> Self
pub fn from_provider( provider_name: impl Into<String>, reference: impl Into<String>, provider: Arc<dyn SecretProvider>, ) -> Self
Resolve a secret from an external provider at connect time.
Sourcepub fn from_callback(
label: impl Into<String>,
callback: impl Fn() -> Result<String> + Send + Sync + 'static,
) -> Self
pub fn from_callback( label: impl Into<String>, callback: impl Fn() -> Result<String> + Send + Sync + 'static, ) -> Self
Resolve a secret through a callback at connect time.
Sourcepub fn expose_secret(&self) -> Result<&str>
pub fn expose_secret(&self) -> Result<&str>
Return the inline secret value.
Deferred secrets must be resolved with resolve.
Sourcepub fn into_inner(self) -> Result<String>
pub fn into_inner(self) -> Result<String>
Consume the wrapper and return the inline secret.
Trait Implementations§
Source§impl Clone for SecretString
impl Clone for SecretString
Source§fn clone(&self) -> SecretString
fn clone(&self) -> SecretString
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SecretString
impl Debug for SecretString
Source§impl Default for SecretString
impl Default for SecretString
Source§impl<'de> Deserialize<'de> for SecretString
impl<'de> Deserialize<'de> for SecretString
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 Display for SecretString
impl Display for SecretString
impl Eq for SecretString
Source§impl From<&str> for SecretString
impl From<&str> for SecretString
Source§impl From<String> for SecretString
impl From<String> for SecretString
Source§impl PartialEq for SecretString
impl PartialEq for SecretString
Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Compare two SecretString values for equality.
§Security
For Inline secrets this comparison exposes the raw secret value to the
CPU’s branch predictor and is not constant-time. It is safe for
configuration deduplication (the intended use case) but must not be
used for authentication token comparison, HMAC verification, or any
context where timing oracles are a threat model. Use
subtle::ConstantTimeEq (or equivalent) for security-sensitive equality
checks.
Source§impl Serialize for SecretString
impl Serialize for SecretString
Source§fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
Serializes as the literal string "[REDACTED]".
Secret values are never included in serialized output regardless of
variant. Configs serialized to JSON, TOML, or any other format will
always see "[REDACTED]" in the password field, making it safe to log
config snapshots for diagnostics without leaking credentials.