Shipmind Labs

An expired consent record should not become valid again just because someone wrote a new storage adapter. So we stopped treating expiry as a storage concern.

In consentcore, our open-source project, the thirteen-month window is enforced by the restore function, not by wherever the record happened to sit.

The mechanics, in order:

restore takes whatever stored consent it is handed and normalises it into a log. It reads the last entry. If there is none, you get the unset state.

Then it checks whether the stored decision answered the notice the user is seeing now, comparing both the notice version and the notice hash. A decision that answered a different notice comes back as unset, before expiry is even considered.

Only then does it compute expiry: the decision timestamp plus thirteen months, measured against the current clock. At or past that point the result is unset again (decision null, pending true, and the log left untouched).

That last detail is the one that matters in practice. The log is not rewritten, so the audit trail still reports the lapsed method and timestamp, while the live permission check refuses every category except necessary. You keep the history and you lose the permission. Those are two different questions, and collapsing them is how teams end up unable to prove what a user once agreed to.

Two edge cases we made explicit rather than incidental:

The comparison is "now is at or past the expiry instant", so the final second of the window still restores as answered. That is not an off-by-one, it is a decision.

And adding thirteen months to, say, a 31st rolls back to the last day of the target month. An unparsable timestamp is treated as already expired, not as valid.

Our storage adapters (local storage, cookies, header parsing) still drop lapsed entries on their own. That is housekeeping, not enforcement. Because the store interface is a type that callers implement, someone will probably write one that keeps records forever, or one backed by a server that never prunes. With the window applied on read, that store is harmless. With the window applied on write, it is a compliance bug wearing a plugin interface.

The general rule we now apply to anything regulatory: enforce the rule at the point of use, where there is exactly one implementation, not at the point of persistence, where there are as many implementations as integrators.

You draw that line somewhere too. Either your retention and consent rules live in the data layer, or they live in the code that answers "is this allowed right now?"

Was this useful?

Building something similar?

or email hello@shipmindlabs.com