lib/x509/truststore.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 19
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 0
wmc 3
c 2
b 0
f 0
nc 1
mnd 0
bc 3
fnc 3
dl 0
loc 19
ccs 10
cts 10
cp 1
crap 0
rs 10
bpm 1
cpm 1
noi 1

3 Functions

Rating   Name   Duplication   Size   Complexity  
A truststore.js ➔ parseCertFrom 0 5 1
A Object.map 0 3 1
A truststore.js ➔ parseCertFromBase64 0 3 1
1 1
var jsrsasign = require('jsrsasign');
2
3
function parseCertFrom(string, encoding) {
4 136
    var cert = new jsrsasign.X509();
5 136
    cert.readCertHex(Buffer.from(string, encoding).toString('hex'));
0 ignored issues
show
Bug introduced by
The variable Buffer seems to be never declared. If this is a global, consider adding a /** global: Buffer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
6 136
    return cert;
7
}
8
9
function parseCertFromBase64(string) {
10 136
    return parseCertFrom(string, 'base64');
11
}
12
13 1
var certificates = require('./ca-certificates.json');
14 1
var store = [];
15 1
Object.keys(certificates).map(function(key) {
16 136
    store.push(parseCertFromBase64(certificates[key]));
17
});
18
19
module.exports = store;
20