-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (30 loc) · 776 Bytes
/
index.js
File metadata and controls
36 lines (30 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';
const path = require('path');
const pkg = require('./package');
const winVerifyTrust = require('bindings')(pkg.name);
function isLibExist(filename) {
return winVerifyTrust.isLibExist(filename);
}
function getLibPath(filename) {
return winVerifyTrust.getLibPath(filename);
}
function verifyTrust(filename) {
const result = { trusted: false, message: ''};
try {
const status = winVerifyTrust.verifyTrust(filename);
if (status === 0) {
result.trusted = true;
result.message = 'The library is signed, the signature was verified';
} else {
result.message = `Error code: ${status}`;
}
} catch (e) {
result.message = e.message;
}
return result;
}
module.exports = {
isLibExist,
getLibPath,
verifyTrust
};