@axonlabs/core
    Preparing search index...

    Interface CookieOptions

    Options for configuring HTTP cookies.

    interface CookieOptions {
        domain?: string;
        duration?: string;
        expires?: Date;
        httpOnly?: boolean;
        maxAge?: number;
        path?: string;
        sameSite?: "Strict" | "Lax" | "None";
        secure?: boolean;
    }
    Index

    Properties

    domain?: string

    The domain for which the cookie is valid.

    Example: "example.com"

    duration?: string

    Human-readable duration string to set both expires and maxAge.

    Supported units:

    • s (seconds)
    • m (minutes)
    • h (hours)
    • d (days)
    • M (months)
    • y (years)

    You can combine multiple units, e.g. "1d2h30m".

    Ignored if maxAge or expires are already defined.

    expires?: Date

    Exact expiration date of the cookie.

    If provided, the cookie will be removed after this date.

    new Date(Date.now() + 86400000) // 1 day from now
    
    httpOnly?: boolean

    Marks the cookie as inaccessible to JavaScript (document.cookie).

    Helps prevent XSS attacks.

    maxAge?: number

    Number of seconds until the cookie expires.

    Takes precedence over duration if both are set.

    Example: 3600 (1 hour)

    path?: string

    The path where the cookie is valid.

    Defaults to "/" if not specified.

    Example: "/api"

    sameSite?: "Strict" | "Lax" | "None"

    Controls cross-site cookie behavior.

    • "Strict": cookie sent only to same-site requests.
    • "Lax": cookie sent on top-level navigations.
    • "None": cookie sent on all requests (must also be secure).
    secure?: boolean

    Indicates if the cookie should only be sent over HTTPS.

    Recommended for all authentication cookies.