
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@marufme/device-key
Advanced tools
A lightweight, modular TypeScript library for comprehensive device detection, fingerprinting, and information gathering in browsers. Features tree-shakeable modules for OS detection, browser analysis, network info, device fingerprinting, and more.
A lightweight, comprehensive device detection and fingerprinting library for modern web applications. Get detailed information about user devices, browsers, operating systems, and generate unique device fingerprints.
npm install @marufme/device-key
yarn add @marufme/device-key
pnpm add @marufme/device-key
import getDeviceInfo from "@marufme/device-key";
// Get comprehensive device information
const deviceInfo = await getDeviceInfo();
console.log(deviceInfo);
import {
getOSInfo,
getBrowserInfo,
getNetworkInfo,
getDeviceInfoBasic,
getDeviceId,
getBatteryInfo,
getUserAgent,
parseUserAgent,
getLocationInfo,
getTimezoneInfo,
getLanguageInfo,
getIPInfo,
generateFingerprint,
getCanvasFingerprint,
getWebGLFingerprint,
detectIncognitoMode,
} from "@marufme/device-key";
// Get specific information
const osInfo = getOSInfo();
const browserInfo = getBrowserInfo();
const networkInfo = getNetworkInfo();
const basicDevice = await getDeviceInfoBasic();
const { deviceId } = await getDeviceId();
const battery = await getBatteryInfo();
const ua = getUserAgent();
const uaParsed = parseUserAgent();
const location = await getLocationInfo();
const tz = getTimezoneInfo();
const lang = getLanguageInfo();
const ipInfo = await getIPInfo();
const fingerprint = await generateFingerprint();
const canvasFp = getCanvasFingerprint();
const webglFp = getWebGLFingerprint();
const isIncognito = await detectIncognitoMode();
getDeviceInfo(): Promise<Device>Returns comprehensive device information including OS, browser, device details, network info, user-agent, location, and incognito status.
const deviceInfo = await getDeviceInfo();
// Returns:
// {
// os: { name, version, platform, architecture },
// browser: { name, version, engine, vendor },
// device: {
// deviceId,
// deviceType,
// hardwareConcurrency,
// screen: { width, height, pixelRatio },
// battery: { level, charging, chargingTime }
// },
// network: { connectionType?, effectiveType?, downlink?, rtt?, cores? },
// location: {
// timezone: { timezone, offset, dst },
// language: { current, types, primary },
// coordinates?: GeolocationCoordinates,
// ipInfo?: {
// publicIP,
// realIP?,
// isVPN,
// isProxy,
// isTor,
// country?,
// city?,
// isp?,
// confidence
// }
// },
// userAgent: string,
// incognito: boolean
// }
getOSInfo(): OSInfoDetects operating system information.
const osInfo = getOSInfo();
// { name, version, platform, architecture }
// Example: { name: "Windows", version: "10", platform: "Win32", architecture: "64-bit" }
getBrowserInfo(): BrowserInfoDetects browser information.
const browserInfo = getBrowserInfo();
// { name, version, engine, vendor }
// Example: { name: "Chrome", version: "120.0.0.0", engine: "Blink", vendor: "Google Inc." }
detectIncognitoMode(): Promise<boolean>Heuristic detection using StorageManager quota (returns true if incognito/private mode likely).
const isIncognito = await detectIncognitoMode();
getDeviceInfoBasic(): Promise<DeviceBasicInfo>Gets basic device information including screen details and battery status.
const info = await getDeviceInfoBasic();
// {
// deviceId,
// deviceType: "Desktop" | "Mobile" | "Tablet",
// hardwareConcurrency,
// screen: { width, height, pixelRatio },
// battery: { level, charging, chargingTime }
// }
getDeviceId(): Promise<{ deviceId: string }>Generates or retrieves a stable device identifier. On first run in the browser, it generates a fingerprint and stores it in localStorage under a small key. On non-browser environments, returns "server-mode".
const { deviceId } = await getDeviceId();
getBatteryInfo(): Promise<BatteryInfo>Gets battery information (where supported).
const battery = await getBatteryInfo();
// { level: 0-100, charging: boolean, chargingTime: number | null }
getNetworkInfo(): NetworkInfoGets network connection information and CPU cores where available.
const net = getNetworkInfo();
// {
// connectionType?,
// effectiveType?,
// downlink?,
// rtt?,
// cores?
// }
getUserAgent(): { userAgent: string }Returns the current user agent string.
const { userAgent } = getUserAgent();
parseUserAgent(): UserAgentInfoLightweight UA parsing helpers.
const ua = parseUserAgent();
// { userAgent, isMobile, isTablet, isDesktop, isBot }
getLocationInfo(): Promise<LocationInfo>Aggregates timezone, language, and optional geolocation coordinates (if permitted) and IP information.
const loc = await getLocationInfo();
// {
// timezone: { timezone, offset, dst },
// language: { current, types, primary },
// coordinates?: GeolocationCoordinates,
// ipInfo?: IPInfo
// }
getTimezoneInfo(): TimezoneInfoGets timezone identifier, UTC offset (minutes east of UTC), and DST flag.
const tz = getTimezoneInfo();
// { timezone, offset, dst }
getLanguageInfo(): LanguageInfoGets language preferences.
const lang = getLanguageInfo();
// { current, types, primary }
getIPInfo(): Promise<IPInfo>Advanced IP detection with VPN/Proxy insights. Uses WebRTC leak checks, public IP services, and heuristic VPN/Proxy signals.
const ip = await getIPInfo();
// {
// publicIP: string,
// realIP?: string,
// isVPN: boolean,
// isProxy: boolean,
// isTor: boolean,
// country?: string,
// city?: string,
// isp?: string,
// confidence: number
// }
generateFingerprint(): Promise<string>Creates a unique device fingerprint using basic info + Canvas + WebGL, hashed with SHA-256.
const fp = await generateFingerprint();
getCanvasFingerprint(): stringGenerates a canvas-based fingerprint string (data URL).
const canvasFp = getCanvasFingerprint();
getWebGLFingerprint(): stringGenerates a WebGL-based fingerprint string (vendor::renderer).
const webglFp = getWebGLFingerprint();
Note: Low-level helpers like hashing and info collection are internal; only the functions listed above are part of the public API.
The library automatically detects and categorizes devices:
# Clone the repository
git clone https://github.com/maruf-me/device-key.git
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build the package
pnpm build
# Preview build
pnpm preview
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
See CHANGELOG.md for a list of changes and version history.
Made with ❤️ by MD Maruf Hossain
FAQs
A lightweight, modular TypeScript library for comprehensive device detection, fingerprinting, and information gathering in browsers. Features tree-shakeable modules for OS detection, browser analysis, network info, device fingerprinting, and more.
The npm package @marufme/device-key receives a total of 6 weekly downloads. As such, @marufme/device-key popularity was classified as not popular.
We found that @marufme/device-key demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.