Update last-used tracking after successful verification. No-op on keys that are no longer valid — prevents audit trails from silently recording post-rotation use of a dead key as if it were live.
(&self, key_id: &str, ip: &str)
| 195 | /// No-op on keys that are no longer valid — prevents audit trails from |
| 196 | /// silently recording post-rotation use of a dead key as if it were live. |
| 197 | pub fn touch(&self, key_id: &str, ip: &str) { |
| 198 | let now = now_secs(); |
| 199 | let mut keys = self.keys.write().unwrap_or_else(|p| p.into_inner()); |
| 200 | if let Some(key) = keys.get_mut(key_id) { |
| 201 | if !key.is_valid(now) { |
| 202 | return; |
| 203 | } |
| 204 | key.last_used_at = now; |
| 205 | key.last_used_ip = ip.to_string(); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /// Revoke a key. |
| 210 | pub fn revoke(&self, key_id: &str) -> bool { |