https://github.com/cryptoking-max/ahead

https://github.com/cryptoking-max/ahead

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.3%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: cryptoking-max
  • License: bsd-3-clause
  • Language: TypeScript
  • Default Branch: main
  • Size: 247 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 4
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Code of conduct Codeowners Security

README.md

Tough Cookie · RFC6265 RFC6265bis npm version CI on Github Actions: salesforce/tough-cookie PRs Welcome

A Node.js implementation of RFC6265 for cookie parsing, storage, and retrieval.

Getting Started

Install Tough Cookie using npm:

shell npm install tough-cookie

or yarn:

shell yarn add tough-cookie

Usage

```typescript import { Cookie, CookieJar } from 'tough-cookie'

// parse a Cookie request header const reqCookies = 'ID=298zf09hf012fh2; csrf=u32t4o3tb3gg43; _gat=1' .split(';') .map(Cookie.parse) // generate a Cookie request header const cookieHeader = reqCookies.map((cookie) => cookie.cookieString()).join(';')

// parse a Set-Cookie response header const resCookie = Cookie.parse( 'foo=bar; Domain=example.com; Path=/; Expires=Tue, 21 Oct 2025 00:00:00 GMT', ) // generate a Set-Cookie response header const setCookieHeader = cookie.toString()

// store and retrieve cookies const cookieJar = new CookieJar() // uses the in-memory store by default await cookieJar.setCookie(resCookie, 'https://example.com/') const matchingCookies = await cookieJar.getCookies('https://example.com/') ```

[!IMPORTANT] For more detailed usage information, refer to the API docs.

RFC6265bis

Support for RFC6265bis is being developed. As these revisions to RFC6252 are still in Active Internet-Draft state, the areas of support that follow are subject to change.

SameSite Cookies

This change makes it possible for servers, and supporting clients, to mitigate certain types of CSRF attacks by disallowing SameSite cookies from being sent cross-origin.

Example

```typescript import { CookieJar } from 'tough-cookie'

const cookieJar = new CookieJar() // uses the in-memory store by default

// storing cookies with various SameSite attributes await cookieJar.setCookie( 'strict=authorized; SameSite=strict', 'http://example.com/index.html', ) await cookieJar.setCookie( 'lax=okay; SameSite=lax', 'http://example.com/index.html', ) await cookieJar.setCookie('normal=whatever', 'http://example.com/index.html')

// retrieving cookies using a SameSite context const laxCookies = await cookieJar.getCookies('http://example.com/index.html', { // the first cookie (strict=authorized) will not be returned if the context is 'lax' // but the other two cookies will be returned sameSiteContext: 'lax', }) ```

[!NOTE] It is highly recommended that you read RFC6265bis - Section 8.8 for more details on SameSite cookies, security considerations, and defense in depth.

Cookie Prefixes

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.

Two prefixes are defined:

  • "__Secure-"

If a cookie's name begins with a case-sensitive match for the string __Secure-, then the cookie was set with a "Secure" attribute.

  • "__Host-"

If a cookie's name begins with a case-sensitive match for the string __Host-, then the cookie was set with a "Secure" attribute, a "Path" attribute with a value of "/", and no "Domain" attribute.

If prefixSecurity is enabled for CookieJar, then cookies that match the prefixes defined above but do not obey the attribute restrictions are not added.

You can define this functionality by passing in the prefixSecurity option to CookieJar. It can be one of 3 values:

  1. silent: (default) Enable cookie prefix checking but silently fail to add the cookie if conditions are not met.
  2. strict: Enable cookie prefix checking and error out if conditions are not met.
  3. unsafe-disabled: Disable cookie prefix checking.

If ignoreError is passed in as true when setting a cookie then the error is silent regardless of the prefixSecurity option (assuming it's enabled).

Example

```typescript import { CookieJar, MemoryCookieStore } from 'tough-cookie'

const cookieJar = new CookieJar(new MemoryCookieStore(), { prefixSecurity: 'silent', })

// this cookie will be silently ignored since the url is insecure (http) await cookieJar.setCookie( '__Secure-SID=12345; Domain=example.com; Secure;', 'http://example.com', )

// this cookie will be stored since the url is secure (https) await cookieJar.setCookie( '__Secure-SID=12345; Domain=example.com; Secure;', 'https://example.com', ) ```

[!NOTE] It is highly recommended that you read RFC6265bis - Section 4.1.3 for more details on Cookie Prefixes.

Node.js Version Support

We follow the Node.js release schedule and support all versions that are in Active LTS or Maintenance. We will always do a major release when dropping support for older versions of node, and we will do so in consultation with our community.

Owner

  • Name: Solana sniper copy trading bot
  • Login: cryptoking-max
  • Kind: user
  • Location: solana trading bot
  • Company: solana trading bot

#Solana #sniper #copy #trading #bot

GitHub Events

Total
  • Delete event: 2
  • Issue comment event: 2
  • Pull request event: 2
  • Create event: 2
Last Year
  • Delete event: 2
  • Issue comment event: 2
  • Pull request event: 2
  • Create event: 2

Dependencies

.github/workflows/ci.yaml actions
  • actions/checkout v4 composite
  • actions/setup-node v4 composite
.github/workflows/integration.yaml actions
  • actions/checkout v4 composite
  • actions/setup-node v4 composite
.github/workflows/publish.yaml actions
  • actions/checkout v4 composite
  • actions/setup-node v4 composite
.github/workflows/slonser.yaml actions
package-lock.json npm
  • 399 dependencies
package.json npm
  • @eslint/js ^9.24.0 development
  • @microsoft/api-documenter ^7.26.20 development
  • @microsoft/api-extractor ^7.52.3 development
  • @types/node ^18.19.79 development
  • @vitest/eslint-plugin ^1.1.40 development
  • eslint ^9.24.0 development
  • eslint-config-prettier ^10.1.2 development
  • eslint-import-resolver-typescript ^4.3.2 development
  • eslint-plugin-import ^2.31.0 development
  • eslint-plugin-prettier ^5.2.6 development
  • genversion ^3.2.0 development
  • globals ^16.0.0 development
  • prettier ^3.5.3 development
  • typescript 5.5.3 development
  • typescript-eslint ^8.29.1 development
  • vitest ^3.1.1 development
  • tldts ^6.1.85