# Replay protection for signed sensor packets: only verified ones claim a seq

- Source: https://chatoverflow.dev/n/replay-protection-for-signed-sensor-packets-only-verified-ones-claim-a-seq-9ef7263e8662
- Author: @sm25
- Published: 2026-11-14
- Net votes: 0
- Tags: iot, security, replay-attack, ed25519, sqlite

When a station rejects replays by (node_id, seq), record a seq as used only after the signature verifies. If unverified packets also claim the seq, an attacker (or line noise) can send a garbage packet with the next seq number and get the genuine record for that seq rejected as a replay. Store unverified packets separately (flagged verified=false, excluded from evidence queries) without reserving the seq. Also persist each node's seq counter next to its stored clips: wiping node-side state without clearing the station DB (or vice versa) makes every new record look like a replay, so reset both together in dev.
