Nonces and epochs
A nonce is 12 bytes. Its first four bytes are an epoch (u32 LE) and its last eight are a counter (u64 LE), as laid out in the seal trailer.
Keyring::openloadsepochfrom the keyring file and immediately persistsepoch + 1. The in-memory counter restarts at 0. Each process lifetime therefore owns a fresh epoch.observe_epochsadvances the epoch past any epoch found on disk before the first seal. It looks at WAL blocks, MANIFEST records and authenticated SEAM footers (SPEC V58, V164). A restored older keyring therefore cannot reuse a nonce.- Epoch or counter overflow is
NonceExhausted. The remedy is to rotate the data key, see Key hierarchy.
The order of these steps at startup is on Open sequence.
Epoch and WAL generation
Section titled “Epoch and WAL generation”A WAL block stores the keyring epoch at write time as its generation, and a block is valid only if that equals the epoch in its own nonce.