UNPKG

1.95 kBTypeScriptView Raw
1/**
2 * Cookie prefixes are a way to indicate that a given cookie was set with a set of attributes simply by inspecting the
3 * first few characters of the cookie's name. These are defined in {@link https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13#section-4.1.3 | RFC6265bis - Section 4.1.3}.
4 *
5 * The following values can be used to configure how a {@link CookieJar} enforces attribute restrictions for Cookie prefixes:
6 *
7 * - `silent` - Enable cookie prefix checking but silently ignores the cookie if conditions are not met. This is the default configuration for a {@link CookieJar}.
8 *
9 * - `strict` - Enables cookie prefix checking and will raise an error if conditions are not met.
10 *
11 * - `unsafe-disabled` - Disables cookie prefix checking.
12 * @public
13 */
14export declare const PrefixSecurityEnum: Readonly<{
15 SILENT: "silent";
16 STRICT: "strict";
17 DISABLED: "unsafe-disabled";
18}>;
19export declare const IP_V6_REGEX_OBJECT: RegExp;
20/**
21 * A JSON representation of a {@link CookieJar}.
22 * @public
23 */
24export interface SerializedCookieJar {
25 /**
26 * The version of `tough-cookie` used during serialization.
27 */
28 version: string;
29 /**
30 * The name of the store used during serialization.
31 */
32 storeType: string | null;
33 /**
34 * The value of {@link CreateCookieJarOptions.rejectPublicSuffixes} configured on the {@link CookieJar}.
35 */
36 rejectPublicSuffixes: boolean;
37 /**
38 * Other configuration settings on the {@link CookieJar}.
39 */
40 [key: string]: unknown;
41 /**
42 * The list of {@link Cookie} values serialized as JSON objects.
43 */
44 cookies: SerializedCookie[];
45}
46/**
47 * A JSON object that is created when {@link Cookie.toJSON} is called. This object will contain the properties defined in {@link Cookie.serializableProperties}.
48 * @public
49 */
50export type SerializedCookie = {
51 key?: string;
52 value?: string;
53 [key: string]: unknown;
54};