npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fingerprint-browser

v1.0.5

Published

Computes a browser fingerprint

Downloads

120

Readme

Fingerprint Browser

This is a 0 dependency package that exports a single, fast and synchronous function which computes a browser fingerprint, without requiring any permission to the user, designed to be used in NextJs.

What is a Device Fingerprint?

Many techniques are used when generating a highly accurate browser fingerprint, which gathers information about the user to distinguish them from millions of others online.

Also known as online fingerprinting, browser fingerprinting is a tracking and identification method websites use to associate individual browsing sessions with one site visitor. Using Javascript, a plethora of data can be collected about a user’s web browser and device. When you stitch these pieces of information together, they reveal a unique combination of information that forms every user’s own ‘digital fingerprint.’’ The browser fingerprint is traceable across browsing sessions, even when the user enters incognito browsing or uses a VPN to access a site.

Browser fingerprinting is one way to stop fraudsters from attempting to hack or spam website owners by accurately identifying site users. Browser fingerprinting is more difficult to circumvent than cookies, as a user’s fingerprint does not change between incognito browsing sessions or clearing browser data. A browser fingerprinting script must use various data (called signals) gathering techniques, which vary between visitors, to generate an accurate enough (called entropy) fingerprint for each distinct web visitor. For example, while many visitors to a website may have the same model of iPhone, the software and drivers installed, geolocation, browser and OS version, and even minute variances in the hardware could be different.Each browser fingerprinting technique can gather one or more of these signals that aim to identify these minor variances between users.

What information is gathered?

Browser fingerprinting can gather a lot of information from a browser: the user’s device model, its operating system, its browser version, user timezone, preferred language settings, ad blocker used, screen resolution, and all the granular tech specs of his CPU, graphics card, and so on.

The data this package uses is:

interface BrowserData {
  osString: string;
  languages: readonly string[];
  userAgent: string;
  cookieEnabled: boolean;
  doNotTrack: string | null;
  hardwareConcurrency: number;
  language: string;
  maxTouchPoints: number;
  pdfViewerEnabled: boolean;
  webdriver: boolean;
  width: number;
  height: number;
  colorDepth: number;
  pixelDepth: number;
  timezoneOffset: number;
  timezone: string;
  touchSupport: boolean;
  devicePixelRatio: number;
  orientation: string;
  indexedDB: boolean;
  hasLocalStorageBoolean: boolean;
  hasSessionStorageBoolean: boolean;
  isCanvasSupportedBoolean: boolean;
  isIEBoolean: boolean;
  canvasFingerprint: string;
  connectionString: string | undefined;
  cookieBoolean: boolean | undefined;
  fontSmoothingEnabled: boolean | undefined;
  fontsString: string;
}

How to use

To avoid the hydration errors we ge when using checks like typeof window !== 'undefined' in the logic, to use the functions, use the following approach:

import { getBrowserFingerprint } from "fingerprint-browser";

and then:

  const [browserFingerprint, setBrowserFingerprint] = useState("");
  useEffect(() => {
    setBrowserFingerprint(fingerprintBrowser());
  }, []);

hooks aren’t run when doing server-side rendering. Wrapping the usage of window inside a useEffect that is triggered on mount means the server will never execute it and the client will execute it after hydration.

Special Thanks

Special thanks to:

  • Valentin Vasilyev for the original fingerprintjs slightly modified
  • @damianobarbati for get-browser-fingerprint which provided some inspiration
  • @N8Brooks for the implementation of unsigned 32-bit MurmurHash3
  • Open Source Device Fingerprinting by Dark Wave Tech for the various identity functions
  • davealger on CodePen

Contributing

Feel free to contribute.