Trait secrecy::SerializableSecret

source ·
pub trait SerializableSecret: Serialize { }
Expand description

Marker trait for secret types which can be Serialize-d by serde.

When the serde feature of this crate is enabled and types are marked with this trait, they receive a Serialize impl for Secret<T>. (NOTE: all types which impl DeserializeOwned receive a Deserialize impl)

This is done deliberately to prevent accidental exfiltration of secrets via serde serialization.

If you are working with SecretString or SecretVec, not that by design these types do NOT impl this trait.

If you really want to have serde serialize those types, use the serialize_with attribute to specify a serializer that exposes the secret.

Object Safety§

This trait is not object safe.

Implementors§