1
0
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:
Bryan Roe
2019-04-08 17:44:49 -07:00
parent a5000eee85
commit 7bf31b0a28
4 changed files with 40 additions and 14 deletions

View File

@@ -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)
{