ExposeSecret

Trait ExposeSecret 

Source
pub trait ExposeSecret {
    type Inner: ?Sized;

    // Required methods
    fn expose_secret(&self) -> &Self::Inner;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Re-export of the traits. Trait for read-only access to secrets, including metadata.

Import this to enable .expose_secret(), .len(), and .is_empty(). For mutable access, see super::ExposeSecretMut.

Required Associated Types§

Source

type Inner: ?Sized

The inner secret type being exposed.

This can be a sized type (like [u8; N]) or unsized (like str or [u8]).

Required Methods§

Source

fn expose_secret(&self) -> &Self::Inner

Expose the secret for read-only access.

Source

fn len(&self) -> usize

Returns the length of the secret.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the secret is empty.

Implementors§

Source§

impl ExposeSecret for Base64String

Available on crate feature encoding-base64 only.

Implementation for Base64String - read-only access.

Encoding wrappers only provide read-only access to prevent invalidation of validation invariants. The Inner type is str since encoded strings are always valid UTF-8.

Source§

impl ExposeSecret for Bech32String

Available on crate feature encoding-bech32 only.

Implementation for Bech32String - read-only access.

Encoding wrappers only provide read-only access to prevent invalidation of validation invariants. The Inner type is str since encoded strings are always valid UTF-8.

Source§

impl ExposeSecret for HexString

Available on crate feature encoding-hex only.

Implementation for HexString - read-only access.

Encoding wrappers only provide read-only access to prevent invalidation of validation invariants. The Inner type is str since encoded strings are always valid UTF-8.

Source§

impl ExposeSecret for DynamicRandom

Available on crate feature rand only.

Implementation for DynamicRandom - read-only access.

Random wrappers only provide read-only access to prevent invalidation of the randomly generated secret. The Inner type is [u8] (slice) for compatibility with SecureRandom trait bounds.

Source§

type Inner = [u8]

Source§

impl ExposeSecret for Dynamic<CloneableStringInner>

Available on crate feature zeroize only.

Implementation for Dynamic<CloneableStringInner> - exposes the inner wrapper.

Source§

impl ExposeSecret for Dynamic<CloneableVecInner>

Available on crate feature zeroize only.

Implementation for Dynamic<CloneableVecInner> - exposes the inner wrapper.

Source§

impl ExposeSecret for Dynamic<String>

Implementation for Dynamic<String> - provides full read/write access.

Dynamic<String> is a core wrapper that allows both reading and mutation of secrets. This implementation directly accesses the inner field.

Source§

impl ExposeSecret for Fixed<u32>

Implementation for Fixed<u32> - provides access for test compatibility.

Source§

impl<T> ExposeSecret for Dynamic<Vec<T>>

Implementation for Dynamic<Vec<T>> - provides full read/write access.

Dynamic<Vec<T>> is a core wrapper that allows both reading and mutation of secrets. This implementation directly accesses the inner field.

Source§

type Inner = Vec<T>

Source§

impl<const N: usize> ExposeSecret for FixedRandom<N>

Available on crate feature rand only.

Implementation for FixedRandom<N> - read-only access.

Random wrappers only provide read-only access to prevent invalidation of the randomly generated secret. The Inner type is [u8] (slice) for compatibility with SecureRandom trait bounds.

Source§

type Inner = [u8]

Source§

impl<const N: usize> ExposeSecret for Fixed<CloneableArrayInner<N>>

Available on crate feature zeroize only.

Implementation for Fixed<CloneableArrayInner<N>> - exposes the inner wrapper.

Source§

impl<const N: usize, T> ExposeSecret for Fixed<[T; N]>

Implementation for [Fixed<[T; N]>] - provides full read/write access for arrays.

Fixed is a core wrapper that allows both reading and mutation of secrets. This implementation directly accesses the inner field.