@types/tough-cookie

  • Version 4.0.1
  • Published
  • 12.3 kB
  • No dependencies
  • MIT license

Install

npm i @types/tough-cookie
yarn add @types/tough-cookie
pnpm add @types/tough-cookie

Overview

TypeScript definitions for tough-cookie

Index

Variables

variable PrefixSecurityEnum

const PrefixSecurityEnum: Readonly<{
DISABLED: string;
SILENT: string;
STRICT: string;
}>;

    variable version

    const version: string;

      Functions

      function canonicalDomain

      canonicalDomain: (str: string) => string;
      • Transforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).

      function cookieCompare

      cookieCompare: (a: Cookie, b: Cookie) => number;

        function defaultPath

        defaultPath: (path: string) => string;
        • Given a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC.

          The path parameter MUST be only the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the .pathname property of node's uri.parse() output.

        function domainMatch

        domainMatch: (str: string, domStr: string, canonicalize?: boolean) => boolean;
        • Answers "does this real domain match the domain in a cookie?". The str is the "current" domain-name and the domStr is the "cookie" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match".

          The canonicalize parameter will run the other two parameters through canonicalDomain or not.

        function formatDate

        formatDate: (date: Date) => string;
        • Format a Date into a RFC1123 string (the RFC6265-recommended format).

        function fromJSON

        fromJSON: (string: string) => Cookie;
        • alias for Cookie.fromJSON(string)

        function getPublicSuffix

        getPublicSuffix: (hostname: string) => string | null;

          function parse

          parse: (
          cookieString: string,
          options?: Cookie.ParseOptions
          ) => Cookie | undefined;
          • alias for Cookie.parse(cookieString[, options])

          function parseDate

          parseDate: (string: string) => Date;
          • Parse a cookie date string into a Date. Parses according to RFC6265 Section 5.1.1, not Date.parse().

          function pathMatch

          pathMatch: (reqPath: string, cookiePath: string) => boolean;
          • Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4. Returns a boolean.

            This is essentially a prefix-match where cookiePath is a prefix of reqPath.

          function permuteDomain

          permuteDomain: (domain: string, allowSpecialUseDomain?: boolean) => string[];

            function permutePath

            permutePath: (path: string) => string[];

              Classes

              class Cookie {}

                constructor

                constructor(properties?: Cookie.Properties);

                  property creation

                  creation: Date;

                    property creationIndex

                    creationIndex: number;

                      property domain

                      domain: string;

                        property expires

                        expires: Date | 'Infinity';

                          property extensions

                          extensions: string[];

                            property hostOnly

                            hostOnly: boolean;

                              property httpOnly

                              httpOnly: boolean;

                                property key

                                key: string;

                                  property lastAccessed

                                  lastAccessed: Date;

                                    property maxAge

                                    maxAge: number | 'Infinity' | '-Infinity';

                                      property path

                                      path: string;

                                        property pathIsDefault

                                        pathIsDefault: boolean;

                                          property sameSite

                                          sameSite: string;

                                            property secure

                                            secure: boolean;

                                              property value

                                              value: string;

                                                method canonicalizedDomain

                                                canonicalizedDomain: () => string | null;

                                                  method cdomain

                                                  cdomain: () => string | null;

                                                    method clone

                                                    clone: () => Cookie;

                                                      method cookieString

                                                      cookieString: () => string;

                                                        method expiryDate

                                                        expiryDate: (now?: number) => Date;

                                                          method expiryTime

                                                          expiryTime: (now?: number) => number;

                                                            method fromJSON

                                                            static fromJSON: (strOrObj: string | object) => Cookie | null;

                                                              method inspect

                                                              inspect: () => string;

                                                                method isPersistent

                                                                isPersistent: () => boolean;

                                                                  method parse

                                                                  static parse: (
                                                                  cookieString: string,
                                                                  options?: Cookie.ParseOptions
                                                                  ) => Cookie | undefined;

                                                                    method setExpires

                                                                    setExpires: (exp: Date | string) => void;

                                                                      method setMaxAge

                                                                      setMaxAge: (number: number) => void;

                                                                        method toJSON

                                                                        toJSON: () => { [key: string]: any };

                                                                          method toString

                                                                          toString: () => string;

                                                                            method TTL

                                                                            TTL: (now?: Date) => number | typeof Infinity;

                                                                              method validate

                                                                              validate: () => boolean | string;

                                                                                class CookieJar

                                                                                class CookieJar {}

                                                                                  constructor

                                                                                  constructor(store?: Store, options?: CookieJar.Options);

                                                                                    method clone

                                                                                    clone: {
                                                                                    (store?: Store): Promise<CookieJar>;
                                                                                    (store: Store, cb: (err: Error, newJar: CookieJar) => void): void;
                                                                                    (cb: (err: Error, newJar: CookieJar) => void): void;
                                                                                    };

                                                                                      method cloneSync

                                                                                      cloneSync: (store?: Store) => CookieJar;

                                                                                        method deserialize

                                                                                        static deserialize: {
                                                                                        (
                                                                                        serialized: CookieJar.Serialized | string,
                                                                                        store?: Store
                                                                                        ): Promise<CookieJar>;
                                                                                        (
                                                                                        serialized: string | CookieJar.Serialized,
                                                                                        store: Store,
                                                                                        cb: (err: Error, object: CookieJar) => void
                                                                                        ): void;
                                                                                        (
                                                                                        serialized: string | CookieJar.Serialized,
                                                                                        cb: (err: Error, object: CookieJar) => void
                                                                                        ): void;
                                                                                        };

                                                                                          method deserializeSync

                                                                                          static deserializeSync: (
                                                                                          serialized: CookieJar.Serialized | string,
                                                                                          store?: Store
                                                                                          ) => CookieJar;

                                                                                            method fromJSON

                                                                                            static fromJSON: (string: string) => CookieJar;

                                                                                              method getCookies

                                                                                              getCookies: {
                                                                                              (currentUrl: string, options?: CookieJar.GetCookiesOptions): Promise<
                                                                                              Cookie[]
                                                                                              >;
                                                                                              (
                                                                                              currentUrl: string,
                                                                                              options: CookieJar.GetCookiesOptions,
                                                                                              cb: (err: Error, cookies: Cookie[]) => void
                                                                                              ): void;
                                                                                              (currentUrl: string, cb: (err: Error, cookies: Cookie[]) => void): void;
                                                                                              };

                                                                                                method getCookiesSync

                                                                                                getCookiesSync: (
                                                                                                currentUrl: string,
                                                                                                options?: CookieJar.GetCookiesOptions
                                                                                                ) => Cookie[];

                                                                                                  method getCookieString

                                                                                                  getCookieString: {
                                                                                                  (currentUrl: string, options?: CookieJar.GetCookiesOptions): Promise<string>;
                                                                                                  (
                                                                                                  currentUrl: string,
                                                                                                  options: CookieJar.GetCookiesOptions,
                                                                                                  cb: (err: Error, cookies: string) => void
                                                                                                  ): void;
                                                                                                  (currentUrl: string, cb: (err: Error, cookies: string) => void): void;
                                                                                                  };

                                                                                                    method getCookieStringSync

                                                                                                    getCookieStringSync: (
                                                                                                    currentUrl: string,
                                                                                                    options?: CookieJar.GetCookiesOptions
                                                                                                    ) => string;

                                                                                                      method getSetCookieStrings

                                                                                                      getSetCookieStrings: {
                                                                                                      (currentUrl: string, options?: CookieJar.GetCookiesOptions): Promise<
                                                                                                      string[]
                                                                                                      >;
                                                                                                      (
                                                                                                      currentUrl: string,
                                                                                                      options: CookieJar.GetCookiesOptions,
                                                                                                      cb: (err: Error, cookies: string[]) => void
                                                                                                      ): void;
                                                                                                      (currentUrl: string, cb: (err: Error, cookies: string[]) => void): void;
                                                                                                      };

                                                                                                        method getSetCookieStringsSync

                                                                                                        getSetCookieStringsSync: (
                                                                                                        currentUrl: string,
                                                                                                        options?: CookieJar.GetCookiesOptions
                                                                                                        ) => string[];

                                                                                                          method removeAllCookies

                                                                                                          removeAllCookies: { (): Promise<void>; (cb: (err: Error) => void): void };

                                                                                                            method removeAllCookiesSync

                                                                                                            removeAllCookiesSync: () => void;

                                                                                                              method serialize

                                                                                                              serialize: {
                                                                                                              (): Promise<CookieJar.Serialized>;
                                                                                                              (cb: (err: Error, serializedObject: CookieJar.Serialized) => void): void;
                                                                                                              };

                                                                                                                method serializeSync

                                                                                                                serializeSync: () => CookieJar.Serialized;

                                                                                                                  method setCookie

                                                                                                                  setCookie: {
                                                                                                                  (
                                                                                                                  cookieOrString: Cookie | string,
                                                                                                                  currentUrl: string,
                                                                                                                  options?: CookieJar.SetCookieOptions
                                                                                                                  ): Promise<Cookie>;
                                                                                                                  (
                                                                                                                  cookieOrString: string | Cookie,
                                                                                                                  currentUrl: string,
                                                                                                                  options: CookieJar.SetCookieOptions,
                                                                                                                  cb: (err: Error, cookie: Cookie) => void
                                                                                                                  ): void;
                                                                                                                  (
                                                                                                                  cookieOrString: string | Cookie,
                                                                                                                  currentUrl: string,
                                                                                                                  cb: (err: Error, cookie: Cookie) => void
                                                                                                                  ): void;
                                                                                                                  };

                                                                                                                    method setCookieSync

                                                                                                                    setCookieSync: (
                                                                                                                    cookieOrString: Cookie | string,
                                                                                                                    currentUrl: string,
                                                                                                                    options?: CookieJar.SetCookieOptions
                                                                                                                    ) => Cookie;

                                                                                                                      method toJSON

                                                                                                                      toJSON: () => CookieJar.Serialized;

                                                                                                                        class MemoryCookieStore

                                                                                                                        class MemoryCookieStore extends Store {}

                                                                                                                          class Store

                                                                                                                          abstract class Store {}

                                                                                                                            property synchronous

                                                                                                                            synchronous: boolean;

                                                                                                                              method findCookie

                                                                                                                              findCookie: (
                                                                                                                              domain: string,
                                                                                                                              path: string,
                                                                                                                              key: string,
                                                                                                                              cb: (err: Error | null, cookie: Cookie | null) => void
                                                                                                                              ) => void;

                                                                                                                                method findCookies

                                                                                                                                findCookies: (
                                                                                                                                domain: string,
                                                                                                                                path: string,
                                                                                                                                allowSpecialUseDomain: boolean,
                                                                                                                                cb: (err: Error | null, cookie: Cookie[]) => void
                                                                                                                                ) => void;

                                                                                                                                  method getAllCookies

                                                                                                                                  getAllCookies: (cb: (err: Error | null, cookie: Cookie[]) => void) => void;

                                                                                                                                    method putCookie

                                                                                                                                    putCookie: (cookie: Cookie, cb: (err: Error | null) => void) => void;

                                                                                                                                      method removeCookie

                                                                                                                                      removeCookie: (
                                                                                                                                      domain: string,
                                                                                                                                      path: string,
                                                                                                                                      key: string,
                                                                                                                                      cb: (err: Error | null) => void
                                                                                                                                      ) => void;

                                                                                                                                        method removeCookies

                                                                                                                                        removeCookies: (
                                                                                                                                        domain: string,
                                                                                                                                        path: string,
                                                                                                                                        cb: (err: Error | null) => void
                                                                                                                                        ) => void;

                                                                                                                                          method updateCookie

                                                                                                                                          updateCookie: (
                                                                                                                                          oldCookie: Cookie,
                                                                                                                                          newCookie: Cookie,
                                                                                                                                          cb: (err: Error | null) => void
                                                                                                                                          ) => void;

                                                                                                                                            Namespaces

                                                                                                                                            namespace Cookie {}

                                                                                                                                              interface ParseOptions

                                                                                                                                              interface ParseOptions {}

                                                                                                                                                property loose

                                                                                                                                                loose?: boolean | undefined;

                                                                                                                                                  interface Properties

                                                                                                                                                  interface Properties {}

                                                                                                                                                    property creation

                                                                                                                                                    creation?: Date | undefined;

                                                                                                                                                      property creationIndex

                                                                                                                                                      creationIndex?: number | undefined;

                                                                                                                                                        property domain

                                                                                                                                                        domain?: string | undefined;

                                                                                                                                                          property expires

                                                                                                                                                          expires?: Date | undefined;

                                                                                                                                                            property extensions

                                                                                                                                                            extensions?: string[] | undefined;

                                                                                                                                                              property hostOnly

                                                                                                                                                              hostOnly?: boolean | undefined;

                                                                                                                                                                property httpOnly

                                                                                                                                                                httpOnly?: boolean | undefined;

                                                                                                                                                                  property key

                                                                                                                                                                  key?: string | undefined;

                                                                                                                                                                    property lastAccessed

                                                                                                                                                                    lastAccessed?: Date | undefined;

                                                                                                                                                                      property maxAge

                                                                                                                                                                      maxAge?: number | 'Infinity' | '-Infinity' | undefined;

                                                                                                                                                                        property path

                                                                                                                                                                        path?: string | undefined;

                                                                                                                                                                          property pathIsDefault

                                                                                                                                                                          pathIsDefault?: boolean | undefined;

                                                                                                                                                                            property sameSite

                                                                                                                                                                            sameSite?: string | undefined;

                                                                                                                                                                              property secure

                                                                                                                                                                              secure?: boolean | undefined;

                                                                                                                                                                                property value

                                                                                                                                                                                value?: string | undefined;

                                                                                                                                                                                  interface Serialized

                                                                                                                                                                                  interface Serialized {}

                                                                                                                                                                                    index signature

                                                                                                                                                                                    [key: string]: any;

                                                                                                                                                                                      namespace CookieJar

                                                                                                                                                                                      namespace CookieJar {}

                                                                                                                                                                                        interface GetCookiesOptions

                                                                                                                                                                                        interface GetCookiesOptions {}

                                                                                                                                                                                          property allPaths

                                                                                                                                                                                          allPaths?: boolean | undefined;

                                                                                                                                                                                            property expire

                                                                                                                                                                                            expire?: boolean | undefined;

                                                                                                                                                                                              property http

                                                                                                                                                                                              http?: boolean | undefined;

                                                                                                                                                                                                property now

                                                                                                                                                                                                now?: Date | undefined;

                                                                                                                                                                                                  property secure

                                                                                                                                                                                                  secure?: boolean | undefined;

                                                                                                                                                                                                    interface Options

                                                                                                                                                                                                    interface Options {}

                                                                                                                                                                                                      property allowSpecialUseDomain

                                                                                                                                                                                                      allowSpecialUseDomain?: boolean | undefined;

                                                                                                                                                                                                        property looseMode

                                                                                                                                                                                                        looseMode?: boolean | undefined;

                                                                                                                                                                                                          property prefixSecurity

                                                                                                                                                                                                          prefixSecurity?: string | undefined;

                                                                                                                                                                                                            property rejectPublicSuffixes

                                                                                                                                                                                                            rejectPublicSuffixes?: boolean | undefined;

                                                                                                                                                                                                              interface Serialized

                                                                                                                                                                                                              interface Serialized {}

                                                                                                                                                                                                                property cookies

                                                                                                                                                                                                                cookies: Cookie.Serialized[];

                                                                                                                                                                                                                  property rejectPublicSuffixes

                                                                                                                                                                                                                  rejectPublicSuffixes: boolean;

                                                                                                                                                                                                                    property storeType

                                                                                                                                                                                                                    storeType: string;

                                                                                                                                                                                                                      property version

                                                                                                                                                                                                                      version: string;

                                                                                                                                                                                                                        interface SetCookieOptions

                                                                                                                                                                                                                        interface SetCookieOptions {}

                                                                                                                                                                                                                          property http

                                                                                                                                                                                                                          http?: boolean | undefined;

                                                                                                                                                                                                                            property ignoreError

                                                                                                                                                                                                                            ignoreError?: boolean | undefined;

                                                                                                                                                                                                                              property now

                                                                                                                                                                                                                              now?: Date | undefined;

                                                                                                                                                                                                                                property secure

                                                                                                                                                                                                                                secure?: boolean | undefined;

                                                                                                                                                                                                                                  Package Files (1)

                                                                                                                                                                                                                                  Dependencies (0)

                                                                                                                                                                                                                                  No dependencies.

                                                                                                                                                                                                                                  Dev Dependencies (0)

                                                                                                                                                                                                                                  No dev dependencies.

                                                                                                                                                                                                                                  Peer Dependencies (0)

                                                                                                                                                                                                                                  No peer dependencies.

                                                                                                                                                                                                                                  Badge

                                                                                                                                                                                                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/tough-cookie.

                                                                                                                                                                                                                                  • Markdown
                                                                                                                                                                                                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/tough-cookie)
                                                                                                                                                                                                                                  • HTML
                                                                                                                                                                                                                                    <a href="https://www.jsdocs.io/package/@types/tough-cookie"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>