pub struct Credential(/* private fields */);Expand description
The API credential the destination’s tracker expects — the customer
company’s token, decrypted from cratefield-secrets immediately before
the call and never stored anywhere else.
The bytes are zeroised on drop (Zeroizing), and the type implements
neither Display, Serialize, Deserialize nor PartialEq: a secret
that can be formatted, serialised or compared is a secret that ends up
in a log line, a JSON body, or a database row nobody clears. Debug is
implemented, and redacts:
let cred = Credential::new("ghp_AAAAnobodyshouldseethis");
assert_eq!(format!("{cred:?}"), "Credential([redacted])");Clone stays: a copy is a second buffer holding the same secret —
Zeroizing’s Clone clones the inner String, which allocates fresh —
and each buffer is zeroised when its own handle drops. So no copy
outlives unzeroised, but every clone is one more live copy of the
secret to clear; clone deliberately.
Implementations§
Source§impl Credential
impl Credential
Sourcepub fn expose(&self) -> &str
pub fn expose(&self) -> &str
The credential. Named expose so a reader has to notice — the same
rule SecretBytes in cratefield-secrets follows. Every use is
deliberate and auditable: an adapter reaches it once, to build the
one Authorization header the call needs, and nothing else in the
harness ever should.