@mherod/get-cookie 4.3.2 β 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +3 -0
- package/.dependency-cruiser.js +277 -0
- package/.husky/commit-msg +0 -0
- package/.husky/pre-commit +0 -0
- package/.husky/pre-push +0 -0
- package/README.md +106 -48
- package/biome.json +39 -16
- package/dist/cli.cjs +76 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +76 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +647 -126
- package/dist/index.d.ts +647 -126
- package/dist/index.js +76 -2
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.js +23 -2
- package/examples/auth-tokens.ts +143 -0
- package/examples/chrome-cookies-demo.sh +117 -0
- package/examples/chrome-profile-demo.sh +126 -0
- package/examples/cli-examples.sh +0 -0
- package/examples/comprehensive-demo.ts +202 -0
- package/examples/curl-demo.sh +102 -0
- package/examples/curl-integration.sh +276 -0
- package/examples/curl-with-url.sh +136 -0
- package/examples/deduplication-demo.sh +110 -0
- package/examples/final-chrome-demo.sh +115 -0
- package/examples/github-api.sh +101 -0
- package/examples/github-private-access.sh +118 -0
- package/examples/list-profiles-demo.sh +120 -0
- package/examples/proper-curl-usage.sh +120 -0
- package/examples/simple-curl.sh +95 -0
- package/examples/test-expired-filtering.sh +68 -0
- package/examples/test-github-access.sh +245 -0
- package/examples/test-github-auth-improved.sh +136 -0
- package/examples/working-curl.sh +117 -0
- package/examples/working-github-auth.sh +87 -0
- package/package.json +46 -27
- package/tsconfig.cli.json +5 -1
- package/tsup.cli.ts +31 -1
- package/tsup.lib.ts +11 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/** @type {import('dependency-cruiser').IConfiguration} */
|
|
2
|
+
export default {
|
|
3
|
+
forbidden: [
|
|
4
|
+
{
|
|
5
|
+
name: "no-circular",
|
|
6
|
+
severity: "warn",
|
|
7
|
+
comment:
|
|
8
|
+
"This dependency is part of a circular relationship. You might want to revise " +
|
|
9
|
+
"your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ",
|
|
10
|
+
from: {},
|
|
11
|
+
to: {
|
|
12
|
+
circular: true,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "no-orphans",
|
|
17
|
+
severity: "info",
|
|
18
|
+
comment:
|
|
19
|
+
"This is an orphan module - it's likely not used (anymore?). Either use it or " +
|
|
20
|
+
"remove it. If it's logical this module is an orphan (i.e. it's a config file), " +
|
|
21
|
+
"add an exception for it in your dependency-cruiser config",
|
|
22
|
+
from: {
|
|
23
|
+
orphan: true,
|
|
24
|
+
pathNot: [
|
|
25
|
+
"(^|/)\\.[^/]+\\.(js|cjs|mjs|ts|json)$", // dot files
|
|
26
|
+
"\\.(d\\.ts|test\\.ts|test\\.js|spec\\.ts|spec\\.js)$", // tests
|
|
27
|
+
"(^|/)__tests__/", // test folders
|
|
28
|
+
"(^|/)__mocks__/", // mock folders
|
|
29
|
+
"^src/cli/", // CLI entry points
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
to: {},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "no-deprecated-core",
|
|
36
|
+
comment:
|
|
37
|
+
"A module depends on a node core module that has been deprecated. Find an alternative - these are " +
|
|
38
|
+
"bound to exist - node doesn't deprecate lightly.",
|
|
39
|
+
severity: "warn",
|
|
40
|
+
from: {},
|
|
41
|
+
to: {
|
|
42
|
+
dependencyTypes: ["core"],
|
|
43
|
+
path: [
|
|
44
|
+
"^(v8/tools/codemap)$",
|
|
45
|
+
"^(v8/tools/consarray)$",
|
|
46
|
+
"^(v8/tools/csvparser)$",
|
|
47
|
+
"^(v8/tools/logreader)$",
|
|
48
|
+
"^(v8/tools/profile_view)$",
|
|
49
|
+
"^(v8/tools/profile)$",
|
|
50
|
+
"^(v8/tools/SourceMap)$",
|
|
51
|
+
"^(v8/tools/splaytree)$",
|
|
52
|
+
"^(v8/tools/tickprocessor-driver)$",
|
|
53
|
+
"^(v8/tools/tickprocessor)$",
|
|
54
|
+
"^(node-inspect/lib/_inspect)$",
|
|
55
|
+
"^(node-inspect/lib/internal/inspect_client)$",
|
|
56
|
+
"^(node-inspect/lib/internal/inspect_repl)$",
|
|
57
|
+
"^(async_hooks)$",
|
|
58
|
+
"^(punycode)$",
|
|
59
|
+
"^(domain)$",
|
|
60
|
+
"^(constants)$",
|
|
61
|
+
"^(sys)$",
|
|
62
|
+
"^(_linklist)$",
|
|
63
|
+
"^(_stream_wrap)$",
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "not-to-deprecated",
|
|
69
|
+
comment:
|
|
70
|
+
"This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later " +
|
|
71
|
+
"version of that module, or find an alternative. Check out https://www.npmjs.com/package/[the-module-name] " +
|
|
72
|
+
"for details.",
|
|
73
|
+
severity: "warn",
|
|
74
|
+
from: {},
|
|
75
|
+
to: {
|
|
76
|
+
dependencyTypes: ["deprecated"],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "no-non-package-json",
|
|
81
|
+
severity: "error",
|
|
82
|
+
comment:
|
|
83
|
+
"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. " +
|
|
84
|
+
"That's problematic as the package either (1) won't be available on live (2 - worse) will be " +
|
|
85
|
+
"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies " +
|
|
86
|
+
"in your package.json.",
|
|
87
|
+
from: {},
|
|
88
|
+
to: {
|
|
89
|
+
dependencyTypes: ["npm-no-pkg", "npm-unknown"],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "not-to-unresolvable",
|
|
94
|
+
comment:
|
|
95
|
+
"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm " +
|
|
96
|
+
"module: add it to your package.json. In all other cases you likely already know what to do.",
|
|
97
|
+
severity: "error",
|
|
98
|
+
from: {},
|
|
99
|
+
to: {
|
|
100
|
+
couldNotResolve: true,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "no-duplicate-dep-types",
|
|
105
|
+
comment:
|
|
106
|
+
"Likely this module depends on an external ('npm') package that occurs more than once " +
|
|
107
|
+
"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " +
|
|
108
|
+
"maintenance problems later on.",
|
|
109
|
+
severity: "warn",
|
|
110
|
+
from: {},
|
|
111
|
+
to: {
|
|
112
|
+
moreThanOneDependencyType: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/* rules you might want to tweak for your specific situation: */
|
|
117
|
+
{
|
|
118
|
+
name: "not-to-test",
|
|
119
|
+
comment:
|
|
120
|
+
"This module depends on code within a folder that should only contain tests. As tests don't " +
|
|
121
|
+
"implement functionality this is odd. Either you're writing a test outside the test folder " +
|
|
122
|
+
"or there's something in the test folder that isn't a test.",
|
|
123
|
+
severity: "error",
|
|
124
|
+
from: {
|
|
125
|
+
pathNot: "^(src/(__tests__|__mocks__))",
|
|
126
|
+
},
|
|
127
|
+
to: {
|
|
128
|
+
path: "^(src/(__tests__|__mocks__))",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "not-to-spec",
|
|
133
|
+
comment:
|
|
134
|
+
"This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. " +
|
|
135
|
+
"If there's something in a spec that's of use to other modules, it doesn't have that single " +
|
|
136
|
+
"responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.",
|
|
137
|
+
severity: "error",
|
|
138
|
+
from: {},
|
|
139
|
+
to: {
|
|
140
|
+
path: "\\.(test|spec)\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\.md)$",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "not-to-dev-dep",
|
|
145
|
+
severity: "error",
|
|
146
|
+
comment:
|
|
147
|
+
"This module depends on an npm package from the 'devDependencies' section of your " +
|
|
148
|
+
"package.json. It looks like something that ships to production, though. To prevent problems " +
|
|
149
|
+
"with npm packages that aren't there on production declare it (only!) in the 'dependencies'" +
|
|
150
|
+
"section of your package.json. If this module is development only - add it to the " +
|
|
151
|
+
"from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration",
|
|
152
|
+
from: {
|
|
153
|
+
path: "^(src)",
|
|
154
|
+
pathNot: [
|
|
155
|
+
"\\.(test|spec)\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\.md)$",
|
|
156
|
+
"^(src/(__tests__|__mocks__))",
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
to: {
|
|
160
|
+
dependencyTypes: ["npm-dev"],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "optional-deps-used",
|
|
165
|
+
severity: "info",
|
|
166
|
+
comment:
|
|
167
|
+
"This module depends on an npm package that is declared as an optional dependency " +
|
|
168
|
+
"in your package.json. As this makes sense in limited situations only, it's flagged here. " +
|
|
169
|
+
"If you're using an optional dependency here by design - add an exception to your" +
|
|
170
|
+
"dependency-cruiser config.",
|
|
171
|
+
from: {},
|
|
172
|
+
to: {
|
|
173
|
+
dependencyTypes: ["npm-optional"],
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "peer-deps-used",
|
|
178
|
+
comment:
|
|
179
|
+
"This module depends on an npm package that is declared as a peer dependency " +
|
|
180
|
+
"in your package.json. This makes sense if your package is e.g. a plugin, but in " +
|
|
181
|
+
"other cases - maybe not so much. If the use of a peer dependency is intentional " +
|
|
182
|
+
"add an exception to your dependency-cruiser config.",
|
|
183
|
+
severity: "warn",
|
|
184
|
+
from: {},
|
|
185
|
+
to: {
|
|
186
|
+
dependencyTypes: ["npm-peer"],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
options: {
|
|
191
|
+
doNotFollow: {
|
|
192
|
+
path: "node_modules",
|
|
193
|
+
},
|
|
194
|
+
tsConfig: {
|
|
195
|
+
fileName: "tsconfig.json",
|
|
196
|
+
},
|
|
197
|
+
tsPreCompilationDeps: true,
|
|
198
|
+
enhancedResolveOptions: {
|
|
199
|
+
exportsFields: ["exports"],
|
|
200
|
+
conditionNames: ["import", "require", "node", "default"],
|
|
201
|
+
mainFields: ["module", "main", "types", "typings"],
|
|
202
|
+
},
|
|
203
|
+
reporterOptions: {
|
|
204
|
+
dot: {
|
|
205
|
+
collapsePattern: "node_modules/[^/]+",
|
|
206
|
+
theme: {
|
|
207
|
+
graph: {
|
|
208
|
+
bgcolor: "transparent",
|
|
209
|
+
color: "#000000",
|
|
210
|
+
fontcolor: "#000000",
|
|
211
|
+
fillcolor: "transparent",
|
|
212
|
+
splines: "ortho",
|
|
213
|
+
},
|
|
214
|
+
node: {
|
|
215
|
+
color: "#000000",
|
|
216
|
+
fillcolor: "#ffffcc",
|
|
217
|
+
fontcolor: "#000000",
|
|
218
|
+
},
|
|
219
|
+
edge: {
|
|
220
|
+
arrowhead: "normal",
|
|
221
|
+
arrowsize: "0.5",
|
|
222
|
+
penwidth: "1.0",
|
|
223
|
+
color: "#757575",
|
|
224
|
+
},
|
|
225
|
+
modules: [
|
|
226
|
+
{
|
|
227
|
+
criteria: { source: "^src/core" },
|
|
228
|
+
attributes: { fillcolor: "#ffcccc" },
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
criteria: { source: "^src/cli" },
|
|
232
|
+
attributes: { fillcolor: "#ccffcc" },
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
criteria: { source: "^src/utils" },
|
|
236
|
+
attributes: { fillcolor: "#ccccff" },
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
criteria: { source: "^src/types" },
|
|
240
|
+
attributes: { fillcolor: "#ffccff" },
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
dependencies: [
|
|
244
|
+
{
|
|
245
|
+
criteria: { resolved: "^src/core" },
|
|
246
|
+
attributes: { color: "#ff0000" },
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
criteria: { resolved: "^src/cli" },
|
|
250
|
+
attributes: { color: "#00ff00" },
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
criteria: { resolved: "^src/utils" },
|
|
254
|
+
attributes: { color: "#0000ff" },
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
archi: {
|
|
260
|
+
collapsePattern:
|
|
261
|
+
"^(node_modules|packages|src|lib|app|test(s?)|spec(s?))/[^/]+",
|
|
262
|
+
theme: {
|
|
263
|
+
graph: {
|
|
264
|
+
bgcolor: "transparent",
|
|
265
|
+
color: "#000000",
|
|
266
|
+
fontcolor: "#000000",
|
|
267
|
+
fillcolor: "transparent",
|
|
268
|
+
splines: "ortho",
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
text: {
|
|
273
|
+
highlightFocused: true,
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
};
|
package/.husky/commit-msg
CHANGED
|
File without changes
|
package/.husky/pre-commit
CHANGED
|
File without changes
|
package/.husky/pre-push
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,39 +1,62 @@
|
|
|
1
1
|
# get-cookie πͺ
|
|
2
2
|
|
|
3
|
-
Extract
|
|
3
|
+
Extract cookies from your browser's local storage and use them programmatically. This tool reads browser databases directly, handles decryption, and outputs cookies you can use in API calls, testing, or automation.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
**The Problem**: You're logged into a website in your browser, but you need those same cookies for API testing, automation, or debugging. Manually copying cookies from DevTools is tedious and they expire quickly.
|
|
8
|
+
|
|
9
|
+
**The Solution**: `get-cookie` reads cookies directly from browser databases (Chrome, Firefox, Safari, etc.), handles all the encryption/decryption, and gives you the cookie values to use programmatically.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
6
12
|
|
|
7
13
|
```bash
|
|
14
|
+
# Install globally
|
|
8
15
|
pnpm add -g @mherod/get-cookie
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
|
|
17
|
+
# Get a specific cookie
|
|
18
|
+
get-cookie sessionid example.com
|
|
19
|
+
|
|
20
|
+
# Get all cookies for a domain
|
|
21
|
+
get-cookie % example.com
|
|
22
|
+
|
|
23
|
+
# Use in curl/API calls
|
|
24
|
+
curl -H "Cookie: auth=$(get-cookie auth api.example.com)" https://api.example.com/user
|
|
11
25
|
```
|
|
12
26
|
|
|
13
27
|
```typescript
|
|
28
|
+
// Node.js/TypeScript usage
|
|
14
29
|
import { getCookie } from "@mherod/get-cookie";
|
|
15
30
|
|
|
16
31
|
const cookies = await getCookie({
|
|
17
|
-
name: "
|
|
18
|
-
domain: "example.com",
|
|
32
|
+
name: "auth_token",
|
|
33
|
+
domain: "api.example.com",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Use in fetch, axios, etc.
|
|
37
|
+
fetch("https://api.example.com/data", {
|
|
38
|
+
headers: {
|
|
39
|
+
Cookie: `auth_token=${cookies[0]?.value}`
|
|
40
|
+
}
|
|
19
41
|
});
|
|
20
42
|
```
|
|
21
43
|
|
|
22
|
-
##
|
|
44
|
+
## Common Use Cases
|
|
45
|
+
|
|
46
|
+
- **API Testing**: Extract session cookies to test authenticated endpoints
|
|
47
|
+
- **Browser Automation**: Get real cookies instead of managing login flows
|
|
48
|
+
- **Debugging**: Compare cookies across browsers to troubleshoot auth issues
|
|
49
|
+
- **CI/CD**: Automate authenticated API tests without storing credentials
|
|
50
|
+
- **Development**: Test with production-like authentication locally
|
|
23
51
|
|
|
24
|
-
|
|
25
|
-
- π **Debugging**: Inspect cookies across browsers to track down session issues
|
|
26
|
-
- π€ **Test Automation**: Use real browser cookies in your integration tests
|
|
27
|
-
- π **CI/CD**: Automate cookie extraction in your testing pipelines
|
|
28
|
-
- π§ͺ **Local Development**: Test your apps with production-like authentication
|
|
52
|
+
## How it works
|
|
29
53
|
|
|
30
|
-
|
|
54
|
+
1. **Locates browser databases** on your system (Chrome uses SQLite, Safari uses binary files)
|
|
55
|
+
2. **Handles encryption** (Chrome's keychain/DPAPI encryption, etc.)
|
|
56
|
+
3. **Extracts and parses** cookie data
|
|
57
|
+
4. **Returns usable values** you can immediately use in HTTP requests
|
|
31
58
|
|
|
32
|
-
|
|
33
|
-
- π― **Universal Browser Support**: Chrome (all platforms), Firefox, Safari - we've got you covered
|
|
34
|
-
- π **Developer Experience**: Rich CLI options and type-safe Node.js API
|
|
35
|
-
- β‘ **Lightning Fast**: Optimised binary parsing and decryption
|
|
36
|
-
- π οΈ **Production Ready**: Used in critical testing pipelines worldwide
|
|
59
|
+
No browser automation, no complex setup - just direct database access.
|
|
37
60
|
|
|
38
61
|
## Installation π¦
|
|
39
62
|
|
|
@@ -58,57 +81,92 @@ nvm use
|
|
|
58
81
|
|
|
59
82
|
The project includes an `.nvmrc` file that specifies the required Node.js version, so `nvm use` will automatically switch to the correct version when you're in the project directory.
|
|
60
83
|
|
|
61
|
-
##
|
|
84
|
+
## More Examples
|
|
62
85
|
|
|
63
86
|
### Command Line
|
|
64
87
|
|
|
65
88
|
```bash
|
|
66
|
-
|
|
67
|
-
get-cookie
|
|
68
|
-
|
|
89
|
+
# Basic cookie extraction
|
|
90
|
+
get-cookie sessionid github.com
|
|
91
|
+
|
|
92
|
+
# Get all cookies for a domain
|
|
93
|
+
get-cookie % api.stripe.com
|
|
94
|
+
|
|
95
|
+
# Pretty print with metadata
|
|
96
|
+
get-cookie auth example.com --render
|
|
97
|
+
|
|
98
|
+
# JSON output for scripting
|
|
99
|
+
get-cookie % example.com --output json
|
|
100
|
+
|
|
101
|
+
# Specific browser/profile
|
|
102
|
+
get-cookie auth example.com --browser chrome --profile "Work"
|
|
69
103
|
```
|
|
70
104
|
|
|
71
|
-
###
|
|
105
|
+
### API Usage
|
|
72
106
|
|
|
73
107
|
```typescript
|
|
74
|
-
import { getCookie } from "@mherod/get-cookie";
|
|
108
|
+
import { getCookie, batchGetCookies } from "@mherod/get-cookie";
|
|
75
109
|
|
|
76
|
-
//
|
|
77
|
-
const
|
|
78
|
-
name: "
|
|
79
|
-
domain: "
|
|
110
|
+
// Single cookie
|
|
111
|
+
const auth = await getCookie({
|
|
112
|
+
name: "sessionid",
|
|
113
|
+
domain: "github.com"
|
|
80
114
|
});
|
|
81
115
|
|
|
82
|
-
//
|
|
83
|
-
const cookies = await
|
|
84
|
-
name: "
|
|
85
|
-
domain: "example.com",
|
|
116
|
+
// Multiple cookies efficiently (2-3x faster than individual calls)
|
|
117
|
+
const cookies = await batchGetCookies([
|
|
118
|
+
{ name: "auth", domain: "api.example.com" },
|
|
119
|
+
{ name: "session", domain: "app.example.com" },
|
|
120
|
+
{ name: "csrf", domain: "admin.example.com" }
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
// Use in HTTP client
|
|
124
|
+
const response = await fetch("https://api.github.com/user", {
|
|
125
|
+
headers: {
|
|
126
|
+
"Cookie": `sessionid=${auth[0]?.value}`
|
|
127
|
+
}
|
|
86
128
|
});
|
|
87
129
|
```
|
|
88
130
|
|
|
89
|
-
|
|
131
|
+
### Real-world Integration
|
|
90
132
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
- π₯ **Multi-Profile**: Full support for browser profiles
|
|
133
|
+
```bash
|
|
134
|
+
# Test API endpoint with browser cookies
|
|
135
|
+
AUTH=$(get-cookie connect.sid api.example.com)
|
|
136
|
+
curl -H "Cookie: connect.sid=$AUTH" https://api.example.com/profile
|
|
96
137
|
|
|
97
|
-
|
|
138
|
+
# Compare session across browsers
|
|
139
|
+
echo "Chrome:" && get-cookie JSESSIONID app.example.com --browser chrome
|
|
140
|
+
echo "Firefox:" && get-cookie JSESSIONID app.example.com --browser firefox
|
|
98
141
|
|
|
99
|
-
|
|
142
|
+
# Batch export for migration
|
|
143
|
+
get-cookie % example.com --output json > cookies-backup.json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Features
|
|
100
147
|
|
|
101
|
-
|
|
148
|
+
- **Multiple browsers**: Chrome, Firefox, Safari, Edge, Opera, Arc, Brave - reads from each browser's native storage format
|
|
149
|
+
- **Handles encryption**: Automatically decrypts Chrome's keychain-encrypted cookies (macOS), DPAPI-encrypted cookies (Windows), and keyring encryption (Linux)
|
|
150
|
+
- **Multiple profiles**: Works with all browser profiles (Personal, Work, etc.)
|
|
151
|
+
- **Batch operations**: Get multiple cookies efficiently with built-in SQL optimization (2-3x faster)
|
|
152
|
+
- **Cross-platform**: macOS, Linux, Windows support
|
|
153
|
+
- **Output formats**: Raw values, JSON, pretty-printed tables
|
|
102
154
|
|
|
103
|
-
|
|
155
|
+
## Browser Support π
|
|
104
156
|
|
|
105
|
-
|
|
106
|
-
- **π Documentation**: Auto-generated docs with TypeScript APIs
|
|
107
|
-
- **π§ͺ Comprehensive Testing**: Swift CookieCreator, binary cookies, and validation scripts
|
|
108
|
-
- **π¦ Automated Releases**: NPM publishing with GitHub release creation
|
|
109
|
-
- **β
Quality Gates**: TypeScript checking, ESLint, Prettier, and link validation
|
|
157
|
+
Supports **11 major browsers** across **macOS, Linux, and Windows**:
|
|
110
158
|
|
|
111
|
-
|
|
159
|
+
- **Chromium-based**: Chrome, Edge, ArcΒΉ, Opera, Opera GX, Chromium, Brave
|
|
160
|
+
- **Firefox-based**: Firefox, Firefox Developer Edition, Firefox ESR
|
|
161
|
+
- **Safari**: macOS only
|
|
162
|
+
|
|
163
|
+
ΒΉ *Arc added Windows support in April 2024*
|
|
164
|
+
|
|
165
|
+
**β See complete [Browser Support Matrix](docs/guide/browser-support.md) for detailed platform compatibility**
|
|
166
|
+
|
|
167
|
+
## Documentation π
|
|
168
|
+
|
|
169
|
+
Explore our comprehensive docs at [mherod.github.io/get-cookie](https://mherod.github.io/get-cookie/)
|
|
112
170
|
|
|
113
171
|
## Contributing π€
|
|
114
172
|
|
package/biome.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
|
|
3
3
|
"vcs": {
|
|
4
4
|
"enabled": true,
|
|
5
5
|
"clientKind": "git",
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": {
|
|
10
10
|
"ignoreUnknown": false,
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
11
|
+
"includes": [
|
|
12
|
+
"**",
|
|
13
|
+
"!**/dist/**",
|
|
14
|
+
"!**/node_modules/**",
|
|
15
|
+
"!**/coverage/**",
|
|
16
|
+
"!**/docs/.vitepress/cache/**",
|
|
17
|
+
"!**/*.log",
|
|
18
|
+
"!**/.parcel-cache/**"
|
|
18
19
|
]
|
|
19
20
|
},
|
|
20
21
|
"formatter": {
|
|
@@ -28,25 +29,33 @@
|
|
|
28
29
|
"attributePosition": "auto",
|
|
29
30
|
"bracketSpacing": true
|
|
30
31
|
},
|
|
31
|
-
"
|
|
32
|
+
"assist": { "actions": { "source": { "organizeImports": "off" } } },
|
|
32
33
|
"linter": {
|
|
33
34
|
"enabled": true,
|
|
34
35
|
"rules": {
|
|
35
36
|
"recommended": true,
|
|
36
37
|
"correctness": {
|
|
37
38
|
"noUnusedImports": "error",
|
|
38
|
-
"noUnusedVariables": "error"
|
|
39
|
-
"useArrayLiterals": "off"
|
|
39
|
+
"noUnusedVariables": "error"
|
|
40
40
|
},
|
|
41
41
|
"style": {
|
|
42
42
|
"useImportType": "error",
|
|
43
43
|
"noNamespace": "error",
|
|
44
44
|
"noNonNullAssertion": "error",
|
|
45
|
-
"noVar": "error",
|
|
46
45
|
"useAsConstAssertion": "error",
|
|
47
46
|
"useBlockStatements": "error",
|
|
48
47
|
"useConst": "error",
|
|
49
|
-
"useLiteralEnumMembers": "error"
|
|
48
|
+
"useLiteralEnumMembers": "error",
|
|
49
|
+
"noParameterAssign": "error",
|
|
50
|
+
"useDefaultParameterLast": "error",
|
|
51
|
+
"useEnumInitializers": "error",
|
|
52
|
+
"useSelfClosingElements": "error",
|
|
53
|
+
"useSingleVarDeclarator": "error",
|
|
54
|
+
"noUnusedTemplateLiteral": "error",
|
|
55
|
+
"useNumberNamespace": "error",
|
|
56
|
+
"noInferrableTypes": "error",
|
|
57
|
+
"noUselessElse": "error",
|
|
58
|
+
"useArrayLiterals": "off"
|
|
50
59
|
},
|
|
51
60
|
"complexity": {
|
|
52
61
|
"noStaticOnlyClass": "error",
|
|
@@ -63,8 +72,12 @@
|
|
|
63
72
|
"noMisleadingInstantiator": "error",
|
|
64
73
|
"noPrototypeBuiltins": "error",
|
|
65
74
|
"noUnsafeDeclarationMerging": "error",
|
|
66
|
-
"useAwait": "
|
|
67
|
-
"useNamespaceKeyword": "error"
|
|
75
|
+
"useAwait": "off",
|
|
76
|
+
"useNamespaceKeyword": "error",
|
|
77
|
+
"noAsyncPromiseExecutor": "error",
|
|
78
|
+
"noMisleadingCharacterClass": "error",
|
|
79
|
+
"noThenProperty": "error",
|
|
80
|
+
"noVar": "error"
|
|
68
81
|
},
|
|
69
82
|
"nursery": {
|
|
70
83
|
"useSortedClasses": "off"
|
|
@@ -87,8 +100,18 @@
|
|
|
87
100
|
},
|
|
88
101
|
"overrides": [
|
|
89
102
|
{
|
|
90
|
-
"
|
|
103
|
+
"includes": ["**/.prettierrc/**", "**/.parcelrc/**"],
|
|
91
104
|
"formatter": { "indentWidth": 2 }
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"includes": ["**/*.test.ts", "**/*.spec.ts", "**/BinaryCodable*.ts"],
|
|
108
|
+
"linter": {
|
|
109
|
+
"rules": {
|
|
110
|
+
"style": {
|
|
111
|
+
"noNonNullAssertion": "off"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
92
115
|
}
|
|
93
116
|
]
|
|
94
117
|
}
|