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)
| 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 { |