## `ConsentState`

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

```ts
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`

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

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`.

:::note[More detail coming]
Field-level detail is being migrated from the consent and API sections of the
repo docs. See the [JavaScript API](/api/javascript-api/) for reading state.
:::