Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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',
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);
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(),
])
export async function getHardwareId() {
const id = await machineId()
return generateUuid(id)
}
private static async getKey(): Promise {
const machineKey = await machineId();
return createHmac(hash, machineKey)
.update(machineKey)
.digest();
}
}
async function getAnonymousId() {
return await machineId(false)
}