Skip to content

Consent state & receipts

getConsent() and onConsentChange(fn) return the current decision:

type ConsentState = {
version: number;
choices: Record<CategoryId, boolean>; // necessary/preferences/statistics/marketing
method: ConsentMethod;
timestamp: number;
regulation: "gdpr" | "ccpa" | "none";
id: string; // opaque per-decision id linking record → audit row → receipt
};

How the decision was made:

accept_all · reject_all · custom · implicit · gpc

Only non-implicit (explicit) decisions are posted to the backend and receive a receipt.

Every explicit decision can produce:

  • A downloadable JSON consent receipt — proof of consent, offered in the preferences modal footer.
  • A server-side audit record (append-only) with an optional SHA-256 receipt hash, so a client-side record links to a verifiable server row via the shared id.