pub struct DigestKey { /* private fields */ }Expand description
The host’s digest key (3.4.5): 32 to 64 bytes, named by an opaque
key_id. It is never serialized, and its Debug form shows only the
key_id.
Implementations§
Source§impl DigestKey
impl DigestKey
Sourcepub fn new(key_id: &str, key: &[u8]) -> Result<Self, KeyError>
pub fn new(key_id: &str, key: &[u8]) -> Result<Self, KeyError>
A key of 32 to 64 bytes named by a key_id of 1 to 64 bytes.
Sourcepub fn digest(&self, class: FieldClass, value: &TraceValue) -> String
pub fn digest(&self, class: FieldClass, value: &TraceValue) -> String
hmac-sha256:<64 lowercase hex> of HMAC-SHA256 under this key over
"rustev.digest/1" 0x00 <class> 0x00 <value bytes>, where value
bytes are a string’s UTF-8 or the canonical JSON of any other value.
The class is the domain, so one id correlates across the fields of
its class.
Trait Implementations§
Source§impl Drop for DigestKey
The key bytes are overwritten when the key is dropped, so they do not
outlive it in freed memory. Best effort in safe code: spec 028 3.1.1
gives this crate hmac as its one new dependency (so no zeroize) and
the crate forbids unsafe (so no volatile write); black_box keeps the
compiler from eliding the overwrite as a dead store. The per-call HMAC
state derived from the key is not covered.
impl Drop for DigestKey
The key bytes are overwritten when the key is dropped, so they do not
outlive it in freed memory. Best effort in safe code: spec 028 3.1.1
gives this crate hmac as its one new dependency (so no zeroize) and
the crate forbids unsafe (so no volatile write); black_box keeps the
compiler from eliding the overwrite as a dead store. The per-call HMAC
state derived from the key is not covered.