Skip to content
1.3.0 documentation · List APIs, scoped deletion, and normalized errors are available from 1.3.0. View release history ↗

Types ​

Import types from the package root. Optional fields may be unavailable in a native query result.

ts
interface Cookie {
  name: string;
  value: string;
  path?: string;
  domain?: string;
  version?: string;
  expires?: string;
  secure?: boolean;
  httpOnly?: boolean;
}
FieldMeaning
name, valueRequired for a structured write.
pathDefaults to / when writing. Unknown in Android URL lists.
domainDefaults to the URL host when writing. Apple lists preserve the stored leading dot. Unknown in Android URL lists.
versionOptional legacy field; do not rely on a portable native effect.
expiresISO 8601 timestamp. Use fractional seconds and a timezone, such as 2030-01-01T00:00:00.000Z. Omit for a session cookie. Lifetime follows the store.
secureRestricts request sending to HTTPS.
httpOnlyBrowser script-access flag. Native APIs can still read the cookie.

SameSite and Max-Age are not fields on this interface. Raw Set-Cookie handling follows the platform; structured results do not expose every possible header attribute.

Cookies ​

ts
type Cookies = Record<string, Cookie>;

Dictionary keys are names. A later native entry replaces an earlier entry with the same name. Use Cookie[] list results when duplicates matter.

CookieIdentifier ​

Added in 1.3.0. Used by clearCookie and clearCookieSync.

ts
interface CookieIdentifier {
  name: string;
  path: string;
  domain?: string;
}

path is required and must start with /. Missing domain selects host-only deletion for the URL host. An explicit domain selects that stored scope. Android callers must retain the original scope; URL queries cannot recover it. See scoped deletion for the Android write-default distinction.

CookieError ​

ts
interface CookieError extends Error {
  code: CookieErrorCode | string;
  cause?: unknown;
  url?: string;
  cookieName?: string;
}

This is a TypeScript interface, not a runtime class for instanceof checks. The operation wrapper sets cause and preserves the original message and stack where available. See errors for the runtime enum and fallback behavior.

MIT licensed · React Native Nitro Cookies