fingerhash
v1.0.2
Published
A library to generate a fingerprint of the user's browser and device.
Readme
FingerHash
A powerful browser fingerprinting library that generates unique visitor identifiers by collecting various browser and device characteristics.
Features
- 🎯 Accurate browser fingerprinting
- 🔒 Privacy-focused
- 🚀 Lightweight and fast
- 📦 Zero dependencies
- 🛠 TypeScript support
- 🌐 Cross-browser compatibility
- 📦 Multiple module formats (ESM, CJS, UMD)
- 🌐 CDN support
Installation
Using npm
npm install fingerhash Using pnpm
pnpm add fingerhashUsing yarn
yarn add fingerhashUsing bun
bun add fingerhashUsing CDN (jsDelivr)
<!-- UMD version -->
<script src="https://cdn.jsdelivr.net/npm/fingerhash/dist/fingerhash.umd.js"></script>
<!-- ESM version -->
<script type="module">
import FingerHash from 'https://cdn.jsdelivr.net/npm/fingerhash/dist/fingerhash.es.js';
</script>Using script tag
<!-- UMD version -->
<script src="path/to/fingerhash.umd.js"></script>
<script>
const fingerhash = new FingerHash();
fingerhash.getFingerprint().then(console.log);
</script>
<!-- ESM version -->
<script type="module">
import FingerHash from 'path/to/fingerhash.es.js';
const fingerhash = new FingerHash();
fingerhash.getFingerprint().then(console.log);
</script>Module Formats
FingerHash is available in multiple module formats:
- ESM (
fingerhash.es.js): Modern JavaScript modules - CJS (
fingerhash.cjs.js): CommonJS modules - UMD (
fingerhash.umd.js): Universal Module Definition
Usage
Basic Usage
import FingerHash from 'fingerhash';
const fingerhash = new FingerHash();
// Get fingerprint
fingerhash.getFingerprint().then((result) => {
console.log(result);
// {
// visitorId: "unique-hash",
// components: {
// userAgent: "...",
// canvasFingerprint: "...",
// webglFingerprint: "...",
// // ... more components
// },
// confidence: 0.95
// }
});Available Components
The fingerprint includes the following components:
userAgent: Browser user agent stringuserAgentVersion: Browser versiontimezone: User's timezonelanguage: Browser languagedeviceMemory: Device memory (if available)hardwareConcurrency: Number of CPU corescanvasFingerprint: Canvas rendering fingerprintwebglFingerprint: WebGL rendering fingerprintwebglExtensions: Available WebGL extensionsaudioFingerprint: Audio context fingerprintinstalledFonts: List of installed fontstouchSupport: Touch capabilitiesplatform: Operating system platformcookiesEnabled: Cookie supportlocalStorage: Local storage availabilitysessionStorage: Session storage availabilitynavigatorLanguages: Browser languagesdoNotTrack: Do Not Track settingplugins: Browser pluginsmimeTypes: Supported MIME typesadBlockDetected: Ad blocker detectionmathPrecision: Math precision valuesgpuRenderer: GPU renderer information
Browser Support
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Opera (latest)
License
MIT © uqi-dev
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Security
This library is designed with privacy in mind. It only collects non-personally identifiable information that is commonly available to websites. The fingerprinting process is done entirely on the client side, and no data is sent to external servers.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
