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 🙏

© 2026 – Pkg Stats / Ryan Hefner

dprintjs

v2.0.0

Published

Generate unique device fingerprints using browser characteristics

Readme

dPrintJs

A lightweight, framework-agnostic browser fingerprinting library that generates unique device identifiers. It uses multiple browser characteristics to create either short (8 characters) or long (64 characters) fingerprints that remain consistent for the same device.

Features

  • 🔒 Privacy-focused device fingerprinting
  • 🎯 Consistent device identification
  • 🔄 Short (8 chars) and long (64 chars) fingerprint formats
  • 🛠 Framework agnostic (works with React, Vue, Angular, or vanilla JS)
  • ⚡ Lightweight with zero dependencies
  • 🎨 Configurable components (Canvas, Audio, WebGL)
  • 🔐 Optional salt for additional uniqueness
  • 💪 TypeScript support

Installation

npm install dprintjs
# or
yarn add dprintjs
# or
pnpm add dprintjs

Quick Start

import { dPrintId } from 'dprintjs';

// Get instance
const fingerprint = dPrintId.getInstance();

// Generate short fingerprint (8 characters)
const shortId = await fingerprint.generateFingerprint();
// Example output: "k7lm9n2p"

// Generate long fingerprint (64 characters)
const longId = await fingerprint.generateFingerprint({ format: 'long' });
// Example output: "8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92"

Framework Examples

React

import { useEffect, useState } from 'react';
import { dPrintId } from 'dprintjs';

function App() {
  const [deviceId, setDeviceId] = useState('');

  useEffect(() => {
    const getFingerprint = async () => {
      const fingerprint = dPrintId.getInstance();
      const id = await fingerprint.generateFingerprint();
      setDeviceId(id);
    };
    getFingerprint();
  }, []);

  return <div>Device ID: {deviceId}</div>;
}

Vue

<script setup>
import { ref, onMounted } from 'vue';
import { dPrintId } from 'dprintjs';

const deviceId = ref('');

onMounted(async () => {
  const fingerprint = dPrintId.getInstance();
  deviceId.value = await fingerprint.generateFingerprint();
});
</script>

<template>
  <div>Device ID: {{ deviceId }}</div>
</template>

Angular

import { Component, OnInit } from '@angular/core';
import { dPrintId } from 'dprintjs';

@Component({
  selector: 'app-root',
  template: '<div>Device ID: {{deviceId}}</div>'
})
export class AppComponent implements OnInit {
  deviceId = '';

  async ngOnInit() {
    const fingerprint = dPrintId.getInstance();
    this.deviceId = await fingerprint.generateFingerprint();
  }
}

Vanilla JavaScript

<script type="module">
  import { dPrintId } from 'dprintjs';

  async function init() {
    const fingerprint = dPrintId.getInstance();
    const deviceId = await fingerprint.generateFingerprint();
    document.getElementById('device-id').textContent = deviceId;
  }

  init();
</script>

<div id="device-id"></div>

API Reference

FingerprintOptions

interface FingerprintOptions {
  format?: 'short' | 'long';     // Output format (default: 'short')
  includeCanvas?: boolean;       // Use canvas fingerprinting (default: true)
  includeAudio?: boolean;        // Use audio fingerprinting (default: true)
  includeWebGL?: boolean;        // Use WebGL fingerprinting (default: true)
  salt?: string;                 // Additional salt for uniqueness
}

Methods

dPrintId.getInstance()

Returns the singleton instance of the dPrintId.

generateFingerprint(options?: FingerprintOptions): Promise<string>

Generates a device fingerprint based on the provided options.

Examples

Basic Usage

const fingerprint = dPrintId.getInstance();
const deviceId = await fingerprint.generateFingerprint();

Long Format with Custom Salt

const fingerprint = dPrintId.getInstance();
const deviceId = await fingerprint.generateFingerprint({
  format: 'long',
  salt: 'my-custom-salt'
});

Minimal Components

const fingerprint = dPrintId.getInstance();
const deviceId = await fingerprint.generateFingerprint({
  includeCanvas: false,
  includeAudio: false,
  includeWebGL: true
});

API Integration Example

import axios from 'axios';
import { dPrintId } from 'dprintjs';

const api = axios.create();

// Add fingerprint to all API requests
api.interceptors.request.use(async (config) => {
  const fingerprint = dPrintId.getInstance();
  const deviceId = await fingerprint.generateFingerprint();
  
  config.headers['Device-ID'] = deviceId;
  return config;
});

Features in Detail

Short Format (8 characters)

  • Fast generation
  • URL-friendly
  • Suitable for quick device checks
  • Example: "k7lm9n2p"

Long Format (64 characters)

  • SHA-256 based
  • Highly unique
  • Suitable for security-critical applications
  • Example: "8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92"

Components Used

  • User Agent
  • Screen properties
  • Timezone
  • Language preferences
  • Hardware concurrency
  • Device memory
  • Platform information
  • Canvas rendering
  • Audio fingerprinting
  • WebGL capabilities
  • Touch support
  • Browser plugins
  • Plus additional entropy sources

Browser Support

  • Chrome (Latest)
  • Firefox (Latest)
  • Safari (Latest)
  • Edge (Latest)
  • Opera (Latest)
  • Mobile browsers (iOS/Android)

License

MIT License - see LICENSE file for details

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support

For support, issues, or feature requests, please file an issue in the GitHub repository.