pub trait ExposeSensitive {
type Exposed;
// Required methods
fn expose(&self) -> &Self::Exposed;
fn expose_owned(self) -> Self::Exposed;
}Expand description
A trait for types that can expose their inner secret value. This is implemented for
Sensitive<T> and can be implemented for other wrapper types as needed. The expose and
expose_owned methods are intentionally explicit and require justification in comments to
prevent accidental misuse.
Required Associated Types§
Required Methods§
Sourcefn 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.
Sourcefn 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.