Crumbie

Consent Storage

Consent is stored entirely client-side in localStorage. No backend required.

Record shape

ts
{
  version: 1,
  acceptedAt: "2026-07-17T12:00:00.000Z",
  expiresAt: "2027-07-17T12:00:00.000Z",
  preferences: {
    necessary: true,
    preferences: true,
    analytics: false,
    marketing: false
  }
}

Behavior

  • Expiration — expired records are cleared and the banner reappears
  • Version changes — bumping the version invalidates previous consent
  • Corruption — invalid JSON or schema is removed safely
  • Necessary — always true, cannot be disabled
  • SSR safety — localStorage is only accessed after mount

Reset

Call resetConsent() to clear storage and show the banner again.