Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding ui-fingerprint utility (#589)
### **PR Type** Enhancement, Tests, Documentation ___ ### **Description** - Implemented various fingerprinting techniques including audio, browser, canvas, fonts, hardware, locale, screen, and system. - Added unit tests for the `hash` function. - Configured build and test environments using Vite, tsup, and Vitest. - Updated dependencies and build scripts to include `@versini/ui-fingerprint`. - Added documentation and configuration files for the new package. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>15 files</summary><table> <tr> <td> <details> <summary><strong>main.tsx</strong><dd><code>Add main entry point for fingerprint utility</code> </dd></summary> <hr> packages/bundlesize/src/fingerprint/src/main.tsx <li>Imported <code>@versini/ui-fingerprint</code> and React libraries.<br> <li> Rendered a simple React component.<br> <li> Added a loop to ensure all components are bundled.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-ed494ebfed7fe18b73f874e8decc25b85f112a409cbd8932d32c23d9e93edec1">+16/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>fingerprint.ts</strong><dd><code>Implement fingerprint data collection and hashing</code> </dd></summary> <hr> packages/ui-fingerprint/src/common/fingerprint.ts <li>Implemented functions to gather and hash fingerprint data.<br> <li> Added error handling for data gathering and hashing.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-2b944da987f50f2d3e783b6e102884ae859f65bc674688b542b5e26576b15ea3">+68/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>hash.ts</strong><dd><code>Implement SHA-256 hash function</code> </dd></summary> <hr> packages/ui-fingerprint/src/common/hash.ts - Implemented `hash` function to generate SHA-256 hash. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-0aa86e15c05b907df039f58379633dbfca4676d27a15f776efa20ff0c1e9030d">+12/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>types.d.ts</strong><dd><code>Define types for fingerprint components</code> </dd></summary> <hr> packages/ui-fingerprint/src/common/types.d.ts - Defined types for various fingerprint components. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-30ea2ad7a246b04f769f89562bf8b47932a184e37d2cdf2e4a1e4171a580cdae">+63/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>utilities.ts</strong><dd><code>Add utility functions for hashing and DOM manipulation</code> </dd></summary> <hr> packages/ui-fingerprint/src/common/utilities.ts - Added utility functions for hashing and DOM manipulation. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-881cf3587a7325277db6870d182e6dba88f53b4364b29166b3778802c75fdb24">+115/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>audio.ts</strong><dd><code>Implement audio fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/audio.ts <li>Implemented audio fingerprinting.<br> <li> Added error handling for audio context creation.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-e1b2946cdbd3ff235dcc8126fd4eadde7b5ac5f42a8cd43ccd13bf7d70b33212">+53/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>browser.ts</strong><dd><code>Implement browser fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/browser.ts - Implemented browser fingerprinting. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-bcb61015a33d02e92cbed739dabefd757655a24abcf8b9b8806b1d450ea5b9b8">+9/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>canvas.ts</strong><dd><code>Implement canvas fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/canvas.ts <li>Implemented canvas fingerprinting.<br> <li> Added techniques to defeat canvas counter-fingerprinting.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-e4c67d9fc77cde065ec9ac0131bf83396251bff417924d7875146923e91e30c7">+123/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>fonts.ts</strong><dd><code>Implement font detection for fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/fonts.ts <li>Implemented font detection for fingerprinting.<br> <li> Added iframe-based font detection.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-13f70fac3638c4dc5491645c3af8f92cb6b47f6ad41c88bc72b8cb1435068333">+133/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>hardware.ts</strong><dd><code>Implement hardware fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/hardware.ts <li>Implemented hardware fingerprinting.<br> <li> Added functions to detect video card and architecture.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-1b1eb6d2074b49c52af3d132cdcf455748bc626a92ee0e8d011300d5bfce1417">+76/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Export fingerprint data and hash functions</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/index.ts - Exported fingerprint data and hash functions. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-ed0a88971651b02b4fb54b04ea7a480f1e2801b5105d60e5d601b6443654235a">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>locale.ts</strong><dd><code>Implement locale fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/locale.ts - Implemented locale fingerprinting. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-eb4d5e99e954b49b148925d879f2432c7f8f2c7694d017208b5c808503001f28">+17/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>screen.ts</strong><dd><code>Implement screen fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/screen.ts - Implemented screen fingerprinting. - Added media query detection. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-455cb14eded0cfbcf2ef3e1ac4db2bd2a13f6f20770711b91b6c068bbcacb95d">+69/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>system.ts</strong><dd><code>Implement system fingerprinting</code> </dd></summary> <hr> packages/ui-fingerprint/src/components/system.ts - Implemented system fingerprinting. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-cc9ee437d754149edddb45d314cd597f79cbc662e06b7152f65708b7120f3f80">+27/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>index.html</strong><dd><code>Add HTML entry point for fingerprint utility</code> </dd></summary> <hr> packages/bundlesize/src/fingerprint/index.html - Added HTML entry point for fingerprint utility. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-6a87f40b3556e3c180369beca00a05752815609693abc4fc023e9a3af73965fc">+19/-0</a> </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>13 files</summary><table> <tr> <td> <details> <summary><strong>vite-env.d.ts</strong><dd><code>Add Vite environment type reference</code> </dd></summary> <hr> packages/bundlesize/src/fingerprint/src/vite-env.d.ts - Added Vite environment type reference. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-fd1953bdce11e374e90db5ee17fbcb77f14ac7726e668b48e35fdc38647f8544">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>vite-env.d.ts</strong><dd><code>Add Vite environment type reference</code> </dd></summary> <hr> packages/ui-fingerprint/src/vite-env.d.ts - Added Vite environment type reference. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-44315ad9d5c2a16e17aef5c59052bcb47194bfc7eb4db5ed4619aeb0d563f29a">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>tsup.config.ts</strong><dd><code>Add tsup configuration</code> </dd></summary> <hr> packages/ui-fingerprint/tsup.config.ts - Added configuration for `tsup` bundler. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-0c6a8637783c0ec8b75082e2d0c17330059b4e8a2d6cdbafef94095732ca5e52">+12/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>vite.config.ts</strong><dd><code>Add Vite configuration for building package</code> </dd></summary> <hr> packages/ui-fingerprint/vite.config.ts <li>Added Vite configuration for building the package.<br> <li> Included custom banner and input handling.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-4e068be355d0f24465d4688bf6b09cad19b86bead5e4e36363c05a573792ffd7">+109/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>vitest.config.ts</strong><dd><code>Add Vitest configuration for testing</code> </dd></summary> <hr> packages/ui-fingerprint/vitest.config.ts <li>Added Vitest configuration for testing.<br> <li> Included coverage thresholds.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-d4bf42296bebc43030f20ce05801e327e9305ac2bc5aa0677e704cabbc4f9472">+28/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>vitest.setup.ts</strong><dd><code>Add Vitest setup file</code> </dd></summary> <hr> packages/ui-fingerprint/vitest.setup.ts <li>Added setup file for Vitest.<br> <li> Included custom error handling for console errors.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-2371955acdd94a4265d84b09e78f4898ba4cf02811a6d2121f233552ffdb95dd">+17/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>bundlesize.config.js</strong><dd><code>Add bundlesize configuration</code> </dd></summary> <hr> packages/ui-fingerprint/bundlesize.config.js - Added bundlesize configuration for fingerprint package. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-b462994d2549a253292661cbc6265fb8b637b523bbec739ac53d4f71c570e07c">+18/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Update build scripts and dependencies</code> </dd></summary> <hr> packages/bundlesize/package.json <li>Added build script for fingerprint package.<br> <li> Included <code>@versini/ui-fingerprint</code> as a dependency.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-bc3bf4ac9fbc2a1e3543f129ba289a90bced4c31800976b09b7ea5e11a2e7b2c">+3/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>nodemon.json</strong><dd><code>Update nodemon configuration</code> </dd></summary> <hr> packages/documentation/nodemon.json - Added `ui-fingerprint` to watched directories. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-9bee6180ad6fa46afb0d309ae64f5226fb042b3e092235bd5c0a57108ed7e3dd">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Update documentation dependencies</code> </dd></summary> <hr> packages/documentation/package.json - Added `@versini/ui-fingerprint` as a dependency. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-46fe383cb201f1f668d4185052185194a35e1b2651f24aea5ce7ffb0a19b4732">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Add package configuration for ui-fingerprint</code> </dd></summary> <hr> packages/ui-fingerprint/package.json - Added package configuration for `@versini/ui-fingerprint`. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-23c93f64223cebb184a754677e16943433242f8136dfda25b98d0fc8c6d76ac0">+38/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>tsconfig.json</strong><dd><code>Add TypeScript configuration</code> </dd></summary> <hr> packages/ui-fingerprint/tsconfig.json - Added TypeScript configuration for `ui-fingerprint`. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-9de2931fd5c994b2529c73be4ae9754a28af763df6f3fece060e3ed82aa7bab2">+26/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>tsconfig.node.json</strong><dd><code>Add TypeScript node configuration</code> </dd></summary> <hr> packages/ui-fingerprint/tsconfig.node.json - Added TypeScript node configuration for `ui-fingerprint`. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-093df991fef54cceb1e882364f5609dc8445bf3f1c8fdd08812e8712f99fe72d">+10/-0</a> </td> </tr> </table></details></td></tr><tr><td><strong>Tests</strong></td><td><details><summary>1 files</summary><table> <tr> <td> <details> <summary><strong>hash.test.ts</strong><dd><code>Add unit tests for hash function</code> </dd></summary> <hr> packages/ui-fingerprint/src/common/__tests__/hash.test.ts <li>Added tests for the <code>hash</code> function.<br> <li> Covered various edge cases and typical usage scenarios.<br> </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-602b044ad77d200ea041833e13fa45dc3a3c259193c149a70902d2cd3de55f1a">+52/-0</a> </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td> <details> <summary><strong>README.md</strong><dd><code>Add README for ui-fingerprint package</code> </dd></summary> <hr> packages/ui-fingerprint/README.md - Added README for `@versini/ui-fingerprint` package. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-011365ac1ffba13adce35ba1dc0c11ae62087f8e28fca634e6f2dbe5c40a4d83">+3/-0</a> </td> </tr> </table></details></td></tr><tr><td><strong>Dependencies</strong></td><td><details><summary>1 files</summary><table> <tr> <td> <details> <summary><strong>pnpm-lock.yaml</strong><dd><code>Update pnpm lockfile</code> </dd></summary> <hr> pnpm-lock.yaml - Updated lockfile to include `@versini/ui-fingerprint`. </details> </td> <td><a href="https://github.com/aversini/ui-components/pull/589/files#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bb">+8/-0</a> </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
- Loading branch information