Interface TypedCookie<Schema>

interface TypedCookie<Schema extends z.ZodTypeAny> {
    expires?: Date;
    isSigned: boolean;
    isTyped: true;
    name: string;
    parse(
        cookieHeader: null | string,
        options?: ParseOptions,
    ): Promise<null | TypeOf<Schema>>;
    serialize(
        value: input<Schema>,
        options?: SerializeOptions,
    ): Promise<string>;
}

Type Parameters

  • Schema extends z.ZodTypeAny

Hierarchy

  • Cookie
    • TypedCookie

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.

isTyped: true
name: string

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

Methods

  • Parses a raw Cookie header and returns the value of this cookie or null if it's not present.

    Parameters

    • cookieHeader: null | string
    • Optionaloptions: ParseOptions

    Returns Promise<null | TypeOf<Schema>>

  • Serializes the given value to a string and returns the Set-Cookie header.

    Parameters

    • value: input<Schema>
    • Optionaloptions: SerializeOptions

    Returns Promise<string>