automation-stack / node-machine-id

Unique machine (desktop) id (no admin privileges required)
MIT License
577 stars 59 forks source link
electron id machine-id node

Cross-platform unique machine (desktop) id discovery

Use cases

Features

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

Installation

npm install node-machine-id

Usage

Function: machineId(original)

Function: machineIdSync(original);

import {machineId, machineIdSync} from 'node-machine-id';

// Asyncronous call with async/await or Promise

async function getMachineId() {
    let id = await machineId();
    ...
}

machineId().then((id) => {
    ...
})

// Syncronous call

let id = machineIdSync()
// id = c24b0fe51856497eebb6a2bfcd120247aac0d6334d670bb92e09a00ce8169365
let id = machineIdSync(true)
// id = 98912984-c4e9-5ceb-8000-03882a0485e4

Caveats