MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / ensure_mac_key

Method ensure_mac_key

atomic-agent/src/turn/session.rs:582–589  ·  view source on GitHub ↗

The per-session MAC key, creating it on first use. Evidence-quality key (constraint 1): 32 bytes of OS randomness with a deterministic fallback when `/dev/urandom` is unavailable. Stored beside the evidence, so it detects tampering and cross-session forgery rather than resisting a determined local writer.

(&mut self)

Source from the content-addressed store, hash-verified

580 /// beside the evidence, so it detects tampering and cross-session
581 /// forgery rather than resisting a determined local writer.
582 pub fn ensure_mac_key(&mut self) -> String {
583 if let Some(key) = &self.mac_key {
584 return key.clone();
585 }
586 let key = random_mac_key();
587 self.mac_key = Some(key.clone());
588 key
589 }
590
591 /// Persist the first incomplete outcome observed for this session.
592 pub fn mark_incomplete(&mut self, incomplete: IncompleteSession) -> &IncompleteSession {

Callers 2

write_captureFunction · 0.80

Calls 2

random_mac_keyFunction · 0.85
cloneMethod · 0.45

Tested by 1