Skip to main content

Open-Source Python Middleware for Digital Fingerprinting

Project description

FP-Devicer

Developed by Gateway Corporate Solutions LLC

FP-Devicer is a digital fingerprinting middleware library designed for ease of use and near-universal compatibility with servers.

Usage

Importing and using the library to compare fingerprints between users is as simple as collecting user data and running a confidence calculation.

# 1. Simple method (using defaults)
from devicer import calculate_confidence

score = calculate_confidence(fp_data_1, fp_data_2)

# 2. Advanced method (custom weights & comparators)
from devicer import ComparisonOptions, create_confidence_calculator, register_plugin
from devicer.libs.comparators import levenshtein_similarity

register_plugin(
  "userAgent",
  weight=25,
  comparator=lambda a, b, _path=None: levenshtein_similarity(
    str(a or "").lower(),
    str(b or "").lower(),
  ),
)

advanced_calculator = create_confidence_calculator(
  ComparisonOptions(
    weights={
      "platform": 20,
      "fonts": 20,
      "screen": 15,
    },
  )
)

advanced_score = advanced_calculator.calculate_confidence(fp_data_1, fp_data_2)

For storage-backed identification flows:

import asyncio
from devicer import DeviceManager, create_in_memory_adapter


async def main() -> None:
  adapter = create_in_memory_adapter()
  await adapter.init()
  manager = DeviceManager(adapter)

  result = await manager.identify(
    {
      "userAgent": "Mozilla/5.0",
      "platform": "Linux x86_64",
      "languages": ["en-US", "en"],
    },
    user_id="user-1",
    ip="127.0.0.1",
  )
  print(result)  # -> IdentifyResult(device_id=..., confidence=..., is_new_device=...)


asyncio.run(main())

The resulting confidence ranges between 0 and 100, where 100 is the strongest match.

Quickstart

Install and run the Python package:

pip install devicer.py
python -c "from devicer import calculate_confidence; print(calculate_confidence({'platform':'Win32'},{'platform':'Win32'}))"

For local development:

pip install -e .[dev]
pytest -q

Adapters

Built-in adapters:

  • create_in_memory_adapter()
  • create_sqlite_adapter(path)
  • create_postgres_adapter(dsn) (requires optional postgres extras)
  • create_redis_adapter(url) (requires optional redis extras)

Install optional adapter dependencies:

pip install -e .[postgres]
pip install -e .[redis]

Benchmarks

You can run benchmark parity scripts for performance and accuracy:

python -m devicer.benchmarks.performance_bench
python -m devicer.benchmarks.accuracy_bench

Outputs are written to:

  • src/devicer/benchmarks/performance.bench.out
  • src/devicer/benchmarks/accuracy.bench.out

Documentation

The TypeScript SDK documentation is available at gatewaycorporate.github.io/fp-devicer. The Python package mirrors the same core architecture (core, libs, benchmarks, and types) with Pythonic APIs.

Whitepaper

The whitepaper covers the theory, architecture, and design decisions behind FP-Devicer. You can read it here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devicer_py-1.5.0.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devicer_py-1.5.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file devicer_py-1.5.0.tar.gz.

File metadata

  • Download URL: devicer_py-1.5.0.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for devicer_py-1.5.0.tar.gz
Algorithm Hash digest
SHA256 14327a183deebe1cd817d501ae58c533504a974cb5f458f19b22c66430ee387e
MD5 c7fdae64d552c1375adefb97fdd67d5d
BLAKE2b-256 3416d5c447d70813f196062bf1f30e2ff39a7cd6e5ceeaea94dbfd73af8242f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for devicer_py-1.5.0.tar.gz:

Publisher: workflow.yml on gatewaycorporate/fp-devicer-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file devicer_py-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: devicer_py-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for devicer_py-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a381e9ea416048cce07d838dcbebb69bff7c18c02123ee6740e50b41c914dedd
MD5 66d478affbae2a7c9987047b31cbc607
BLAKE2b-256 e00e95ec3d515167b868b0241676c159b0570c4af73a6c84a4c858db04ffaa21

See more details on using hashes here.

Provenance

The following attestation bundles were made for devicer_py-1.5.0-py3-none-any.whl:

Publisher: workflow.yml on gatewaycorporate/fp-devicer-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page