├── .eslintrc
├── .github
├── scripts
│ └── before-beta-release.js
└── workflows
│ ├── check.yml
│ └── release.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── docs
├── README.md
└── build-docs.js
├── jest.config.ts
├── package.json
├── src
├── constants.ts
├── data_files
│ └── fingerprint-network-definition.json
├── fingerprint-generator.ts
└── index.ts
├── test
├── generation.test.ts
└── tsconfig.json
├── tsconfig.eslint.json
└── tsconfig.json
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "@apify/ts"
4 | ],
5 | "parserOptions": {
6 | "project": "tsconfig.eslint.json"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/.github/scripts/before-beta-release.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const fs = require('fs');
3 | const { execSync } = require('child_process');
4 |
5 | const PKG_JSON_PATH = path.join(__dirname, '..', '..', 'package.json');
6 |
7 | const pkgJson = require(PKG_JSON_PATH);
8 |
9 | const PACKAGE_NAME = pkgJson.name;
10 | const VERSION = pkgJson.version;
11 |
12 | const nextVersion = getNextVersion(VERSION);
13 | console.log(`before-deploy: Setting version to ${nextVersion}`);
14 | pkgJson.version = nextVersion;
15 |
16 | fs.writeFileSync(PKG_JSON_PATH, JSON.stringify(pkgJson, null, 2) + '\n');
17 |
18 | function getNextVersion(version) {
19 | const versionString = execSync(`npm show ${PACKAGE_NAME} versions --json`, { encoding: 'utf8'});
20 | const versions = JSON.parse(versionString);
21 |
22 | if (versions.some(v => v === VERSION)) {
23 | console.error(`before-deploy: A release with version ${VERSION} already exists. Please increment version accordingly.`);
24 | process.exit(1);
25 | }
26 |
27 | const prereleaseNumbers = versions
28 | .filter(v => (v.startsWith(VERSION) && v.includes('-')))
29 | .map(v => Number(v.match(/\.(\d+)$/)[1]));
30 | const lastPrereleaseNumber = Math.max(-1, ...prereleaseNumbers);
31 | return `${version}-beta.${lastPrereleaseNumber + 1}`
32 | }
33 |
--------------------------------------------------------------------------------
/.github/workflows/check.yml:
--------------------------------------------------------------------------------
1 | # This workflow runs for every pull request to lint and test the proposed changes.
2 |
3 | name: Check
4 |
5 | on:
6 | pull_request:
7 |
8 | jobs:
9 | # NPM install is done in a separate job and cached to speed up the following jobs.
10 | build_and_test:
11 | name: Build & Test
12 | if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
13 | runs-on: ${{ matrix.os }}
14 |
15 | strategy:
16 | matrix:
17 | os: [ubuntu-latest, windows-latest, macos-latest]
18 | node-version: [ 12, 14, 15]
19 |
20 | steps:
21 | -
22 | uses: actions/checkout@v2
23 | -
24 | name: Use Node.js ${{ matrix.node-version }}
25 | uses: actions/setup-node@v1
26 | with:
27 | node-version: ${{ matrix.node-version }}
28 | -
29 | name: Cache Node Modules
30 | if: ${{ matrix.node-version == 14 }}
31 | uses: actions/cache@v2
32 | with:
33 | path: |
34 | node_modules
35 | build
36 | key: cache-${{ github.run_id }}-v14
37 | -
38 | name: Install Dependencies
39 | run: npm install
40 | -
41 | name: Run Tests
42 | run: npm test
43 |
44 | lint:
45 | name: Lint
46 | needs: [build_and_test]
47 | runs-on: ubuntu-latest
48 |
49 | steps:
50 | -
51 | uses: actions/checkout@v2
52 | -
53 | name: Use Node.js 14
54 | uses: actions/setup-node@v1
55 | with:
56 | node-version: 14
57 | -
58 | name: Load Cache
59 | uses: actions/cache@v2
60 | with:
61 | path: |
62 | node_modules
63 | build
64 | key: cache-${{ github.run_id }}-v14
65 | -
66 | run: npm run lint
67 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Check & Release
2 |
3 | on:
4 | # Push to master will deploy a beta version
5 | push:
6 | branches:
7 | - master
8 | # A release via GitHub releases will deploy a latest version
9 | release:
10 | types: [ published ]
11 |
12 | jobs:
13 | # NPM install is done in a separate job and cached to speed up the following jobs.
14 | build_and_test:
15 | name: Build & Test
16 | if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
17 | runs-on: ${{ matrix.os }}
18 |
19 | strategy:
20 | matrix:
21 | os: [ubuntu-latest, windows-latest, macos-latest]
22 | node-version: [12, 14, 15]
23 |
24 | steps:
25 | -
26 | uses: actions/checkout@v2
27 | -
28 | name: Use Node.js ${{ matrix.node-version }}
29 | uses: actions/setup-node@v1
30 | with:
31 | node-version: ${{ matrix.node-version }}
32 | -
33 | name: Cache Node Modules
34 | if: ${{ matrix.node-version == 14 }}
35 | uses: actions/cache@v2
36 | with:
37 | path: |
38 | node_modules
39 | build
40 | key: cache-${{ github.run_id }}-v14
41 | -
42 | name: Install Dependencies
43 | run: npm install
44 | -
45 | name: Run Tests
46 | run: npm test
47 |
48 | lint:
49 | name: Lint
50 | needs: [build_and_test]
51 | runs-on: ubuntu-latest
52 |
53 | steps:
54 | -
55 | uses: actions/checkout@v2
56 | -
57 | name: Use Node.js 14
58 | uses: actions/setup-node@v1
59 | with:
60 | node-version: 14
61 | -
62 | name: Load Cache
63 | uses: actions/cache@v2
64 | with:
65 | path: |
66 | node_modules
67 | build
68 | key: cache-${{ github.run_id }}-v14
69 | -
70 | run: npm run lint
71 |
72 |
73 | # The deploy job is long but there are only 2 important parts. NPM publish
74 | # and triggering of docker image builds in the apify-actor-docker repo.
75 | deploy:
76 | name: Publish to NPM
77 | needs: [lint]
78 | runs-on: ubuntu-latest
79 | steps:
80 | -
81 | uses: actions/checkout@v2
82 | -
83 | uses: actions/setup-node@v1
84 | with:
85 | node-version: 14
86 | registry-url: https://registry.npmjs.org/
87 | -
88 | name: Load Cache
89 | uses: actions/cache@v2
90 | with:
91 | path: |
92 | node_modules
93 | build
94 | key: cache-${{ github.run_id }}-v14
95 | -
96 | # Determine if this is a beta or latest release
97 | name: Set Release Tag
98 | run: echo "RELEASE_TAG=$(if [ ${{ github.event_name }} = release ]; then echo latest; else echo beta; fi)" >> $GITHUB_ENV
99 | -
100 | # Check version consistency and increment pre-release version number for beta only.
101 | name: Bump pre-release version
102 | if: env.RELEASE_TAG == 'beta'
103 | run: node ./.github/scripts/before-beta-release.js
104 | -
105 | name: Publish to NPM
106 | run: NODE_AUTH_TOKEN=${{secrets.NPM_TOKEN}} npm publish --tag ${{ env.RELEASE_TAG }} --access public
107 | -
108 | # Latest version is tagged by the release process so we only tag beta here.
109 | name: Tag Version
110 | if: env.RELEASE_TAG == 'beta'
111 | run: |
112 | git_tag=v`node -p "require('./package.json').version"`
113 | git tag $git_tag
114 | git push origin $git_tag
115 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | # public
90 |
91 | # vuepress build output
92 | .vuepress/dist
93 |
94 | # Serverless directories
95 | .serverless/
96 |
97 | # FuseBox cache
98 | .fusebox/
99 |
100 | # DynamoDB Local files
101 | .dynamodb/
102 |
103 | # TernJS port file
104 | .tern-port
105 | package-lock.json
106 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | 3.0.0 / 2021/10/17
2 | ====================
3 | First stable version.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # (DEPRECATED) Fingerprint generator
2 |
3 | ---
4 |
5 | **DEPRECATED** The `fingerprint-generator` package now lives in the [fingerprint-suite](https://github.com/apify/fingerprint-suite) repository. This repository is no longer actively maintained.
6 |
7 | ---
8 |
9 | NodeJs package for generating realistic browser fingerprints and matching headers.
10 |
11 | Works best with the [Fingerprint injector](https://github.com/apify/fingerprint-injector).
12 |
13 |
14 |
15 | - [Installation](#installation)
16 | - [Usage](#usage)
17 | - [Result example](#result-example)
18 | - [API Reference](#api-reference)
19 |
20 |
21 |
22 | ## Installation
23 | Run the `npm install fingerprint-generator` command. No further setup is needed afterwards.
24 | ## Usage
25 | To use the generator, you need to create an instance of the `FingerprintGenerator` class which is exported from this package. Constructor of this class accepts a `HeaderGeneratorOptions` object, which can be used to globally specify what kind of fingerprint and headers you are looking for:
26 | ```js
27 | const FingerprintGenerator = require('fingerprint-generator');
28 | let fingerprintGenerator = new FingerprintGenerator({
29 | browsers: [
30 | {name: "firefox", minVersion: 80},
31 | {name: "chrome", minVersion: 87},
32 | "safari"
33 | ],
34 | devices: [
35 | "desktop"
36 | ],
37 | operatingSystems: [
38 | "windows"
39 | ]
40 | });
41 | ```
42 | You can then get the fingerprint and headers using the `getFingerprint` method, either with no argument, or with another `HeaderGeneratorOptions` object, this time specifying the options only for this call (overwriting the global options when in conflict) and using the global options specified beforehands for the unspecified options:
43 | ```js
44 | let { fingerprint, headers } = fingerprintGenerator.getFingerprint({
45 | operatingSystems: [
46 | "linux"
47 | ],
48 | locales: ["en-US", "en"]
49 | });
50 | ```
51 | This method always generates a random realistic fingerprint and a matching set of headers, excluding the request dependant headers, which need to be filled in afterwards. Since the generation is randomized, multiple calls to this method with the same parameters can generate multiple different outputs.
52 | ## Result example
53 | Fingerprint that might be generated for the usage example above:
54 | ```json
55 | {
56 | "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0",
57 | "cookiesEnabled": true,
58 | "timezone": "Europe/Prague",
59 | "timezoneOffset": -60,
60 | "audioCodecs": {
61 | "ogg": "probably",
62 | "mp3": "maybe",
63 | "wav": "probably",
64 | "m4a": "maybe",
65 | "aac": "maybe"
66 | },
67 | "videoCodecs": {
68 | "ogg": "probably",
69 | "h264": "probably",
70 | "webm": "probably"
71 | },
72 | "videoCard": [
73 | "Intel Open Source Technology Center",
74 | "Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)"
75 | ],
76 | "productSub": "20100101",
77 | "hardwareConcurrency": 8,
78 | "multimediaDevices": {
79 | "speakers": 0,
80 | "micros": 0,
81 | "webcams": 0
82 | },
83 | "platform": "Linux x86_64",
84 | "pluginsSupport": true,
85 | "screenResolution": [ 1920, 1080 ],
86 | "availableScreenResolution": [ 1920, 1080 ],
87 | "colorDepth": 24,
88 | "touchSupport": {
89 | "maxTouchPoints": 0,
90 | "touchEvent": false,
91 | "touchStart": false
92 | },
93 | "languages": [ "en-US", "en" ]
94 | }
95 | ```
96 | And the matching headers:
97 | ```json
98 | {
99 | "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0",
100 | "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
101 | "accept-language": "en-US,en;q=0.9",
102 | "accept-encoding": "gzip, deflate, br",
103 | "upgrade-insecure-requests": "1",
104 | "te": "trailers"
105 | }
106 | ```
107 | ## API Reference
108 | All public classes, methods and their parameters can be inspected in this API reference.
109 |
110 |
111 |
112 | ### FingerprintGenerator
113 | Fingerprint generator - randomly generates realistic browser fingerprints
114 |
115 |
116 | * [FingerprintGenerator](#FingerprintGenerator)
117 | * [`new FingerprintGenerator(options)`](#new_FingerprintGenerator_new)
118 | * [`.getFingerprint(options, requestDependentHeaders)`](#FingerprintGenerator+getFingerprint)
119 |
120 |
121 | * * *
122 |
123 |
124 |
125 | #### `new FingerprintGenerator(options)`
126 |
127 | | Param | Type | Description |
128 | | --- | --- | --- |
129 | | options | [HeaderGeneratorOptions
](#HeaderGeneratorOptions) | default header generation options used unless overridden |
130 |
131 |
132 | * * *
133 |
134 |
135 |
136 | #### `fingerprintGenerator.getFingerprint(options, requestDependentHeaders)`
137 | Generates a fingerprint and a matching set of ordered headers using a combination of the default options specified in the constructor
138 | and their possible overrides provided here.
139 |
140 |
141 | | Param | Type | Description |
142 | | --- | --- | --- |
143 | | options | [HeaderGeneratorOptions
](#HeaderGeneratorOptions) | specifies options that should be overridden for this one call |
144 | | requestDependentHeaders | Object
| specifies known values of headers dependent on the particular request |
145 |
146 |
147 | * * *
148 |
149 |
150 |
151 | ### `BrowserSpecification`
152 |
153 | | Param | Type | Description |
154 | | --- | --- | --- |
155 | | name | string
| One of `chrome`, `firefox` and `safari`. |
156 | | minVersion | number
| Minimal version of browser used. |
157 | | maxVersion | number
| Maximal version of browser used. |
158 | | httpVersion | string
| Http version to be used to generate headers (the headers differ depending on the version). Either 1 or 2. If none specified the httpVersion specified in `HeaderGeneratorOptions` is used. |
159 |
160 |
161 | * * *
162 |
163 |
164 |
165 | ### `HeaderGeneratorOptions`
166 |
167 | | Param | Type | Description |
168 | | --- | --- | --- |
169 | | browsers | Array.<(BrowserSpecification\|string)>
| List of BrowserSpecifications to generate the headers for, or one of `chrome`, `firefox` and `safari`. |
170 | | operatingSystems | Array.<string>
| List of operating systems to generate the headers for. The options are `windows`, `macos`, `linux`, `android` and `ios`. |
171 | | devices | Array.<string>
| List of devices to generate the headers for. Options are `desktop` and `mobile`. |
172 | | locales | Array.<string>
| List of at most 10 languages to include in the [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) request header in the language format accepted by that header, for example `en`, `en-US` or `de`. |
173 | | httpVersion | string
| Http version to be used to generate headers (the headers differ depending on the version). Can be either 1 or 2. Default value is 2. |
174 |
175 |
176 | * * *
177 |
178 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Fingerprint generator
2 | NodeJs package for generating realistic browser fingerprints and matching headers. Works best with the [Fingerprint injector](https://github.com/apify/fingerprint-injector).
3 |
4 |
5 |
6 | - [Installation](#installation)
7 | - [Usage](#usage)
8 | - [Result example](#result-example)
9 | - [API Reference](#api-reference)
10 |
11 |
12 |
13 | ## Installation
14 | Run the `npm install fingerprint-generator` command. No further setup is needed afterwards.
15 | ## Usage
16 | To use the generator, you need to create an instance of the `FingerprintGenerator` class which is exported from this package. Constructor of this class accepts a `HeaderGeneratorOptions` object, which can be used to globally specify what kind of fingerprint and headers you are looking for:
17 | ```js
18 | const FingerprintGenerator = require('fingerprint-generator');
19 | let fingerprintGenerator = new FingerprintGenerator({
20 | browsers: [
21 | {name: "firefox", minVersion: 80},
22 | {name: "chrome", minVersion: 87},
23 | "safari"
24 | ],
25 | devices: [
26 | "desktop"
27 | ],
28 | operatingSystems: [
29 | "windows"
30 | ]
31 | });
32 | ```
33 | You can then get the fingerprint and headers using the `getFingerprint` method, either with no argument, or with another `HeaderGeneratorOptions` object, this time specifying the options only for this call (overwriting the global options when in conflict) and using the global options specified beforehands for the unspecified options:
34 | ```js
35 | let { fingerprint, headers } = fingerprintGenerator.getFingerprint({
36 | operatingSystems: [
37 | "linux"
38 | ],
39 | locales: ["en-US", "en"]
40 | });
41 | ```
42 | This method always generates a random realistic fingerprint and a matching set of headers, excluding the request dependant headers, which need to be filled in afterwards. Since the generation is randomized, multiple calls to this method with the same parameters can generate multiple different outputs.
43 | ## Result example
44 | Fingerprint that might be generated for the usage example above:
45 | ```json
46 | {
47 | "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0",
48 | "cookiesEnabled": true,
49 | "timezone": "Europe/Prague",
50 | "timezoneOffset": -60,
51 | "audioCodecs": {
52 | "ogg": "probably",
53 | "mp3": "maybe",
54 | "wav": "probably",
55 | "m4a": "maybe",
56 | "aac": "maybe"
57 | },
58 | "videoCodecs": {
59 | "ogg": "probably",
60 | "h264": "probably",
61 | "webm": "probably"
62 | },
63 | "videoCard": [
64 | "Intel Open Source Technology Center",
65 | "Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)"
66 | ],
67 | "productSub": "20100101",
68 | "hardwareConcurrency": 8,
69 | "multimediaDevices": {
70 | "speakers": 0,
71 | "micros": 0,
72 | "webcams": 0
73 | },
74 | "platform": "Linux x86_64",
75 | "pluginsSupport": true,
76 | "screenResolution": [ 1920, 1080 ],
77 | "availableScreenResolution": [ 1920, 1080 ],
78 | "colorDepth": 24,
79 | "touchSupport": {
80 | "maxTouchPoints": 0,
81 | "touchEvent": false,
82 | "touchStart": false
83 | },
84 | "languages": [ "en-US", "en" ]
85 | }
86 | ```
87 | And the matching headers:
88 | ```json
89 | {
90 | "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0",
91 | "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
92 | "accept-language": "en-US,en;q=0.9",
93 | "accept-encoding": "gzip, deflate, br",
94 | "upgrade-insecure-requests": "1",
95 | "te": "trailers"
96 | }
97 | ```
98 | ## API Reference
99 | All public classes, methods and their parameters can be inspected in this API reference.
100 |
101 | {{>all-docs~}}
102 |
103 |
--------------------------------------------------------------------------------
/docs/build-docs.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs-extra');
2 | const jsdoc2md = require('jsdoc-to-markdown'); // eslint-disable-line
3 | const path = require('path');
4 |
5 | const TEMPLATE_PATH = path.join(__dirname, 'README.md');
6 | const README_PATH = path.resolve(__dirname, '..', 'README.md');
7 | const SRC_DIR = path.resolve(__dirname, '..', 'src');
8 |
9 | const getRenderOptions = (template, data) => ({
10 | template,
11 | data,
12 | 'name-format': true,
13 | separators: true,
14 | 'param-list-format': 'table',
15 | 'property-list-format': 'table',
16 | 'heading-depth': 3,
17 | });
18 |
19 | const generateFinalMarkdown = (text) => {
20 | // Remove 'Kind' annotations.
21 | return text.replace(/\*\*Kind\*\*.*\n/g, '');
22 | };
23 |
24 | const main = async () => {
25 | const indexData = await jsdoc2md.getTemplateData({
26 | files: [path.join(SRC_DIR, 'main.js')],
27 | });
28 | const classData = await jsdoc2md.getTemplateData({
29 | files: [
30 | path.join(SRC_DIR, 'fingerprint-generator.js'),
31 | ],
32 | });
33 |
34 | let templateData = indexData.concat(classData);
35 |
36 | const EMPTY = Symbol('empty');
37 | /* reduce templateData to an array of class names */
38 | templateData.forEach((identifier) => {
39 | // @hideconstructor does not work, so we nudge it
40 | if (identifier.hideconstructor) {
41 | const idx = templateData.findIndex((i) => i.id === `${identifier.name}()`);
42 | templateData[idx] = EMPTY;
43 | }
44 | });
45 |
46 | templateData = templateData.filter((d) => d !== EMPTY);
47 |
48 | const template = await fs.readFile(TEMPLATE_PATH, 'utf8');
49 | const output = jsdoc2md.renderSync(getRenderOptions(template, templateData));
50 | const markdown = generateFinalMarkdown(output);
51 | await fs.writeFile(README_PATH, markdown);
52 | };
53 |
54 | main().then(() => console.log('All docs built successfully.'));
55 |
--------------------------------------------------------------------------------
/jest.config.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from '@jest/types';
2 |
3 | export default async (): Promise => ({
4 | verbose: true,
5 | preset: 'ts-jest',
6 | testEnvironment: 'node',
7 | testRunner: 'jest-circus/runner',
8 | testTimeout: 20_000,
9 | collectCoverage: false, // If true it messes the injection script and the browser is not able to execute it.
10 | maxWorkers: 3,
11 | globals: {
12 | 'ts-jest': {
13 | tsconfig: '/test/tsconfig.json',
14 | },
15 | },
16 | });
17 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fingerprint-generator",
3 | "version": "2.0.0",
4 | "description": "NodeJs package for generating realistic browser fingerprints.",
5 | "homepage": "https://github.com/apify/fingerprint-generator#readme",
6 | "engines": {
7 | "node": ">=15.10.0"
8 | },
9 | "files": [
10 | "dist"
11 | ],
12 | "main": "dist/index.js",
13 | "module": "dist/index.mjs",
14 | "types": "dist/index.d.ts",
15 | "exports": {
16 | ".": {
17 | "import": "./dist/index.mjs",
18 | "require": "./dist/index.js"
19 | }
20 | },
21 | "scripts": {
22 | "build": "rimraf dist && tsc",
23 | "postbuild": "gen-esm-wrapper dist/index.js dist/index.mjs",
24 | "prepublishOnly": "npm run build",
25 | "lint": "eslint src test",
26 | "lint:fix": "eslint src test --fix",
27 | "test": "npm run build && jest",
28 | "build-docs": "npm run build && npm run build-toc && node docs/build-docs.js",
29 | "build-toc": "markdown-toc docs/README.md -i"
30 | },
31 | "repository": {
32 | "type": "git",
33 | "url": "git+https://github.com/apify/fingerprint-generator.git"
34 | },
35 | "author": "Apify",
36 | "license": "Apache-2.0",
37 | "bugs": {
38 | "url": "https://github.com/apify/fingerprint-generator/issues"
39 | },
40 | "dependencies": {
41 | "csv-parse": "^4.15.3",
42 | "generative-bayesian-network": "0.1.0-beta.1",
43 | "header-generator": "^2.0.0-beta.9",
44 | "ow": "^0.24.1",
45 | "tslib": "^2.3.1"
46 | },
47 | "devDependencies": {
48 | "@apify/eslint-config-ts": "^0.1.4",
49 | "@apify/tsconfig": "^0.1.0",
50 | "@types/jest": "^27.0.2",
51 | "@typescript-eslint/eslint-plugin": "^4.32.0",
52 | "@typescript-eslint/parser": "^4.32.0",
53 | "eslint": "^7.0.0",
54 | "gen-esm-wrapper": "^1.1.3",
55 | "jest": "^27.2.5",
56 | "jest-circus": "^27.2.4",
57 | "jsdoc-to-markdown": "^7.0.0",
58 | "markdown-toc": "^1.2.0",
59 | "ts-jest": "^27.0.5",
60 | "ts-node": "^10.2.1",
61 | "typescript": "^4.4.3"
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/constants.ts:
--------------------------------------------------------------------------------
1 | export const STRINGIFIED_PREFIX = '*STRINGIFIED*' as const;
2 | export const MISSING_VALUE_DATASET_TOKEN = '*MISSING_VALUE*' as const;
3 |
--------------------------------------------------------------------------------
/src/fingerprint-generator.ts:
--------------------------------------------------------------------------------
1 | import { HeaderGenerator, HeaderGeneratorOptions, Headers } from 'header-generator';
2 |
3 | // @ts-expect-error No ts definition
4 | import { BayesianNetwork } from 'generative-bayesian-network';
5 |
6 | import fingerprintNetworkDefinition from './data_files/fingerprint-network-definition.json';
7 | import { MISSING_VALUE_DATASET_TOKEN, STRINGIFIED_PREFIX } from './constants';
8 |
9 | export type ScreenFingerprint = {
10 | availHeight: number,
11 | availWidth: number,
12 | pixelDepth: number,
13 | height: number,
14 | width: number,
15 | availTop: number,
16 | availLeft: number,
17 | colorDepth: number,
18 | innerHeight: number,
19 | outerHeight: number,
20 | outerWidth: number,
21 | innerWidth: number,
22 | screenX: number,
23 | pageXOffset: number,
24 | pageYOffset: number,
25 | devicePixelRatio: number,
26 | clientWidth: number,
27 | clientHeight: number,
28 | hasHDR: boolean;
29 | }
30 |
31 | export type NavigatorFingerprint = {
32 | userAgent: string,
33 | userAgentData: Record,
34 | doNotTrack: string,
35 | appCodeName: string,
36 | appName: string,
37 | appVersion: string,
38 | oscpu: string,
39 | webdriver: string,
40 | language: string,
41 | languages: string[],
42 | platform: string,
43 | deviceMemory?: number, // Firefox does not have deviceMemory available
44 | hardwareConcurrency: number,
45 | product: string,
46 | productSub: string,
47 | vendor: string,
48 | vendorSub: string,
49 | maxTouchPoints?: number,
50 | extraProperties: Record;
51 | }
52 |
53 | export type VideoCard = {
54 | renderer: string;
55 | vendor: string;
56 | }
57 |
58 | export type Fingerprint = {
59 | screen: ScreenFingerprint,
60 | navigator: NavigatorFingerprint,
61 | videoCodecs: Record,
62 | audioCodecs: Record,
63 | pluginsData: Record,
64 | battery?: Record,
65 | videoCard: VideoCard,
66 | multimediaDevices: string[],
67 | fonts: string[];
68 | }
69 |
70 | export type BrowserFingerprintWithHeaders = {
71 | headers: Headers,
72 | fingerprint: Fingerprint,
73 | }
74 | /**
75 | * @typedef BrowserSpecification
76 | * @param {string} name - One of `chrome`, `edge`, `firefox` and `safari`.
77 | * @param {number} minVersion - Minimal version of browser used.
78 | * @param {number} maxVersion - Maximal version of browser used.
79 | * @param {string} httpVersion - Http version to be used to generate headers (the headers differ depending on the version).
80 | * Either 1 or 2. If none specified the httpVersion specified in `HeaderGeneratorOptions` is used.
81 | */
82 |
83 | /**
84 | * @typedef HeaderGeneratorOptions
85 | * @param {Array} browsers - List of BrowserSpecifications to generate the headers for,
86 | * or one of `chrome`, `edge`, `firefox` and `safari`.
87 | * @param {string} browserListQuery - Browser generation query based on the real world data.
88 | * For more info see the [query docs](https://github.com/browserslist/browserslist#full-list).
89 | * If `browserListQuery` is passed the `browsers` array is ignored.
90 | * @param {Array} operatingSystems - List of operating systems to generate the headers for.
91 | * The options are `windows`, `macos`, `linux`, `android` and `ios`.
92 | * @param {Array} devices - List of devices to generate the headers for. Options are `desktop` and `mobile`.
93 | * @param {Array} locales - List of at most 10 languages to include in the
94 | * [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) request header
95 | * in the language format accepted by that header, for example `en`, `en-US` or `de`.
96 | * @param {string} httpVersion - Http version to be used to generate headers (the headers differ depending on the version).
97 | * Can be either 1 or 2. Default value is 2.
98 | */
99 |
100 | /**
101 | * Fingerprint generator - randomly generates realistic browser fingerprints
102 | */
103 | export class FingerprintGenerator extends HeaderGenerator {
104 | fingerprintGeneratorNetwork: BayesianNetwork;
105 |
106 | /**
107 | * @param {HeaderGeneratorOptions} options - default header generation options used unless overridden
108 | */
109 | constructor(options: Partial = {}) {
110 | super(options);
111 | this.fingerprintGeneratorNetwork = new BayesianNetwork(fingerprintNetworkDefinition);
112 | }
113 |
114 | /**
115 | * Generates a fingerprint and a matching set of ordered headers using a combination of the default options specified in the constructor
116 | * and their possible overrides provided here.
117 | * @param {HeaderGeneratorOptions} options - specifies options that should be overridden for this one call
118 | * @param {Object} requestDependentHeaders - specifies known values of headers dependent on the particular request
119 | */
120 | getFingerprint(
121 | options: Partial = {},
122 | requestDependentHeaders: Record = {},
123 | ): BrowserFingerprintWithHeaders {
124 | // Generate headers consistent with the inputs to get input-compatible user-agent and accept-language headers needed later
125 | const headers = super.getHeaders(options, requestDependentHeaders);
126 | const userAgent = 'User-Agent' in headers ? headers['User-Agent'] : headers['user-agent'];
127 |
128 | // Generate fingerprint consistent with the generated user agent
129 | const fingerprint: Record = this.fingerprintGeneratorNetwork.generateSample({
130 | userAgent,
131 | });
132 |
133 | /* Delete any missing attributes and unpack any object/array-like attributes
134 | * that have been packed together to make the underlying network simpler
135 | */
136 | for (const attribute of Object.keys(fingerprint)) {
137 | if (fingerprint[attribute] === MISSING_VALUE_DATASET_TOKEN) {
138 | fingerprint[attribute] = null;
139 | } else if (fingerprint[attribute].startsWith(STRINGIFIED_PREFIX)) {
140 | fingerprint[attribute] = JSON.parse(fingerprint[attribute].slice(STRINGIFIED_PREFIX.length));
141 | }
142 | }
143 |
144 | // Manually add the set of accepted languages required by the input
145 | const acceptLanguageHeaderValue = 'Accept-Language' in headers ? headers['Accept-Language'] : headers['accept-language'];
146 | const acceptedLanguages = [];
147 | for (const locale of acceptLanguageHeaderValue.split(',')) {
148 | acceptedLanguages.push(locale.split(';')[0]);
149 | }
150 | fingerprint.languages = acceptedLanguages;
151 |
152 | return {
153 | fingerprint: this._transformFingerprint(fingerprint),
154 | headers,
155 | };
156 | }
157 |
158 | /**
159 | * Transforms fingerprint to the final scheme, more suitable for fingerprint manipulation and injection.
160 | * This schema is used in the fingerprint-injector.
161 | * @private
162 | * @param {Object} fingerprint
163 | * @returns {Object} final fingerprint.
164 | */
165 | _transformFingerprint(fingerprint: Record): Fingerprint {
166 | const {
167 | userAgent,
168 | userAgentData,
169 | doNotTrack,
170 | appCodeName,
171 | appName,
172 | appVersion,
173 | oscpu,
174 | webdriver,
175 | languages,
176 | platform,
177 | deviceMemory,
178 | hardwareConcurrency,
179 | product,
180 | productSub,
181 | vendor,
182 | vendorSub,
183 | maxTouchPoints,
184 | extraProperties,
185 | screen,
186 | pluginsData,
187 | audioCodecs,
188 | videoCodecs,
189 | battery,
190 | videoCard,
191 | multimediaDevices,
192 | fonts,
193 | } = fingerprint;
194 | const parsedMemory = parseInt(deviceMemory, 10);
195 | const parsedTouchPoints = parseInt(maxTouchPoints, 10);
196 |
197 | const navigator = {
198 | userAgent,
199 | userAgentData,
200 | language: languages[0],
201 | languages,
202 | platform,
203 | deviceMemory: Number.isNaN(parsedMemory) ? null : parsedMemory, // Firefox does not have deviceMemory available
204 | hardwareConcurrency: parseInt(hardwareConcurrency, 10),
205 | maxTouchPoints: Number.isNaN(parsedTouchPoints) ? 0 : parsedTouchPoints,
206 | product,
207 | productSub,
208 | vendor,
209 | vendorSub,
210 | doNotTrack,
211 | appCodeName,
212 | appName,
213 | appVersion,
214 | oscpu,
215 | extraProperties,
216 | webdriver,
217 | };
218 |
219 | return {
220 | screen,
221 | navigator,
222 | audioCodecs,
223 | videoCodecs,
224 | pluginsData,
225 | battery,
226 | videoCard,
227 | multimediaDevices,
228 | fonts,
229 | } as Fingerprint;
230 | }
231 | }
232 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './fingerprint-generator';
2 | export { PRESETS, HeaderGeneratorOptions, Headers } from 'header-generator';
3 |
--------------------------------------------------------------------------------
/test/generation.test.ts:
--------------------------------------------------------------------------------
1 | import { HeaderGeneratorOptions } from 'header-generator';
2 | import { FingerprintGenerator, PRESETS } from '../src/index';
3 |
4 | describe('Generation tests', () => {
5 | const fingerprintGenerator = new FingerprintGenerator();
6 | test('Basic functionality', () => {
7 | const { fingerprint } = fingerprintGenerator.getFingerprint({
8 | locales: ['en', 'es', 'en-US'],
9 | browsers: ['chrome'],
10 | devices: ['desktop'],
11 | });
12 | expect(fingerprint.navigator.userAgent.includes('Chrome')).toBe(true);
13 | });
14 |
15 | test('Works with presets', () => {
16 | const presets = Object.values(PRESETS);
17 | for (const preset of presets) {
18 | const { fingerprint } = fingerprintGenerator.getFingerprint({ ...preset } as Partial);
19 | expect(fingerprint).toBeDefined();
20 | }
21 | });
22 | test('Generates fingerprints without errors', () => {
23 | for (let x = 0; x < 10000; x++) {
24 | const { fingerprint } = fingerprintGenerator.getFingerprint({
25 | locales: ['en', 'es', 'en-US'],
26 | });
27 |
28 | expect(typeof fingerprint).toBe('object');
29 | }
30 | });
31 |
32 | test('Generates fingerprints with correct languages', () => {
33 | const { fingerprint } = fingerprintGenerator.getFingerprint({
34 | locales: ['en', 'de', 'en-GB'],
35 | });
36 |
37 | const fingerprintLanguages = fingerprint.navigator.languages;
38 | expect(fingerprintLanguages.length).toBe(3);
39 | expect(fingerprintLanguages.includes('en')).toBeTruthy();
40 | expect(fingerprintLanguages.includes('de')).toBeTruthy();
41 | expect(fingerprintLanguages.includes('en-GB')).toBeTruthy();
42 | });
43 |
44 | test('Generated fingerprint and headers match', () => {
45 | const { fingerprint, headers } = fingerprintGenerator.getFingerprint({
46 | locales: ['en', 'de', 'en-GB'],
47 | });
48 |
49 | const headersUserAgent = 'User-Agent' in headers ? headers['User-Agent'] : headers['user-agent'];
50 | expect(headersUserAgent === fingerprint.navigator.userAgent).toBeTruthy();
51 | });
52 |
53 | test('Transforms schema', () => {
54 | const { fingerprint } = fingerprintGenerator.getFingerprint();
55 |
56 | expect(fingerprint.screen.width).toBeDefined();
57 | expect(fingerprint.screen.height).toBeDefined();
58 | expect(fingerprint.screen.availHeight).toBeDefined();
59 | expect(fingerprint.screen.availWidth).toBeDefined();
60 | expect(fingerprint.screen.pixelDepth).toBeDefined();
61 |
62 | expect(fingerprint.navigator.language).toBeDefined();
63 | expect(fingerprint.navigator.languages).toBeDefined();
64 | expect(fingerprint.navigator.hardwareConcurrency).toBeDefined();
65 | });
66 | });
67 |
--------------------------------------------------------------------------------
/test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "rootDirs": [
5 | ".",
6 | "../src"
7 | ],
8 | "noEmit": true
9 | },
10 | "include": [
11 | ".",
12 | "../src/**/*"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/tsconfig.eslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": [
4 | "src",
5 | "test",
6 | "jest.config.ts"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@apify/tsconfig",
3 | "compilerOptions": {
4 | "outDir": "dist",
5 | "skipLibCheck": true,
6 | "resolveJsonModule": true,
7 | "esModuleInterop": true,
8 | },
9 | "include": [
10 | "./src"
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------