A HTTP cookie.

A Cookie is a logical container for metadata about a HTTP cookie; its name and options. But it doesn't contain a value. Instead, it has parse() and serialize() methods that allow a single instance to be reused for parsing/encoding multiple different values.

interface Cookie {
    expires?: Date;
    isSigned: boolean;
    name: string;
    parse(cookieHeader: null | string, options?: CookieParseOptions): Promise<any>;
    serialize(value: any, options?: CookieSerializeOptions): Promise<string>;
}

Properties

expires?: Date

The Date this cookie expires.

Note: This is calculated at access time using maxAge when no expires option is provided to createCookie().

isSigned: boolean

True if this cookie uses one or more secrets for verification.

name: string

The name of the cookie, used in the Cookie and Set-Cookie headers.

Methods