userdnajs
Version:
Community edition of UserDNA JS. A fingerprint generator library for creating unique user identifiers
62 lines (61 loc) • 1.97 kB
TypeScript
import { UserDNAOptions, FingerprintResult } from '../types';
/**
* Main class for generating and managing fingerprints
*/
export declare class FingerprintGenerator {
/**
* Options for the fingerprint generator
*/
private options;
/**
* Last generated fingerprint result
*/
private lastResult;
/**
* Creates a new instance of FingerprintGenerator
* @param options - Configuration options
*/
constructor(options?: UserDNAOptions);
/**
* Gets the fingerprint asynchronously
* @param options - Options for getting the fingerprint
* @returns Promise that resolves to the fingerprint result
*/
getFingerprint(options?: {}): Promise<FingerprintResult>;
/**
* Gets a visitor ID that is unique for the current browser
* @returns Promise that resolves to the visitor ID
*/
getVisitorId(): Promise<string>;
/**
* Checks if the current fingerprint is likely from the same visitor
* @param fingerprintId - Fingerprint ID to compare against
* @returns Promise that resolves to whether the fingerprints match
*/
isSameVisitor(fingerprintId: string): Promise<boolean>;
/**
* Collects all the components for the fingerprint
* @returns Promise that resolves to the fingerprint components
*/
private collectComponents;
/**
* Gets fingerprint result from storage
* @returns Fingerprint result or null if not found
*/
private getFromStorage;
/**
* Saves fingerprint result to storage
* @param result - Fingerprint result to save
*/
private saveToStorage;
/**
* Updates the options for the fingerprint generator
* @param options - New options to apply
*/
updateOptions(options: Partial<UserDNAOptions>): void;
/**
* Gets the current options for the fingerprint generator
* @returns Current options
*/
getOptions(): UserDNAOptions;
}