How to use node-machine-id - 10 common examples

To help you get started, we’ve selected a few node-machine-id examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SelfKeyFoundation / Identity-Wallet / src / main / preload.js View on Github external
/* istanbul ignore file */
/* eslint-env node */ /* global window */
// eslint-disable-next-line
const nodeMachineId = require('node-machine-id');
const common = require('../common/utils/common');
const appPackage = require(`${__dirname}'/../../package.json`);
const config = require('../common/config');
const defaultWindowOpen = window.open;
const electron = require('electron');
const PDFWindow = require('electron-pdf-window');

window.electron = electron;
window.appName = appPackage.productName;
window.appVersion = appPackage.version;
window.isTestMode = common.isTestMode();
window.machineId = nodeMachineId.machineIdSync();

window.open = function(url, ...args) {
	for (let i in config.common.allowedUrls) {
		if (url.startsWith(config.common.allowedUrls[i])) {
			return defaultWindowOpen(url, ...args);
		}
	}
	return null;
};

// quit app
window.quit = event => {
	electron.remote.app.quit();
};

window.openDirectorySelectDialog = event => {
github codex-team / codex.notes / src / codex-notes.js View on Github external
});

  hawkCatcher.initGlobalCatcher();
  global.catchException = hawkCatcher.catchException;
}

/**
 * Enable logger
 * @example global.logger.info('Hey yo');
 */
global.logger = require('./utils/logger');
global.utils = require('./utils/utils');

/** Get deviceId */
const machineIdSync = require('node-machine-id').machineIdSync;
global.deviceId = machineIdSync({original: true});



/**
 * Enable Pug
 */
const locals = process.env;
const pug = require('electron-pug')({
  cache: false,
  // debug: true,
  // compileDebug: true
}, locals);

/**
 * Enable autoupdates
 */
github strapi / strapi / packages / strapi-generate-new / lib / index.js View on Github external
`strapi${crypto.randomBytes(6).toString('hex')}`
  );

  const useNpm = cliArguments.useNpm !== undefined;

  const scope = {
    rootPath,
    name: basename(rootPath),
    // disable quickstart run app after creation
    runQuickstartApp: cliArguments.run === false ? false : true,
    // use pacakge version as strapiVersion (all packages have the same version);
    strapiVersion: require('../package.json').version,
    debug: cliArguments.debug !== undefined,
    quick: cliArguments.quickstart !== undefined,
    uuid: uuid(),
    deviceId: machineIdSync(),
    tmpPath,
    // use yarn if available and --use-npm isn't true
    useYarn: !useNpm && hasYarn(),
    installDependencies: true,
    strapiDependencies: [
      'strapi',
      'strapi-admin',
      'strapi-utils',
      'strapi-plugin-content-type-builder',
      'strapi-plugin-content-manager',
      'strapi-plugin-users-permissions',
      'strapi-plugin-email',
      'strapi-plugin-upload',
    ],
    additionalsDependencies: {},
  };
