+ +Package + + + | + +Description + + + |
---|---|
+ +[tough-cookie](./tough-cookie.md) + + + | + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domainName + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +the domain name to generate the canonical domain from + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +options + + + | + +[CreateCookieOptions](./tough-cookie.createcookieoptions.md) + + + | + +_(Optional)_ The attributes to set on the cookie + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +now + + + | + +Date + + + | + +_(Optional)_ can be used to provide a time offset (instead of [Cookie.lastAccessed](./tough-cookie.cookie.lastaccessed.md)) to use when calculating the "Max-Age" value + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +str + + + | + +unknown + + + | + +An unparsed JSON string or a value that has already been parsed as JSON + + + |
+ +Constructor + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[(constructor)(options)](./tough-cookie.cookie._constructor_.md) + + + | + + + | + +Create a new Cookie instance. + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[creation](./tough-cookie.cookie.creation.md) + + + | + + + | + +Date \| 'Infinity' \| null + + + | + +Set to the date and time when a Cookie is initially stored or a matching cookie is received that replaces an existing cookie (See [RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)). + +Also used to maintain ordering among cookies. Among cookies that have equal-length path fields, cookies with earlier creation-times are listed before cookies with later creation-times (See [RFC6265 Section 5.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4)). + + + |
+ +[creationIndex](./tough-cookie.cookie.creationindex.md) + + + | + + + | + +number + + + | + +A global counter used to break ordering ties between two cookies that have equal-length path fields and the same creation-time. + + + |
+ +[domain](./tough-cookie.cookie.domain.md) + + + | + + + | + +string \| null + + + | + +The 'Domain' attribute of the cookie represents the domain the cookie belongs to (See [RFC6265 Section 5.2.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.3)). + + + |
+ +[expires](./tough-cookie.cookie.expires.md) + + + | + + + | + +Date \| 'Infinity' \| null + + + | + +The 'Expires' attribute of the cookie (See [RFC6265 Section 5.2.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.1)). + + + |
+ +[extensions](./tough-cookie.cookie.extensions.md) + + + | + + + | + +string\[\] \| null + + + | + +Contains attributes which are not part of the defined spec but match the `extension-av` syntax defined in Section 4.1.1 of RFC6265 (See [RFC6265 Section 4.1.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-4.1.1)). + + + |
+ +[hostOnly](./tough-cookie.cookie.hostonly.md) + + + | + + + | + +boolean \| null + + + | + +A boolean flag indicating if a cookie is a host-only cookie (i.e.; when the request's host exactly matches the domain of the cookie) or not (See [RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)). + + + |
+ +[httpOnly](./tough-cookie.cookie.httponly.md) + + + | + + + | + +boolean + + + | + +The 'HttpOnly' flag of the cookie indicates if the cookie is inaccessible to client scripts or not (See [RFC6265 Section 5.2.6](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.6)). + + + |
+ +[key](./tough-cookie.cookie.key.md) + + + | + + + | + +string + + + | + +The name or key of the cookie + + + |
+ +[lastAccessed](./tough-cookie.cookie.lastaccessed.md) + + + | + + + | + +Date \| 'Infinity' \| null + + + | + +Set to the date and time when a cookie was initially stored ([RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)) and updated whenever the cookie is retrieved from the [CookieJar](./tough-cookie.cookiejar.md) ([RFC6265 Section 5.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4)). + + + |
+ +[maxAge](./tough-cookie.cookie.maxage.md) + + + | + + + | + +number \| 'Infinity' \| '-Infinity' \| null + + + | + +The 'Max-Age' attribute of the cookie (See [RFC6265 Section 5.2.2](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.2)). + + + |
+ +[path](./tough-cookie.cookie.path.md) + + + | + + + | + +string \| null + + + | + +The 'Path' attribute of the cookie represents the path of the cookie (See [RFC6265 Section 5.2.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.4)). + + + |
+ +[pathIsDefault](./tough-cookie.cookie.pathisdefault.md) + + + | + + + | + +boolean \| null + + + | + +A boolean flag indicating if a cookie had no 'Path' attribute and the default path was used (See [RFC6265 Section 5.2.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.4)). + + + |
+ +[sameSite](./tough-cookie.cookie.samesite.md) + + + | + + + | + +string \| undefined + + + | + +The 'SameSite' attribute of a cookie as defined in RFC6265bis (See [RFC6265bis (v13) Section 5.2](https://www.ietf.org/archive/id/draft-ietf-httpbis-rfc6265bis-13.html#section-5.2)). + + + |
+ +[secure](./tough-cookie.cookie.secure.md) + + + | + + + | + +boolean + + + | + +The 'Secure' flag of the cookie indicates if the scope of the cookie is limited to secure channels (e.g.; HTTPS) or not (See [RFC6265 Section 5.2.5](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.5)). + + + |
+ +[serializableProperties](./tough-cookie.cookie.serializableproperties.md) + + + | + +`static` + + + | + +readonly \["key", "value", "expires", "maxAge", "domain", "path", "secure", "httpOnly", "extensions", "hostOnly", "pathIsDefault", "creation", "lastAccessed", "sameSite"\] + + + | + +Cookie properties that will be serialized when using [Cookie.fromJSON()](./tough-cookie.cookie.fromjson.md) and [Cookie.toJSON()](./tough-cookie.cookie.tojson.md). + + + |
+ +[value](./tough-cookie.cookie.value.md) + + + | + + + | + +string + + + | + +The value of the cookie + + + |
+ +Method + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[canonicalizedDomain()](./tough-cookie.cookie.canonicalizeddomain.md) + + + | + + + | + +Calls [canonicalDomain()](./tough-cookie.canonicaldomain.md) with the [Cookie.domain](./tough-cookie.cookie.domain.md) property. + + + |
+ +[cdomain()](./tough-cookie.cookie.cdomain.md) + + + | + + + | + +Alias for [Cookie.canonicalizedDomain()](./tough-cookie.cookie.canonicalizeddomain.md) + + + |
+ +[clone()](./tough-cookie.cookie.clone.md) + + + | + + + | + +Does a deep clone of this cookie, implemented exactly as `Cookie.fromJSON(cookie.toJSON())`. + + + |
+ +[cookieString()](./tough-cookie.cookie.cookiestring.md) + + + | + + + | + +Encodes to a `Cookie` header value (specifically, the [Cookie.key](./tough-cookie.cookie.key.md) and [Cookie.value](./tough-cookie.cookie.value.md) properties joined with "="). + + + |
+ +[expiryTime(now)](./tough-cookie.cookie.expirytime.md) + + + | + + + | + +Computes the absolute unix-epoch milliseconds that this cookie expires. + +The "Max-Age" attribute takes precedence over "Expires" (as per the RFC). The [Cookie.lastAccessed](./tough-cookie.cookie.lastaccessed.md) attribute (or the `now` parameter if given) is used to offset the [Cookie.maxAge](./tough-cookie.cookie.maxage.md) attribute. + +If Expires ([Cookie.expires](./tough-cookie.cookie.expires.md)) is set, that's returned. + + + |
+ +[fromJSON(str)](./tough-cookie.cookie.fromjson.md) + + + | + +`static` + + + | + +Does the reverse of [Cookie.toJSON()](./tough-cookie.cookie.tojson.md). + + + |
+ +[isPersistent()](./tough-cookie.cookie.ispersistent.md) + + + | + + + | + +Indicates if the cookie has been persisted to a store or not. + + + |
+ +[parse(str, options)](./tough-cookie.cookie.parse.md) + + + | + +`static` + + + | + +Parses a string into a Cookie object. + + + |
+ +[setExpires(exp)](./tough-cookie.cookie.setexpires.md) + + + | + + + | + +Sets the 'Expires' attribute on a cookie. + + + |
+ +[setMaxAge(age)](./tough-cookie.cookie.setmaxage.md) + + + | + + + | + +Sets the 'Max-Age' attribute (in seconds) on a cookie. + + + |
+ +[toJSON()](./tough-cookie.cookie.tojson.md) + + + | + + + | + +For convenience in using `JSON.stringify(cookie)`. Returns a plain-old Object that can be JSON-serialized. + + + |
+ +[toString()](./tough-cookie.cookie.tostring.md) + + + | + + + | + +Encodes to a `Set-Cookie header` value. + + + |
+ +[TTL(now)](./tough-cookie.cookie.ttl.md) + + + | + + + | + +Computes the TTL relative to now (milliseconds). + + + |
+ +[validate()](./tough-cookie.cookie.validate.md) + + + | + + + | + +**_(BETA)_** Validates cookie attributes for semantic correctness. Useful for "lint" checking any `Set-Cookie` headers you generate. For now, it returns a boolean, but eventually could return a reason string. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +str + + + | + +string + + + | + +The `Set-Cookie` header or a Cookie string to parse. + + + |
+ +options + + + | + +[ParseCookieOptions](./tough-cookie.parsecookieoptions.md) + + + | + +_(Optional)_ Configures `strict` or `loose` mode for cookie parsing + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +exp + + + | + +string \| Date + + + | + +the new value for the 'Expires' attribute of the cookie. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +age + + + | + +number + + + | + +the new value for the 'Max-Age' attribute (in seconds). + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +now + + + | + +number + + + | + +_(Optional)_ passing an explicit value is mostly used for testing purposes since this defaults to the `Date.now()` + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +a + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the first Cookie for comparison + + + |
+ +b + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the second Cookie for comparison + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +store + + + | + +[Nullable](./tough-cookie.nullable.md)<[Store](./tough-cookie.store.md)> + + + | + +_(Optional)_ a custom [Store](./tough-cookie.store.md) implementation (defaults to [MemoryCookieStore](./tough-cookie.memorycookiestore.md)) + + + |
+ +options + + + | + +[CreateCookieJarOptions](./tough-cookie.createcookiejaroptions.md) \| boolean + + + | + +_(Optional)_ configures how cookies are processed by the cookie jar + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[CookieJar](./tough-cookie.cookiejar.md)> + + + | + +A function to call when the CookieJar is cloned. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +newStore + + + | + +[Store](./tough-cookie.store.md) + + + | + +The target [Store](./tough-cookie.store.md) to clone cookies into. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[CookieJar](./tough-cookie.cookiejar.md)> + + + | + +A function to call when the CookieJar is cloned. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +newStore + + + | + +[Store](./tough-cookie.store.md) + + + | + +_(Optional)_ The target [Store](./tough-cookie.store.md) to clone cookies into. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +newStore + + + | + +[Store](./tough-cookie.store.md) + + + | + +_(Optional)_ The target [Store](./tough-cookie.store.md) to clone cookies into. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +strOrObj + + + | + +string \| object + + + | + +A JSON string or object representing the deserialized cookies. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[CookieJar](./tough-cookie.cookiejar.md)> + + + | + +A function to call after the [CookieJar](./tough-cookie.cookiejar.md) has been deserialized. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +strOrObj + + + | + +string \| object + + + | + +A JSON string or object representing the deserialized cookies. + + + |
+ +store + + + | + +[Store](./tough-cookie.store.md) + + + | + +The underlying store to persist the deserialized cookies into. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[CookieJar](./tough-cookie.cookiejar.md)> + + + | + +A function to call after the [CookieJar](./tough-cookie.cookiejar.md) has been deserialized. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +strOrObj + + + | + +string \| object + + + | + +A JSON string or object representing the deserialized cookies. + + + |
+ +store + + + | + +[Store](./tough-cookie.store.md) + + + | + +_(Optional)_ The underlying store to persist the deserialized cookies into. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +strOrObj + + + | + +string \| [SerializedCookieJar](./tough-cookie.serializedcookiejar.md) + + + | + +A JSON string or object representing the deserialized cookies. + + + |
+ +store + + + | + +[Store](./tough-cookie.store.md) + + + | + +_(Optional)_ The underlying store to persist the deserialized cookies into. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +jsonString + + + | + +string \| [SerializedCookieJar](./tough-cookie.serializedcookiejar.md) + + + | + +A JSON string or object representing the deserialized cookies. + + + |
+ +store + + + | + +[Store](./tough-cookie.store.md) + + + | + +_(Optional)_ The underlying store to persist the deserialized cookies into. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md)\[\]> + + + | + +A function to call after a cookie has been successfully retrieved. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string \| URL + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) \| undefined + + + | + +Configuration settings to use when retrieving the cookies. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md)\[\]> + + + | + +A function to call after a cookie has been successfully retrieved. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string \| URL + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) \| undefined + + + | + +_(Optional)_ Configuration settings to use when retrieving the cookies. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +_(Optional)_ Configuration settings to use when retrieving the cookies. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +Configuration settings to use when retrieving the cookies. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<string \| undefined> + + + | + +A function to call after the `Cookie` header string has been created. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<string \| undefined> + + + | + +A function to call after the `Cookie` header string has been created. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +_(Optional)_ Configuration settings to use when retrieving the cookies. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +_(Optional)_ Configuration settings to use when retrieving the cookies. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<string\[\] \| undefined> + + + | + +A function to call after the `Set-Cookie` header strings have been created. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +Configuration settings to use when retrieving the cookies. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<string\[\] \| undefined> + + + | + +A function to call after the `Set-Cookie` header strings have been created. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +_(Optional)_ Configuration settings to use when retrieving the cookies. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +_(Optional)_ Configuration settings to use when retrieving the cookies. + + + |
+ +Constructor + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[(constructor)(store, options)](./tough-cookie.cookiejar._constructor_.md) + + + | + + + | + +Creates a new `CookieJar` instance. + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[prefixSecurity](./tough-cookie.cookiejar.prefixsecurity.md) + + + | + +`readonly` + + + | + +string + + + | + +The configured [PrefixSecurityEnum](./tough-cookie.prefixsecurityenum.md) value for the [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +[store](./tough-cookie.cookiejar.store.md) + + + | + +`readonly` + + + | + +[Store](./tough-cookie.store.md) + + + | + +The configured [Store](./tough-cookie.store.md) for the [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +Method + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[clone(callback)](./tough-cookie.cookiejar.clone.md) + + + | + + + | + +Produces a deep clone of this CookieJar. Modifications to the original do not affect the clone, and vice versa. + + + |
+ +[clone(newStore, callback)](./tough-cookie.cookiejar.clone_1.md) + + + | + + + | + +Produces a deep clone of this CookieJar. Modifications to the original do not affect the clone, and vice versa. + + + |
+ +[clone(newStore)](./tough-cookie.cookiejar.clone_2.md) + + + | + + + | + +Produces a deep clone of this CookieJar. Modifications to the original do not affect the clone, and vice versa. + + + |
+ +[cloneSync(newStore)](./tough-cookie.cookiejar.clonesync.md) + + + | + + + | + +Produces a deep clone of this CookieJar. Modifications to the original do not affect the clone, and vice versa. + +Note: Only works if both the configured Store and destination Store are synchronous. + + + |
+ +[deserialize(strOrObj, callback)](./tough-cookie.cookiejar.deserialize.md) + + + | + +`static` + + + | + +A new CookieJar is created and the serialized [Cookie](./tough-cookie.cookie.md) values are added to the underlying store. Each [Cookie](./tough-cookie.cookie.md) is added via `store.putCookie(...)` in the order in which they appear in the serialization. + + + |
+ +[deserialize(strOrObj, store, callback)](./tough-cookie.cookiejar.deserialize_1.md) + + + | + +`static` + + + | + +A new CookieJar is created and the serialized [Cookie](./tough-cookie.cookie.md) values are added to the underlying store. Each [Cookie](./tough-cookie.cookie.md) is added via `store.putCookie(...)` in the order in which they appear in the serialization. + + + |
+ +[deserialize(strOrObj, store)](./tough-cookie.cookiejar.deserialize_2.md) + + + | + +`static` + + + | + +A new CookieJar is created and the serialized [Cookie](./tough-cookie.cookie.md) values are added to the underlying store. Each [Cookie](./tough-cookie.cookie.md) is added via `store.putCookie(...)` in the order in which they appear in the serialization. + + + |
+ +[deserializeSync(strOrObj, store)](./tough-cookie.cookiejar.deserializesync.md) + + + | + +`static` + + + | + +A new CookieJar is created and the serialized [Cookie](./tough-cookie.cookie.md) values are added to the underlying store. Each [Cookie](./tough-cookie.cookie.md) is added via `store.putCookie(...)` in the order in which they appear in the serialization. + +Note: Only works if the configured Store is also synchronous. + + + |
+ +[fromJSON(jsonString, store)](./tough-cookie.cookiejar.fromjson.md) + + + | + +`static` + + + | + +Alias of [CookieJar.deserializeSync()](./tough-cookie.cookiejar.deserializesync.md). + + + |
+ +[getCookies(url, callback)](./tough-cookie.cookiejar.getcookies.md) + + + | + + + | + +Retrieve the list of cookies that can be sent in a Cookie header for the current URL. + + + |
+ +[getCookies(url, options, callback)](./tough-cookie.cookiejar.getcookies_1.md) + + + | + + + | + +Retrieve the list of cookies that can be sent in a Cookie header for the current URL. + + + |
+ +[getCookies(url, options)](./tough-cookie.cookiejar.getcookies_2.md) + + + | + + + | + +Retrieve the list of cookies that can be sent in a Cookie header for the current URL. + + + |
+ +[getCookiesSync(url, options)](./tough-cookie.cookiejar.getcookiessync.md) + + + | + + + | + +Synchronously retrieve the list of cookies that can be sent in a Cookie header for the current URL. + +Note: Only works if the configured Store is also synchronous. + + + |
+ +[getCookieString(url, options, callback)](./tough-cookie.cookiejar.getcookiestring.md) + + + | + + + | + +Accepts the same options as `.getCookies()` but returns a string suitable for a `Cookie` header rather than an Array. + + + |
+ +[getCookieString(url, callback)](./tough-cookie.cookiejar.getcookiestring_1.md) + + + | + + + | + +Accepts the same options as `.getCookies()` but returns a string suitable for a `Cookie` header rather than an Array. + + + |
+ +[getCookieString(url, options)](./tough-cookie.cookiejar.getcookiestring_2.md) + + + | + + + | + +Accepts the same options as `.getCookies()` but returns a string suitable for a `Cookie` header rather than an Array. + + + |
+ +[getCookieStringSync(url, options)](./tough-cookie.cookiejar.getcookiestringsync.md) + + + | + + + | + +Synchronous version of `.getCookieString()`. Accepts the same options as `.getCookies()` but returns a string suitable for a `Cookie` header rather than an Array. + +Note: Only works if the configured Store is also synchronous. + + + |
+ +[getSetCookieStrings(url, callback)](./tough-cookie.cookiejar.getsetcookiestrings.md) + + + | + + + | + +Returns an array of strings suitable for `Set-Cookie` headers. Accepts the same options as `.getCookies()`. + + + |
+ +[getSetCookieStrings(url, options, callback)](./tough-cookie.cookiejar.getsetcookiestrings_1.md) + + + | + + + | + +Returns an array of strings suitable for `Set-Cookie` headers. Accepts the same options as `.getCookies()`. + + + |
+ +[getSetCookieStrings(url, options)](./tough-cookie.cookiejar.getsetcookiestrings_2.md) + + + | + + + | + +Returns an array of strings suitable for `Set-Cookie` headers. Accepts the same options as `.getCookies()`. + + + |
+ +[getSetCookieStringsSync(url, options)](./tough-cookie.cookiejar.getsetcookiestringssync.md) + + + | + + + | + +Synchronous version of `.getSetCookieStrings()`. Returns an array of strings suitable for `Set-Cookie` headers. Accepts the same options as `.getCookies()`. + +Note: Only works if the configured Store is also synchronous. + + + |
+ +[removeAllCookies(callback)](./tough-cookie.cookiejar.removeallcookies.md) + + + | + + + | + +Removes all cookies from the CookieJar. + + + |
+ +[removeAllCookies()](./tough-cookie.cookiejar.removeallcookies_1.md) + + + | + + + | + +Removes all cookies from the CookieJar. + + + |
+ +[removeAllCookiesSync()](./tough-cookie.cookiejar.removeallcookiessync.md) + + + | + + + | + +Removes all cookies from the CookieJar. + +Note: Only works if the configured Store is also synchronous. + + + |
+ +[serialize(callback)](./tough-cookie.cookiejar.serialize.md) + + + | + + + | + +Serialize the CookieJar if the underlying store supports `.getAllCookies`. + + + |
+ +[serialize()](./tough-cookie.cookiejar.serialize_1.md) + + + | + + + | + +Serialize the CookieJar if the underlying store supports `.getAllCookies`. + + + |
+ +[serializeSync()](./tough-cookie.cookiejar.serializesync.md) + + + | + + + | + +Serialize the CookieJar if the underlying store supports `.getAllCookies`. + +Note: Only works if the configured Store is also synchronous. + + + |
+ +[setCookie(cookie, url, callback)](./tough-cookie.cookiejar.setcookie.md) + + + | + + + | + +Attempt to set the [Cookie](./tough-cookie.cookie.md) in the [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +[setCookie(cookie, url, options, callback)](./tough-cookie.cookiejar.setcookie_1.md) + + + | + + + | + +Attempt to set the [Cookie](./tough-cookie.cookie.md) in the [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +[setCookie(cookie, url, options)](./tough-cookie.cookiejar.setcookie_2.md) + + + | + + + | + +Attempt to set the [Cookie](./tough-cookie.cookie.md) in the [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +[setCookieSync(cookie, url, options)](./tough-cookie.cookiejar.setcookiesync.md) + + + | + + + | + +Synchronously attempt to set the [Cookie](./tough-cookie.cookie.md) in the [CookieJar](./tough-cookie.cookiejar.md). + +Note: Only works if the configured [Store](./tough-cookie.store.md) is also synchronous. + + + |
+ +[toJSON()](./tough-cookie.cookiejar.tojson.md) + + + | + + + | + +Alias of [CookieJar.serializeSync()](./tough-cookie.cookiejar.serializesync.md). Allows the cookie to be serialized with `JSON.stringify(cookieJar)`. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when all the cookies have been removed. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[SerializedCookieJar](./tough-cookie.serializedcookiejar.md)> + + + | + +A function to call after the CookieJar has been serialized + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +string \| [Cookie](./tough-cookie.cookie.md) + + + | + +The cookie object or cookie string to store. A string value will be parsed into a cookie using [Cookie.parse()](./tough-cookie.cookie.parse.md). + + + |
+ +url + + + | + +string \| URL + + + | + +The domain to store the cookie with. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md) \| undefined> + + + | + +A function to call after a cookie has been successfully stored. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +string \| [Cookie](./tough-cookie.cookie.md) + + + | + +The cookie object or cookie string to store. A string value will be parsed into a cookie using [Cookie.parse()](./tough-cookie.cookie.parse.md). + + + |
+ +url + + + | + +string \| URL + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[SetCookieOptions](./tough-cookie.setcookieoptions.md) + + + | + +Configuration settings to use when storing the cookie. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md) \| undefined> + + + | + +A function to call after a cookie has been successfully stored. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +string \| [Cookie](./tough-cookie.cookie.md) + + + | + +The cookie object or cookie string to store. A string value will be parsed into a cookie using [Cookie.parse()](./tough-cookie.cookie.parse.md). + + + |
+ +url + + + | + +string \| URL + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[SetCookieOptions](./tough-cookie.setcookieoptions.md) + + + | + +_(Optional)_ Configuration settings to use when storing the cookie. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +string \| [Cookie](./tough-cookie.cookie.md) + + + | + +The cookie object or cookie string to store. A string value will be parsed into a cookie using [Cookie.parse()](./tough-cookie.cookie.parse.md). + + + |
+ +url + + + | + +string + + + | + +The domain to store the cookie with. + + + |
+ +options + + + | + +[SetCookieOptions](./tough-cookie.setcookieoptions.md) + + + | + +_(Optional)_ Configuration settings to use when storing the cookie. + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[allowSpecialUseDomain?](./tough-cookie.createcookiejaroptions.allowspecialusedomain.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Accepts [special-use domains](https://datatracker.ietf.org/doc/html/rfc6761) such as `local`. This is not in the standard, but is used sometimes on the web and is accepted by most browsers. It is also useful for testing purposes. + +Defaults to `true` if not specified. + + + |
+ +[looseMode?](./tough-cookie.createcookiejaroptions.loosemode.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Accept malformed cookies like `bar` and `=bar`, which have an implied empty name but are not RFC-compliant. + +Defaults to `false` if not specified. + + + |
+ +[prefixSecurity?](./tough-cookie.createcookiejaroptions.prefixsecurity.md) + + + | + + + | + +'strict' \| 'silent' \| 'unsafe-disabled' \| undefined + + + | + +_(Optional)_ Controls how cookie prefixes are handled. See [PrefixSecurityEnum](./tough-cookie.prefixsecurityenum.md). + +Defaults to `silent` if not specified. + + + |
+ +[rejectPublicSuffixes?](./tough-cookie.createcookiejaroptions.rejectpublicsuffixes.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Reject cookies that match those defined in the [Public Suffix List](https://publicsuffix.org/) (e.g.; domains like "com" and "co.uk"). + +Defaults to `true` if not specified. + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[creation?](./tough-cookie.createcookieoptions.creation.md) + + + | + + + | + +Date \| 'Infinity' \| null + + + | + +_(Optional)_ Set to the date and time when a Cookie is initially stored or a matching cookie is received that replaces an existing cookie (See [RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)). + +Also used to maintain ordering among cookies. Among cookies that have equal-length path fields, cookies with earlier creation-times are listed before cookies with later creation-times (See [RFC6265 Section 5.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4)). + + + |
+ +[domain?](./tough-cookie.createcookieoptions.domain.md) + + + | + + + | + +string \| null + + + | + +_(Optional)_ The 'Domain' attribute of the cookie represents the domain the cookie belongs to (See [RFC6265 Section 5.2.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.3)). + + + |
+ +[expires?](./tough-cookie.createcookieoptions.expires.md) + + + | + + + | + +Date \| 'Infinity' \| null + + + | + +_(Optional)_ The 'Expires' attribute of the cookie (See [RFC6265 Section 5.2.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.1)). + + + |
+ +[extensions?](./tough-cookie.createcookieoptions.extensions.md) + + + | + + + | + +string\[\] \| null + + + | + +_(Optional)_ Contains attributes which are not part of the defined spec but match the `extension-av` syntax defined in Section 4.1.1 of RFC6265 (See [RFC6265 Section 4.1.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-4.1.1)). + + + |
+ +[hostOnly?](./tough-cookie.createcookieoptions.hostonly.md) + + + | + + + | + +boolean \| null + + + | + +_(Optional)_ A boolean flag indicating if a cookie is a host-only cookie (i.e.; when the request's host exactly matches the domain of the cookie) or not (See [RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)). + + + |
+ +[httpOnly?](./tough-cookie.createcookieoptions.httponly.md) + + + | + + + | + +boolean + + + | + +_(Optional)_ The 'HttpOnly' flag of the cookie indicates if the cookie is inaccessible to client scripts or not (See [RFC6265 Section 5.2.6](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.6)). + + + |
+ +[key?](./tough-cookie.createcookieoptions.key.md) + + + | + + + | + +string + + + | + +_(Optional)_ The name or key of the cookie + + + |
+ +[lastAccessed?](./tough-cookie.createcookieoptions.lastaccessed.md) + + + | + + + | + +Date \| 'Infinity' \| null + + + | + +_(Optional)_ Set to the date and time when a cookie was initially stored ([RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)) and updated whenever the cookie is retrieved from the [CookieJar](./tough-cookie.cookiejar.md) ([RFC6265 Section 5.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4)). + + + |
+ +[maxAge?](./tough-cookie.createcookieoptions.maxage.md) + + + | + + + | + +number \| 'Infinity' \| '-Infinity' \| null + + + | + +_(Optional)_ The 'Max-Age' attribute of the cookie (See [RFC6265 Section 5.2.2](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.2)). + + + |
+ +[path?](./tough-cookie.createcookieoptions.path.md) + + + | + + + | + +string \| null + + + | + +_(Optional)_ The 'Path' attribute of the cookie represents the path of the cookie (See [RFC6265 Section 5.2.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.4)). + + + |
+ +[pathIsDefault?](./tough-cookie.createcookieoptions.pathisdefault.md) + + + | + + + | + +boolean \| null + + + | + +_(Optional)_ A boolean flag indicating if a cookie had no 'Path' attribute and the default path was used (See [RFC6265 Section 5.2.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.4)). + + + |
+ +[sameSite?](./tough-cookie.createcookieoptions.samesite.md) + + + | + + + | + +string \| undefined + + + | + +_(Optional)_ The 'SameSite' attribute of a cookie as defined in RFC6265bis (See [RFC6265bis (v13) Section 5.2](https://www.ietf.org/archive/id/draft-ietf-httpbis-rfc6265bis-13.html#section-5.2)). + + + |
+ +[secure?](./tough-cookie.createcookieoptions.secure.md) + + + | + + + | + +boolean + + + | + +_(Optional)_ The 'Secure' flag of the cookie indicates if the scope of the cookie is limited to secure channels (e.g.; HTTPS) or not (See [RFC6265 Section 5.2.5](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.5)). + + + |
+ +[value?](./tough-cookie.createcookieoptions.value.md) + + + | + + + | + +string + + + | + +_(Optional)_ The value of the cookie + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +_(Optional)_ the path portion of the request-uri (excluding the hostname, query, fragment, and so on) + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +_(Optional)_ The domain string to test + + + |
+ +cookieDomain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +_(Optional)_ The cookie domain string to match against + + + |
+ +canonicalize + + + | + +boolean + + + | + +_(Optional)_ The canonicalize parameter toggles whether the domain parameters get normalized with canonicalDomain or not + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +date + + + | + +Date + + + | + +the date value to format + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +str + + + | + +unknown + + + | + +An unparsed JSON string or a value that has already been parsed as JSON + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[allPaths?](./tough-cookie.getcookiesoptions.allpaths.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ If `true`, do not scope cookies by path. If `false`, then RFC-compliant path scoping will be used. + + + |
+ +[expire?](./tough-cookie.getcookiesoptions.expire.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Perform `expiry-time` checking of cookies and asynchronously remove expired cookies from the store. + + + |
+ +[http?](./tough-cookie.getcookiesoptions.http.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies. + +Defaults to `true` if not provided. + + + |
+ +[sameSiteContext?](./tough-cookie.getcookiesoptions.samesitecontext.md) + + + | + + + | + +'none' \| 'lax' \| 'strict' \| undefined + + + | + +_(Optional)_ Set this to 'none', 'lax', or 'strict' to enforce SameSite cookies upon retrieval. + +- `'strict'` - If the request is on the same "site for cookies" (see the RFC draft for more information), pass this option to add a layer of defense against CSRF. + +- `'lax'` - If the request is from another site, but is directly because of navigation by the user, such as, `` or ``, then use `lax`. + +- `'none'` - This indicates a cross-origin request. + +- `undefined` - SameSite is not be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built. + +Defaults to `undefined` if not provided. + + + |
+ +[sort?](./tough-cookie.getcookiesoptions.sort.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Flag to indicate if the returned cookies should be sorted or not. + +Defaults to `undefined` if not provided. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +the domain attribute of a cookie + + + |
+ +options + + + | + +[GetPublicSuffixOptions](./tough-cookie.getpublicsuffixoptions.md) + + + | + +_(Optional)_ optional configuration for controlling how the public suffix is determined + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[allowSpecialUseDomain?](./tough-cookie.getpublicsuffixoptions.allowspecialusedomain.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ If set to `true` then the following [Special Use Domains](https://www.rfc-editor.org/rfc/rfc6761.html) will be treated as if they were valid public suffixes ('local', 'example', 'invalid', 'localhost', 'test'). + + + |
+ +[ignoreError?](./tough-cookie.getpublicsuffixoptions.ignoreerror.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ If set to `true` then any errors that occur while executing [getPublicSuffix()](./tough-cookie.getpublicsuffix.md) will be silently ignored. + + + |
+ +Class + + + | + +Description + + + |
---|---|
+ +[Cookie](./tough-cookie.cookie.md) + + + | + +An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to a user's web browser. It is defined in [RFC6265](https://www.rfc-editor.org/rfc/rfc6265.html). + + + |
+ +[CookieJar](./tough-cookie.cookiejar.md) + + + | + +A CookieJar is for storage and retrieval of [Cookie](./tough-cookie.cookie.md) objects as defined in [RFC6265 - Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3). + +It also supports a pluggable persistence layer via [Store](./tough-cookie.store.md). + + + |
+ +[MemoryCookieStore](./tough-cookie.memorycookiestore.md) + + + | + +An in-memory [Store](./tough-cookie.store.md) implementation for [CookieJar](./tough-cookie.cookiejar.md). This is the default implementation used by [CookieJar](./tough-cookie.cookiejar.md) and supports both async and sync operations. Also supports serialization, getAllCookies, and removeAllCookies. + + + |
+ +[ParameterError](./tough-cookie.parametererror.md) + + + | + +Represents a validation error. + + + |
+ +[Store](./tough-cookie.store.md) + + + | + +Base class for [CookieJar](./tough-cookie.cookiejar.md) stores. + +The storage model for each [CookieJar](./tough-cookie.cookiejar.md) instance can be replaced with a custom implementation. The default is [MemoryCookieStore](./tough-cookie.memorycookiestore.md). + + + |
+ +Function + + + | + +Description + + + |
---|---|
+ +[canonicalDomain(domainName)](./tough-cookie.canonicaldomain.md) + + + | + +Transforms a domain name into a canonical domain name. The canonical domain name is a domain name that has been trimmed, lowercased, stripped of leading dot, and optionally punycode-encoded ([Section 5.1.2 of RFC 6265](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.2)). For the most part, this function is idempotent (calling the function with the output from a previous call returns the same output). + + + |
+ +[cookieCompare(a, b)](./tough-cookie.cookiecompare.md) + + + | + +A comparison function that can be used with [Array.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort), which orders a list of cookies into the recommended order given in Step 2 of [RFC6265 - Section 5.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4). + +The sort algorithm is, in order of precedence: + +- Longest [Cookie.path](./tough-cookie.cookie.path.md) + +- Oldest [Cookie.creation](./tough-cookie.cookie.creation.md) (which has a 1-ms precision, same as Date) + +- Lowest [Cookie.creationIndex](./tough-cookie.cookie.creationindex.md) (to get beyond the 1-ms precision) + + + |
+ +[defaultPath(path)](./tough-cookie.defaultpath.md) + + + | + +Given a current request/response path, gives the path appropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by [RFC6265 - Section 5.1.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.4). + + + |
+ +[domainMatch(domain, cookieDomain, canonicalize)](./tough-cookie.domainmatch.md) + + + | + +Answers "does this real domain match the domain in a cookie?". The `domain` is the "current" domain name and the `cookieDomain` is the "cookie" domain name. Matches according to [RFC6265 - Section 5.1.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.3), but it helps to think of it as a "suffix match". + + + |
+ +[formatDate(date)](./tough-cookie.formatdate.md) + + + | + +Format a [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) into the [preferred Internet standard format](https://www.rfc-editor.org/rfc/rfc2616#section-3.3.1) defined in [RFC822](https://www.rfc-editor.org/rfc/rfc822#section-5) and updated in [RFC1123](https://www.rfc-editor.org/rfc/rfc1123#page-55). + + + |
+ +[fromJSON(str)](./tough-cookie.fromjson.md) + + + | + +Does the reverse of [Cookie.toJSON()](./tough-cookie.cookie.tojson.md). + + + |
+ +[getPublicSuffix(domain, options)](./tough-cookie.getpublicsuffix.md) + + + | + +Returns the public suffix of this hostname. The public suffix is the shortest domain name upon which a cookie can be set. + + + |
+ +[parse(str, options)](./tough-cookie.parse.md) + + + | + +Parses a string into a Cookie object. + + + |
+ +[parseDate(cookieDate)](./tough-cookie.parsedate.md) + + + | + +Parse a cookie date string into a [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). Parses according to [RFC6265 - Section 5.1.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.1), not [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). + + + |
+ +[pathMatch(reqPath, cookiePath)](./tough-cookie.pathmatch.md) + + + | + +Answers "does the request-path path-match a given cookie-path?" as per [RFC6265 Section 5.1.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.4). This is essentially a prefix-match where cookiePath is a prefix of reqPath. + + + |
+ +[permuteDomain(domain, allowSpecialUseDomain)](./tough-cookie.permutedomain.md) + + + | + +Generates the permutation of all possible values that [domainMatch()](./tough-cookie.domainmatch.md) the given `domain` parameter. The array is in shortest-to-longest order. Useful when building custom [Store](./tough-cookie.store.md) implementations. + + + |
+ +[permutePath(path)](./tough-cookie.permutepath.md) + + + | + +Generates the permutation of all possible values that [pathMatch()](./tough-cookie.pathmatch.md) the `path` parameter. The array is in longest-to-shortest order. Useful when building custom [Store](./tough-cookie.store.md) implementations. + + + |
+ +Interface + + + | + +Description + + + |
---|---|
+ +[Callback](./tough-cookie.callback.md) + + + | + +A callback function that accepts an error or a result. + + + |
+ +[CreateCookieJarOptions](./tough-cookie.createcookiejaroptions.md) + + + | + +Configuration settings to be used with a [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +[CreateCookieOptions](./tough-cookie.createcookieoptions.md) + + + | + +Configurable values that can be set when creating a [Cookie](./tough-cookie.cookie.md). + + + |
+ +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A callback function that only accepts an error. + + + |
+ +[GetCookiesOptions](./tough-cookie.getcookiesoptions.md) + + + | + +Configuration options used when calling `CookieJar.getCookies(...)`. + + + |
+ +[GetPublicSuffixOptions](./tough-cookie.getpublicsuffixoptions.md) + + + | + +Options for configuring how [getPublicSuffix()](./tough-cookie.getpublicsuffix.md) behaves. + + + |
+ +[ParseCookieOptions](./tough-cookie.parsecookieoptions.md) + + + | + +Optional configuration to be used when parsing cookies. + + + |
+ +[SerializedCookieJar](./tough-cookie.serializedcookiejar.md) + + + | + +A JSON representation of a [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +[SetCookieOptions](./tough-cookie.setcookieoptions.md) + + + | + +Configuration options used when calling `CookieJar.setCookie(...)` + + + |
+ +Variable + + + | + +Description + + + |
---|---|
+ +[PrefixSecurityEnum](./tough-cookie.prefixsecurityenum.md) + + + | + +Cookie prefixes are a way to indicate that a given cookie was set with a set of attributes simply by inspecting the first few characters of the cookie's name. These are defined in [RFC6265bis - Section 4.1.3](https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13#section-4.1.3). + +The following values can be used to configure how a [CookieJar](./tough-cookie.cookiejar.md) enforces attribute restrictions for Cookie prefixes: + +- `silent` - Enable cookie prefix checking but silently ignores the cookie if conditions are not met. This is the default configuration for a [CookieJar](./tough-cookie.cookiejar.md). + +- `strict` - Enables cookie prefix checking and will raise an error if conditions are not met. + +- `unsafe-disabled` - Disables cookie prefix checking. + + + |
+ +[version](./tough-cookie.version.md) + + + | + +The version of `tough-cookie` + + + |
+ +Type Alias + + + | + +Description + + + |
---|---|
+ +[Nullable](./tough-cookie.nullable.md) + + + |
+
+The inverse of NonNullable |
+ +[SerializedCookie](./tough-cookie.serializedcookie.md) + + + | + +A JSON object that is created when [Cookie.toJSON()](./tough-cookie.cookie.tojson.md) is called. This object will contain the properties defined in [Cookie.serializableProperties](./tough-cookie.cookie.serializableproperties.md). + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie name to match against. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie name to match against. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md) \| undefined> + + + | + +A function to call with either the found cookie or an error. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +string + + + | + +The cookie path to match against. + + + |
+ +allowSpecialUseDomain + + + | + +boolean + + + | + +_(Optional)_ If `true` then special-use domain suffixes, will be allowed in matches. Defaults to `false`. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +string + + + | + +The cookie path to match against. + + + |
+ +allowSpecialUseDomain + + + | + +boolean + + + | + +_(Optional)_ If `true` then special-use domain suffixes, will be allowed in matches. Defaults to `false`. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md)\[\]> + + + | + +_(Optional)_ A function to call with either the found cookies or an error. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md)\[\]> + + + | + +A function to call when all the cookies have been retrieved or an error occurs. + + + |
+ +Constructor + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[(constructor)()](./tough-cookie.memorycookiestore._constructor_.md) + + + | + + + | + +Create a new [MemoryCookieStore](./tough-cookie.memorycookiestore.md). + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[synchronous](./tough-cookie.memorycookiestore.synchronous.md) + + + | + + + | + +boolean + + + | + +This value is `true` since [MemoryCookieStore](./tough-cookie.memorycookiestore.md) implements synchronous functionality. + + + |
+ +Method + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[findCookie(domain, path, key)](./tough-cookie.memorycookiestore.findcookie.md) + + + | + + + | + +Retrieve a [Cookie](./tough-cookie.cookie.md) with the given `domain`, `path`, and `key` (`name`). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest or newest such cookie should be returned. + + + |
+ +[findCookie(domain, path, key, callback)](./tough-cookie.memorycookiestore.findcookie_1.md) + + + | + + + | + +Retrieve a [Cookie](./tough-cookie.cookie.md) with the given `domain`, `path`, and `key` (`name`). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest or newest such cookie should be returned. + +Callback takes an error and the resulting Cookie object. If no cookie is found then null MUST be passed instead (that is, not an error). + + + |
+ +[findCookies(domain, path, allowSpecialUseDomain)](./tough-cookie.memorycookiestore.findcookies.md) + + + | + + + | + +Locates all [Cookie](./tough-cookie.cookie.md) values matching the given `domain` and `path`. + +The resulting list is checked for applicability to the current request according to the RFC (`domain-match`, `path-match`, `http-only-flag`, `secure-flag`, `expiry`, and so on), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that [domainMatch()](./tough-cookie.domainmatch.md) the `domain` and [pathMatch()](./tough-cookie.pathmatch.md) the `path` in order to limit the amount of checking that needs to be done. + + + |
+ +[findCookies(domain, path, allowSpecialUseDomain, callback)](./tough-cookie.memorycookiestore.findcookies_1.md) + + + | + + + | + +Locates all [Cookie](./tough-cookie.cookie.md) values matching the given `domain` and `path`. + +The resulting list is checked for applicability to the current request according to the RFC (`domain-match`, `path-match`, `http-only-flag`, `secure-flag`, `expiry`, and so on), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that [domainMatch()](./tough-cookie.domainmatch.md) the `domain` and [pathMatch()](./tough-cookie.pathmatch.md) the `path` in order to limit the amount of checking that needs to be done. + + + |
+ +[getAllCookies()](./tough-cookie.memorycookiestore.getallcookies.md) + + + | + + + | + +Gets all the cookies in the store. + + + |
+ +[getAllCookies(callback)](./tough-cookie.memorycookiestore.getallcookies_1.md) + + + | + + + | + +Gets all the cookies in the store. + + + |
+ +[putCookie(cookie)](./tough-cookie.memorycookiestore.putcookie.md) + + + | + + + | + +Adds a new [Cookie](./tough-cookie.cookie.md) to the store. The implementation SHOULD replace any existing cookie with the same `domain`, `path`, and `key` properties. + + + |
+ +[putCookie(cookie, callback)](./tough-cookie.memorycookiestore.putcookie_1.md) + + + | + + + | + +Adds a new [Cookie](./tough-cookie.cookie.md) to the store. The implementation SHOULD replace any existing cookie with the same `domain`, `path`, and `key` properties. + + + |
+ +[removeAllCookies()](./tough-cookie.memorycookiestore.removeallcookies.md) + + + | + + + | + +Removes all cookies from the store. + + + |
+ +[removeAllCookies(callback)](./tough-cookie.memorycookiestore.removeallcookies_1.md) + + + | + + + | + +Removes all cookies from the store. + + + |
+ +[removeCookie(domain, path, key)](./tough-cookie.memorycookiestore.removecookie.md) + + + | + + + | + +Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint). + + + |
+ +[removeCookie(domain, path, key, callback)](./tough-cookie.memorycookiestore.removecookie_1.md) + + + | + + + | + +Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint). + + + |
+ +[removeCookies(domain, path)](./tough-cookie.memorycookiestore.removecookies.md) + + + | + + + | + +Removes matching cookies from the store. The `path` parameter is optional and if missing, means all paths in a domain should be removed. + + + |
+ +[removeCookies(domain, path, callback)](./tough-cookie.memorycookiestore.removecookies_1.md) + + + | + + + | + +Removes matching cookies from the store. The `path` parameter is optional and if missing, means all paths in a domain should be removed. + + + |
+ +[updateCookie(oldCookie, newCookie)](./tough-cookie.memorycookiestore.updatecookie.md) + + + | + + + | + +Update an existing [Cookie](./tough-cookie.cookie.md). The implementation MUST update the `value` for a cookie with the same `domain`, `path`, and `key`. The implementation SHOULD check that the old value in the store is equivalent to oldCookie - how the conflict is resolved is up to the store. + + + |
+ +[updateCookie(oldCookie, newCookie, callback)](./tough-cookie.memorycookiestore.updatecookie_1.md) + + + | + + + | + +Update an existing [Cookie](./tough-cookie.cookie.md). The implementation MUST update the `value` for a cookie with the same `domain`, `path`, and `key`. The implementation SHOULD check that the old value in the store is equivalent to oldCookie - how the conflict is resolved is up to the store. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +The cookie to store. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +The cookie to store. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookie has been stored or an error has occurred. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when all the cookies have been removed or an error occurs. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +string + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +string + + + | + +The cookie name to match against. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +string + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +string + + + | + +The cookie name to match against. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookie has been removed or an error occurs. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +string + + + | + +The cookie path to match against. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +string + + + | + +The cookie path to match against. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookies have been removed or an error occurs. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +oldCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie that is already present in the store. + + + |
+ +newCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie to replace the one already present in the store. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +oldCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie that is already present in the store. + + + |
+ +newCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie to replace the one already present in the store. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookie has been updated or an error has occurred. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +str + + + | + +string + + + | + +The `Set-Cookie` header or a Cookie string to parse. + + + |
+ +options + + + | + +[ParseCookieOptions](./tough-cookie.parsecookieoptions.md) + + + | + +_(Optional)_ Configures `strict` or `loose` mode for cookie parsing + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[loose?](./tough-cookie.parsecookieoptions.loose.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ If `true` then keyless cookies like `=abc` and `=` which are not RFC-compliant will be parsed. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookieDate + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +the cookie date string + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +reqPath + + + | + +string + + + | + +the path of the request + + + |
+ +cookiePath + + + | + +string + + + | + +the path of the cookie + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +the domain to generate permutations for + + + |
+ +allowSpecialUseDomain + + + | + +boolean + + + | + +_(Optional)_ flag to control if [Special Use Domains](https://www.rfc-editor.org/rfc/rfc6761.html) such as `localhost` should be allowed + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +path + + + | + +string + + + | + +the path to generate permutations for + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[cookies](./tough-cookie.serializedcookiejar.cookies.md) + + + | + + + | + +[SerializedCookie](./tough-cookie.serializedcookie.md)\[\] + + + | + +The list of [Cookie](./tough-cookie.cookie.md) values serialized as JSON objects. + + + |
+ +[rejectPublicSuffixes](./tough-cookie.serializedcookiejar.rejectpublicsuffixes.md) + + + | + + + | + +boolean + + + | + +The value of [CreateCookieJarOptions.rejectPublicSuffixes](./tough-cookie.createcookiejaroptions.rejectpublicsuffixes.md) configured on the [CookieJar](./tough-cookie.cookiejar.md). + + + |
+ +[storeType](./tough-cookie.serializedcookiejar.storetype.md) + + + | + + + | + +string \| null + + + | + +The name of the store used during serialization. + + + |
+ +[version](./tough-cookie.serializedcookiejar.version.md) + + + | + + + | + +string + + + | + +The version of `tough-cookie` used during serialization. + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[http?](./tough-cookie.setcookieoptions.http.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies. + +Defaults to `true` if not provided. + + + |
+ +[ignoreError?](./tough-cookie.setcookieoptions.ignoreerror.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Silently ignore things like parse errors and invalid domains. Store errors aren't ignored by this option. + +Defaults to `false` if not provided. + + + |
+ +[loose?](./tough-cookie.setcookieoptions.loose.md) + + + | + + + | + +boolean \| undefined + + + | + +_(Optional)_ Controls if a cookie string should be parsed using `loose` mode or not. See [Cookie.parse()](./tough-cookie.cookie.parse.md) and [ParseCookieOptions](./tough-cookie.parsecookieoptions.md) for more details. + +Defaults to `false` if not provided. + + + |
+ +[now?](./tough-cookie.setcookieoptions.now.md) + + + | + + + | + +Date \| undefined + + + | + +_(Optional)_ Forces the cookie creation and access time of cookies to this value when stored. + +Defaults to `Date.now()` if not provided. + + + |
+ +[sameSiteContext?](./tough-cookie.setcookieoptions.samesitecontext.md) + + + | + + + | + +'strict' \| 'lax' \| 'none' \| undefined + + + | + +_(Optional)_ Set this to 'none', 'lax', or 'strict' to enforce SameSite cookies upon storage. + +- `'strict'` - If the request is on the same "site for cookies" (see the RFC draft for more information), pass this option to add a layer of defense against CSRF. + +- `'lax'` - If the request is from another site, but is directly because of navigation by the user, such as, `` or ``, then use `lax`. + +- `'none'` - This indicates a cross-origin request. + +- `undefined` - SameSite is not be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built. + +Defaults to `undefined` if not provided. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie name to match against. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie name to match against. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md) \| undefined> + + + | + +A function to call with either the found cookie or an error. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +allowSpecialUseDomain + + + | + +boolean + + + | + +_(Optional)_ If `true` then special-use domain suffixes, will be allowed in matches. Defaults to `false`. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +allowSpecialUseDomain + + + | + +boolean + + + | + +_(Optional)_ If `true` then special-use domain suffixes, will be allowed in matches. Defaults to `false`. + + + |
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md)\[\]> + + + | + +_(Optional)_ A function to call with either the found cookies or an error. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +callback + + + | + +[Callback](./tough-cookie.callback.md)<[Cookie](./tough-cookie.cookie.md)\[\]> + + + | + +A function to call when all the cookies have been retrieved or an error occurs. + + + |
+ +Constructor + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[(constructor)()](./tough-cookie.store._constructor_.md) + + + | + + + | + +Constructs a new instance of the `Store` class + + + |
+ +Property + + + | + +Modifiers + + + | + +Type + + + | + +Description + + + |
---|---|---|---|
+ +[synchronous](./tough-cookie.store.synchronous.md) + + + | + + + | + +boolean + + + | + +Store implementations that support synchronous methods must return `true`. + + + |
+ +Method + + + | + +Modifiers + + + | + +Description + + + |
---|---|---|
+ +[findCookie(domain, path, key)](./tough-cookie.store.findcookie.md) + + + | + + + | + +Retrieve a [Cookie](./tough-cookie.cookie.md) with the given `domain`, `path`, and `key` (`name`). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest or newest such cookie should be returned. + +Callback takes an error and the resulting Cookie object. If no cookie is found then null MUST be passed instead (that is, not an error). + + + |
+ +[findCookie(domain, path, key, callback)](./tough-cookie.store.findcookie_1.md) + + + | + + + | + +Retrieve a [Cookie](./tough-cookie.cookie.md) with the given `domain`, `path`, and `key` (`name`). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest or newest such cookie should be returned. + +Callback takes an error and the resulting Cookie object. If no cookie is found then null MUST be passed instead (that is, not an error). + + + |
+ +[findCookies(domain, path, allowSpecialUseDomain)](./tough-cookie.store.findcookies.md) + + + | + + + | + +Locates all [Cookie](./tough-cookie.cookie.md) values matching the given `domain` and `path`. + +The resulting list is checked for applicability to the current request according to the RFC (`domain-match`, `path-match`, `http-only-flag`, `secure-flag`, `expiry`, and so on), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that [domainMatch()](./tough-cookie.domainmatch.md) the `domain` and [pathMatch()](./tough-cookie.pathmatch.md) the `path` in order to limit the amount of checking that needs to be done. + + + |
+ +[findCookies(domain, path, allowSpecialUseDomain, callback)](./tough-cookie.store.findcookies_1.md) + + + | + + + | + +Locates all [Cookie](./tough-cookie.cookie.md) values matching the given `domain` and `path`. + +The resulting list is checked for applicability to the current request according to the RFC (`domain-match`, `path-match`, `http-only-flag`, `secure-flag`, `expiry`, and so on), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that [domainMatch()](./tough-cookie.domainmatch.md) the `domain` and [pathMatch()](./tough-cookie.pathmatch.md) the `path` in order to limit the amount of checking that needs to be done. + + + |
+ +[getAllCookies()](./tough-cookie.store.getallcookies.md) + + + | + + + | + +Gets all the cookies in the store. + + + |
+ +[getAllCookies(callback)](./tough-cookie.store.getallcookies_1.md) + + + | + + + | + +Gets all the cookies in the store. + + + |
+ +[putCookie(cookie)](./tough-cookie.store.putcookie.md) + + + | + + + | + +Adds a new [Cookie](./tough-cookie.cookie.md) to the store. The implementation SHOULD replace any existing cookie with the same `domain`, `path`, and `key` properties. + + + |
+ +[putCookie(cookie, callback)](./tough-cookie.store.putcookie_1.md) + + + | + + + | + +Adds a new [Cookie](./tough-cookie.cookie.md) to the store. The implementation SHOULD replace any existing cookie with the same `domain`, `path`, and `key` properties. + + + |
+ +[removeAllCookies()](./tough-cookie.store.removeallcookies.md) + + + | + + + | + +Removes all cookies from the store. + + + |
+ +[removeAllCookies(callback)](./tough-cookie.store.removeallcookies_1.md) + + + | + + + | + +Removes all cookies from the store. + + + |
+ +[removeCookie(domain, path, key)](./tough-cookie.store.removecookie.md) + + + | + + + | + +Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint). + + + |
+ +[removeCookie(domain, path, key, callback)](./tough-cookie.store.removecookie_1.md) + + + | + + + | + +Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint). + + + |
+ +[removeCookies(domain, path)](./tough-cookie.store.removecookies.md) + + + | + + + | + +Removes matching cookies from the store. The `path` parameter is optional and if missing, means all paths in a domain should be removed. + + + |
+ +[removeCookies(domain, path, callback)](./tough-cookie.store.removecookies_1.md) + + + | + + + | + +Removes matching cookies from the store. The `path` parameter is optional and if missing, means all paths in a domain should be removed. + + + |
+ +[updateCookie(oldCookie, newCookie)](./tough-cookie.store.updatecookie.md) + + + | + + + | + +Update an existing [Cookie](./tough-cookie.cookie.md). The implementation MUST update the `value` for a cookie with the same `domain`, `path`, and `key`. The implementation SHOULD check that the old value in the store is equivalent to oldCookie - how the conflict is resolved is up to the store. + + + |
+ +[updateCookie(oldCookie, newCookie, callback)](./tough-cookie.store.updatecookie_1.md) + + + | + + + | + +Update an existing [Cookie](./tough-cookie.cookie.md). The implementation MUST update the `value` for a cookie with the same `domain`, `path`, and `key`. The implementation SHOULD check that the old value in the store is equivalent to oldCookie - how the conflict is resolved is up to the store. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +The cookie to store. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +cookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +The cookie to store. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookie has been stored or an error has occurred. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when all the cookies have been removed or an error occurs. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie name to match against. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +key + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie name to match against. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookie has been removed or an error occurs. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +domain + + + | + +string + + + | + +The cookie domain to match against. + + + |
+ +path + + + | + +[Nullable](./tough-cookie.nullable.md)<string> + + + | + +The cookie path to match against. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookies have been removed or an error occurs. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +oldCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie that is already present in the store. + + + |
+ +newCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie to replace the one already present in the store. + + + |
+ +Parameter + + + | + +Type + + + | + +Description + + + |
---|---|---|
+ +oldCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie that is already present in the store. + + + |
+ +newCookie + + + | + +[Cookie](./tough-cookie.cookie.md) + + + | + +the cookie to replace the one already present in the store. + + + |
+ +callback + + + | + +[ErrorCallback](./tough-cookie.errorcallback.md) + + + | + +A function to call when the cookie has been updated or an error has occurred. + + + |