FP-Devicer - v1.6.1
    Preparing search index...

    Class DeviceManager

    High-level device identification service.

    DeviceManager orchestrates the full fingerprint matching pipeline:

    1. Pre-filter – calls adapter.findCandidates() to retrieve a small set of candidate devices whose stored fingerprints are broadly similar to the incoming data.
    2. Full scoring – re-scores each candidate against its most-recent stored snapshot using calculateConfidence.
    3. Decision – if the best candidate exceeds matchThreshold, its device ID is reused; otherwise a new UUID-based device ID is minted.
    4. Persistence – saves the incoming snapshot via adapter.save().
    5. Observability – emits structured log lines and records metrics through the injected Logger and Metrics instances.
    const manager = new DeviceManager(adapter, { matchThreshold: 50 });
    const result = await manager.identify(fingerprintData, { userId: 'u_123' });
    console.log(result.deviceId, result.confidence);
    Index

    Constructors

    • Parameters

      • adapter: StorageAdapter

        Storage backend used for all persistence operations.

      • context: {
            candidateMinScore?: number;
            dedupWindowMs?: number;
            matchThreshold?: number;
            stabilityWindowSize?: number;
        } & ObservabilityOptions = {}

        Optional tuning parameters and observability overrides.

        • OptionalcandidateMinScore?: number

          Minimum score (0–100) passed to the adapter's pre-filter step. Defaults to 30.

        • OptionaldedupWindowMs?: number

          Dedup window in ms; repeated identifies within this window skip DB writes. Default 5000. Set 0 to disable.

        • OptionalmatchThreshold?: number

          Minimum confidence score (0–100) required to consider two fingerprints the same device. Defaults to 50.

        • OptionalstabilityWindowSize?: number

          Number of historical snapshots used for adaptive weight computation. Default 5.

        Optional observability overrides passed to DeviceManager. When omitted, defaultLogger and defaultMetrics are used.

      Returns DeviceManager

    Methods

    • Clear the deduplication cache immediately. Useful in tests or after a forced re-identification.

      Returns void

    • Return the metrics summary from the current metrics sink, if supported.

      Returns Record<string, any> | null

      The object returned by metrics.getSummary(), or null if the current metrics implementation does not expose a summary.

    • Identify a device from an incoming fingerprint dataset.

      Runs the full pre-filter → score → decide → save pipeline and emits observability signals before returning.

      • Dedup cache – if the same fingerprint hash is seen within dedupWindowMs, the cached result is returned without a DB write.
      • Adaptive weights – when a candidate has ≥ 2 historical snapshots, per-field stability is measured and low-stability fields are down-weighted before the full confidence score is computed.

      Parameters

      • incoming: FPUserDataSet

        The fingerprint data collected from the current request.

      • Optionalcontext: IdentifyContext

        Optional per-request context.

      Returns Promise<IdentifyResult>

      An object describing the resolved device.