Storage backend used for all persistence operations.
Optional tuning parameters and observability overrides.
OptionalcandidateMinScore?: numberMinimum score (0–100) passed to the
adapter's pre-filter step. Defaults to 30.
OptionaldedupWindowMs?: numberDedup window in ms; repeated identifies within this window skip DB writes. Default 5000. Set 0 to disable.
OptionalmatchThreshold?: numberMinimum confidence score (0–100) required
to consider two fingerprints the same device. Defaults to 50.
OptionalstabilityWindowSize?: numberNumber of historical snapshots used for adaptive weight computation. Default 5.
Optional observability overrides passed to DeviceManager. When omitted, defaultLogger and defaultMetrics are used.
Analyse how anomalous an incoming fingerprint is relative to a known device's historical baseline.
For each tracked fingerprint field, a z-score analog is computed as
deviation / (1 – historicalStability + ε). Fields that have been
historically stable yet are now different receive a high z-score and are
listed in DriftReport.suspiciousFields. The aggregate driftScore is a
weighted average of all per-field z-scores, normalised to [0, 100].
A DriftReport is classified into one of four patterns:
NORMAL_AGING – score < 30; expected gradual changeINCREMENTAL_DRIFT – score 30–54; broad multi-field changeABRUPT_CHANGE – score 55–74; concentrated in few fieldsCANONICAL_INJECTION – score ≥ 75 + high attractor risk; evasion signalThe stable device identifier to measure against.
The new fingerprint to evaluate.
Optionaloptions: DriftAnalysisOptionsOptional overrides for window size and z-score threshold.
A DriftReport, or null if no history exists for the device.
Build (or rebuild) the in-memory LSH candidate index from all snapshots currently held by the storage adapter.
When the index is present, every identify call merges LSH-derived
candidates with those returned by the adapter's own pre-filter, giving a
higher recall for devices whose similarity is concentrated in set-valued
fields (fonts, plugins, mimeTypes, languages) that the adapter
pre-filter may not consider.
The method subscribes to O(n) storage reads; avoid calling it on very
large datasets without pagination/sampling. The index is not kept in
sync automatically — call buildLshIndex again after significant dataset
growth, or after bulk imports.
Optionaloptions: LshOptionsOptional LSH tuning parameters.
Clear the deduplication cache immediately. Useful in tests or after a forced re-identification.
Return the list of devices that are related to deviceId via the
in-process identity graph, sorted by descending edge weight.
Edges are built from two signal types observed during identify() calls:
/24 subnet.The device to look up.
An array of RelatedDevice, or an empty array if no edges are known for this device.
Return the internal IdentityGraph instance.
Useful for inspecting raw edges, serialising graph state, or pruning stale edges via IdentityGraph.prune.
Return the number of devices currently indexed in the LSH index, or
undefined if buildLshIndex has not yet been called.
Return the metrics summary from the current metrics sink, if supported.
The object returned by metrics.getSummary(), or null if the
current metrics implementation does not expose a summary.
Returns the list of currently registered plugins (those not yet unregistered).
Identify a device from an incoming fingerprint dataset.
Runs the full pre-filter → score → decide → save pipeline and emits observability signals before returning.
dedupWindowMs, the cached result is returned without a DB write.The fingerprint data collected from the current request.
Optionalcontext: IdentifyContextOptional per-request context.
An object describing the resolved device.
Identify multiple devices in a batch.
An array of fingerprint data sets to identify.
Optionalcontext: IdentifyContextOptional context including userId and IP address.
A promise that resolves to an array of identification results.
Register a named post-processor that runs after the core identify decision.
Processors are executed in registration order. The returned teardown function
unregisters only this exact (name, processor) pair.
Stable plugin name used for enrichment and log metadata.
Callback that can enrich the identify result.
A function that unregisters the processor.
Register a plugin with this DeviceManager.
The plugin's DeviceManagerPlugin.registerWith method is called
immediately with this instance. Returns an unregister function that removes
the plugin and calls any teardown returned by registerWith.
Any object implementing DeviceManagerPlugin.
A () => void that unregisters the plugin.
High-level device identification service.
DeviceManagerorchestrates the full fingerprint matching pipeline:adapter.findCandidates()to retrieve a small set of candidate devices whose stored fingerprints are broadly similar to the incoming data.matchThreshold, its device ID is reused; otherwise a new UUID-based device ID is minted.adapter.save().Example