UNPKG

fingerprint-oss

Version:

A comprehensive JavaScript library for device fingerprinting and system information collection. Provides robust, deterministic fingerprinting for web applications with privacy-conscious design.

80 lines (79 loc) 2.75 kB
/*! * Configuration System for Fingerprint OSS * Copyright (c) 2025 Akshat Kotpalliwar (alias IntegerAlex on GitHub) * Licensed under LGPL-3.0 */ /** * Environment types supported by the configuration system */ export type Environment = 'TEST' | 'DEV' | 'STAGING' | 'PROD'; /** * Log levels for structured logging */ export type LogLevel = 'error' | 'warn' | 'info' | 'verbose' | 'debug'; /** * Configuration interface for environment-aware settings */ export interface FingerprintConfig { /** Current environment */ environment: Environment; /** Enable verbose logging for testing */ verbose: boolean; /** Enable transparency mode for GDPR compliance */ transparency: boolean; /** Custom message for data collection transparency */ message?: string; /** Log level for structured logging */ logLevel: LogLevel; /** Enable console output */ enableConsoleLogging: boolean; /** Enable performance metrics logging */ enablePerformanceLogging: boolean; } /** * Detects the current environment based on various indicators */ export declare function detectEnvironment(): Environment; /** * Initializes the configuration system with environment detection */ export declare function initializeConfig(customConfig?: Partial<FingerprintConfig>): FingerprintConfig; /** * Gets the current configuration, initializing if necessary */ export declare function getConfig(): FingerprintConfig; /** * Updates the current configuration */ export declare function updateConfig(updates: Partial<FingerprintConfig>): FingerprintConfig; /** * Checks if verbose logging is enabled for the current environment */ export declare function isVerboseEnabled(): boolean; /** * Checks if a log level should be output based on current configuration */ export declare function shouldLog(level: LogLevel): boolean; /** * Structured logger with environment-aware controls */ export declare class StructuredLogger { private static formatMessage; static error(operation: string, message: string, data?: any): void; static warn(operation: string, message: string, data?: any): void; static info(operation: string, message: string, data?: any): void; static verbose(operation: string, message: string, data?: any): void; static debug(operation: string, message: string, data?: any): void; /** * Logs a block operation with timing information */ static logBlock<T>(operation: string, description: string, block: () => T | Promise<T>): T | Promise<T>; } /** * Performance timing utility for development environments */ export declare class PerformanceTimer { private static timers; static start(label: string): void; static end(label: string): number; }