Skip to content

session lifecycle: TTL, decrypt recovery, pending WHOAREYOU caps#29

Merged
ch4r10t33r merged 1 commit into
mainfrom
feat/session-lifecycle
May 10, 2026
Merged

session lifecycle: TTL, decrypt recovery, pending WHOAREYOU caps#29
ch4r10t33r merged 1 commit into
mainfrom
feat/session-lifecycle

Conversation

@ch4r10t33r
Copy link
Copy Markdown
Owner

Summary

  • Session cache: optional session_ttl_ms on SessionTable; entries track last_seen_ms; get/put take now_ms; successful get refreshes activity (extends TTL).
  • Node: handleReceive(..., now_ms) — callers supply a ms clock for TTL and pending bookkeeping (breaking API).
  • Decrypt failure with a cached session: remove session and answer WHOAREYOU so the peer can re-handshake.
  • Pending WHOAREYOU: pending_challenge_ttl_ms, pending_challenge_cap (oldest evicted when full); challenges store created_ms.
  • udp_runtime: pumpOnce(..., now_ms) forwards the clock.

Tests

  • zig build test (includes SessionTable TTL, node decrypt-fail + session TTL, existing node/udp coverage updated for now_ms).

Closes #19

Add optional session TTL (last_seen_ms on SessionTable entries), handleReceive(now_ms), pending challenge TTL and cap with oldest eviction, and drop session + WHOAREYOU on GCM decrypt failure. pumpOnce forwards now_ms. Tests cover TTL, decrypt mismatch, and SessionTable expiry.
@ch4r10t33r ch4r10t33r merged commit acb3d6a into main May 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

discv5: session lifecycle (expiry, re-handshake, pending WHOAREYOU)

1 participant