mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-10 21:33:38 +00:00
1. Added setting for Windows Certificate Store
2. Updated so NodeID is only saved on Windows, if Certificate Store is used
This commit is contained in:
@@ -35,15 +35,22 @@ function _meshNodeId()
|
||||
try
|
||||
{
|
||||
var db = require('SimpleDataStore').Create(process.execPath.replace('.exe', '.db'), { readOnly: true });
|
||||
var v = db.GetBuffer('NodeID');
|
||||
if(v!=null)
|
||||
var v = db.GetBuffer('SelfNodeCert');
|
||||
if (v)
|
||||
{
|
||||
try
|
||||
{
|
||||
ret = require('tls').loadCertificate({ pfx: v, passphrase: 'hidden' }).getKeyHash().toString('hex');
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
v = null;
|
||||
}
|
||||
}
|
||||
if (v == null && (v = db.GetBuffer('NodeID')) != NULL)
|
||||
{
|
||||
ret = v.toString('hex');
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = require('tls').loadCertificate({ pfx: db.GetBuffer('SelfNodeCert'), passphrase: 'hidden' }).getKeyHash().toString('hex');
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user