MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / touch

Method touch

nodedb/src/control/security/auth_apikey.rs:197–207  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 2

last_used_trackingFunction · 0.45

Calls 5

to_stringMethod · 0.80
now_secsFunction · 0.70
writeMethod · 0.45
get_mutMethod · 0.45
is_validMethod · 0.45

Tested by 2

last_used_trackingFunction · 0.36