Unique machine (desktop) id (no admin privileges required)
Installations
npm install node-machine-id
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
10.15.3
NPM Version
6.9.0
Score
98
Supply Chain
94
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
automation-stack
Download Statistics
Total Downloads
234,150,510
Last Day
607,969
Last Week
2,661,944
Last Month
11,688,222
Last Year
137,659,634
GitHub Statistics
594 Stars
63 Commits
62 Forks
7 Watching
2 Branches
9 Contributors
Bundle Size
18.16 kB
Minified
6.79 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.12
Package Id
node-machine-id@1.1.12
Size
12.76 kB
NPM Version
6.9.0
Node Version
10.15.3
Publised On
29 May 2019
Total Downloads
Cumulative downloads
Total Downloads
234,150,510
Last day
-6.8%
607,969
Compared to previous day
Last week
-15.6%
2,661,944
Compared to previous week
Last month
6.8%
11,688,222
Compared to previous month
Last year
164.6%
137,659,634
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
35
Cross-platform unique machine (desktop) id discovery
Use cases
- Software restrictions
- Installation tracking
Features
- Hardware independent
- Unique within the OS installation
- No elevated rights required
- No external dependencies and does not require any native bindings
- Cross-platform (OSx, Win, Linux)
How it works
Module based on OS native UUID/GUID which used for internal needs.
All others approaches requires elevated rights or much depends on hardware components, but this approach summarize the methods of selecting the most reliable unique identifier
- Win32/64 uses key
MachineGuid
in registryHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography
(can be changed by administrator but with unpredictable consequences)
It is generated during OS installation and won't change unless you make another OS updates or reinstall. Depending on the OS version it may contain the network adapter MAC address embedded (plus some other numbers, including random), or a pseudorandom number.
- OSx uses
IOPlatformUUID
(the same Hardware UUID)ioreg -rd1 -c IOPlatformExpertDevice
Value from I/O Kit registry in IOPlatformExpertDevice class
- Linux uses
/var/lib/dbus/machine-id
(can be changed byroot
but with unpredictable consequences) http://man7.org/linux/man-pages/man5/machine-id.5.html
The /var/lib/dbus/machine-id file contains the unique machine ID of the local system that is set during installation. The machine ID is a single newline-terminated, hexadecimal, 32-character, lowercase machine ID string. When decoded from hexadecimal, this corresponds with a 16-byte/128-bit string.
The machine ID is usually generated from a random source during system installation and stays constant for all subsequent boots. Optionally, for stateless systems, it is generated during runtime at early boot if it is found to be empty.
The machine ID does not change based on user configuration or when hardware is replaced.
Installation
npm install node-machine-id
Usage
Function: machineId(original)
- original
<Boolean>
, Iftrue
return original value of machine id, otherwise return hashed value (sha-256), default:false
Function: machineIdSync(original);
- syncronous version of
machineId
1import {machineId, machineIdSync} from 'node-machine-id'; 2 3// Asyncronous call with async/await or Promise 4 5async function getMachineId() { 6 let id = await machineId(); 7 ... 8} 9 10machineId().then((id) => { 11 ... 12}) 13 14// Syncronous call 15 16let id = machineIdSync() 17// id = c24b0fe51856497eebb6a2bfcd120247aac0d6334d670bb92e09a00ce8169365 18let id = machineIdSync({original: true}) 19// id = 98912984-c4e9-5ceb-8000-03882a0485e4
Caveats
- Image-based environments have usually the same
machine-id
As a workaround you can generate new machine-ids for each instance (or container) with
dbus-uuidgen
and changed them in the respective > files:/etc/machine-id
and/var/lib/dbus/machine-id
. Thanks @stefanhuber
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 7/24 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 14 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to node-machine-id
node-unique-machine-id
**Get the unique machine id (cross-platform, without admin privileges)**
node-machine-id-xz
Unique machine (desktop) id (no admin privileges required).
node-machine-uid
Unique machine (desktop) id (no admin privileges required).doesn't use reg.exe on windows
@polypane/node-machine-uid
Unique machine (desktop) id (no admin privileges required).doesn't use reg.exe on windows