Consent state & receipts
ConsentState
Section titled “ConsentState”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};ConsentMethod
Section titled “ConsentMethod”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.
Receipts & audit log
Section titled “Receipts & audit log”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.