github realm / realm-js / lib / submit-analytics.js View on Github external
setTimeout(() => {
            if (isAnalyticsDisabled()) {
                return;
            }

            machineId()
                .catch() // Ignore errors
                .then((identifier) => {
                    if (!identifier) {
                        identifier = sha256('unknown');
                    }

                    const payload = {
                        'event': eventName,
                        'properties': {
                            'token': 'aab85907a13e1ff44a95be539d9942a9',
                            'distinct_id': identifier,
                            'Anonymized Machine Identifier': identifier,
                            'Anonymized Application ID': sha256(__dirname),
                            'Binding': context || 'node.js',
                            'Version': require('../package.json').version,
                            'Language': 'javascript',
github txthinking / mr2.js / index.js View on Github external
a.serverDomain = '';
  }
  if (a.server.indexOf('mr2.dev') !== -1) {
    a.serverPort = 0;
  }
  if (a.server.indexOf('mr2.dev') === -1) {
    if (!a.serverPort) {
      a.outputHelp();
      return;
    }
  }
  if (a.server.indexOf('mr2.dev') !== -1) {
    if (!a.serverDomain) {
      var {machineIdSync} = require('node-machine-id');
      var md5 = require('md5');
      a.serverDomain = md5(machineIdSync());
    }
  }
  if (!a.clientServer && !a.clientDirectory) {
    a.outputHelp();
    process.exit(0);
  }

  var bin = 'mr2';
  if (process.platform === 'linux') {
    bin = path.join(__dirname, 'binary/mr2');
  }
  if (process.platform === 'darwin') {
    bin = path.join(__dirname, 'binary/mr2_darwin_amd64');
  }
  if (process.platform === 'windows') {
    bin = path.join(__dirname, 'binary\\mr2_windows_amd64.exe');
github supunlakmal / thismypc / thisMyPCApp / assets / js / home.js View on Github external
const {
    ipcRenderer
} = require('electron');
const os = require('os');
let remote = require('electron').remote;
const fse = require('fs-extra');
let fs = require('fs');
const path = require('path');
/*const splitFile = requi;re('split-file')*/
const ioStream = require('socket.io-stream');
const $ = window.jQuery = require("jquery");
let hddSpace = require('hdd-space');
const {machineId, machineIdSync} = require('node-machine-id');
var FileAPI = require('file-api'), File = FileAPI.File, FileList = FileAPI.FileList, FileReader = FileAPI.FileReader;
const pcID = machineIdSync({original: true});
const pcID2 = machineIdSync();
//console.log(pcID2);
const pcKey = pcID2 + pcID;
let ioSocketID = '';
let id = '';
let auth = '';
let appKey = '';
let incomingFileInfo;
let incomingFileData;
let bytesReceived;
let downloadInProgress = false;
//folder created    mode
const desiredMode = 0o2775;
const homedir = os.homedir();
let userInfo = {};
let dir = homedir + '\/.thisMyPC';
fs.readFile(dir + '\/thisMyPC.json', 'utf8', function readFileCallback(err, data) {
github supunlakmal / thismypc / thisMyPCApp / assets / js / home.js View on Github external
//var socket = io.connect('http://127.0.0.1:3000');
const {
    ipcRenderer
} = require('electron');
const os = require('os');
let remote = require('electron').remote;
const fse = require('fs-extra');
let fs = require('fs');
const path = require('path');
/*const splitFile = requi;re('split-file')*/
const ioStream = require('socket.io-stream');
const $ = window.jQuery = require("jquery");
let hddSpace = require('hdd-space');
const {machineId, machineIdSync} = require('node-machine-id');
var FileAPI = require('file-api'), File = FileAPI.File, FileList = FileAPI.FileList, FileReader = FileAPI.FileReader;
const pcID = machineIdSync({original: true});
const pcID2 = machineIdSync();
//console.log(pcID2);
const pcKey = pcID2 + pcID;
let ioSocketID = '';
let id = '';
let auth = '';
let appKey = '';
let incomingFileInfo;
let incomingFileData;
let bytesReceived;
let downloadInProgress = false;
//folder created    mode
const desiredMode = 0o2775;
const homedir = os.homedir();
let userInfo = {};
let dir = homedir + '\/.thisMyPC';
github HelloWorld017 / Nexodus / src / utils / UserStore.js View on Github external
async init() {
		try {
			const uuid = await machineId();

			this.derivedHash = await new Promise((resolve, reject) => {
				crypto.pbkdf2(this.keyString, uuid, 103782, 32, 'sha512', (err, derivedKey) => {
					if(err) return reject(err);

					resolve(derivedKey);
				});
			});

			this.storeInitiated = true;
		} catch(e) {
			this.launcher.nexodus.logError(e);
		}

		try {
			const configDir = path.dirname(this.configPath);
github akaJes / marlin-config / app / server.js View on Github external
app.get('/version/:screen', function (req, res) {
  machineId()
  .then(id =>
    visitor.screenview({
      cd:req.params.screen,
      an:pjson.name+(isElectron&&"-electron"||''),
      av:pjson.version,
      ua:req.headers['user-agent'],
      cid: id,
      ul:req.headers['accept-language'].split(',')[0],
    }).send()
  )
  Promise.all([
    pio.isPIO().catch(() => false),
    git.root(),
    pioRoot().then(pioEnv).catch(e => []),
    st.read(),
  ])
github RedpointGames / pkgsign / src / lib / telemetry.ts View on Github external
import { machineIdSync } from 'node-machine-id';
import fetch from 'node-fetch';
import * as path from 'path';
import { readFileSync, writeFileSync } from 'fs';
import * as tmp from 'tmp';
import * as spawn from 'silent-spawn';

const enableTelemetry = process.env.DISABLE_PKGSIGN_TELEMETRY !== "true";
const currentMachineId = machineIdSync();
const pkgsignVersion = JSON.parse(readFileSync(path.join(__dirname, '../../package.json'), 'utf8')).version;

export interface TelemetryData {
  action: string;
  packageName: string;
  packageVersion: string;
  packageIsSigned: boolean;
  signingIdentity: string;
  identityIsTrusted: boolean;
}

let telemetryCache = [];

export async function queueTelemetry(data: TelemetryData) {
  if (enableTelemetry) {
    telemetryCache.push({

node-machine-id

Unique machine (desktop) id (no admin privileges required).

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis