Socket
Socket
Sign inDemoInstall

certificate-details

Package Overview
Dependencies
1
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.3.0

test/keys/localhost-with-san/certificate.pem

10

dist/certificateDetails.js

@@ -45,3 +45,3 @@ 'use strict';

callback(null, {
var result = {
subject: {

@@ -69,3 +69,9 @@ country: details.subject.C,

}
});
};
if (details.subjectaltname) {
result.subject.alternativeNames = [details.subjectaltname.substring(details.subjectaltname.indexOf(':') + 1)];
}
callback(null, result);
});

@@ -72,0 +78,0 @@

12

lib/certificateDetails.js

@@ -45,3 +45,3 @@ 'use strict';

callback(null, {
const result = {
subject: {

@@ -69,3 +69,11 @@ country: details.subject.C,

}
});
};
if (details.subjectaltname) {
result.subject.alternativeNames = [
details.subjectaltname.substring(details.subjectaltname.indexOf(':') + 1)
];
}
callback(null, result);
});

@@ -72,0 +80,0 @@

{
"name": "certificate-details",
"version": "0.2.0",
"version": "0.3.0",
"description": "certificate-details gets the details from an SSL certificate.",

@@ -5,0 +5,0 @@ "contributors": [

@@ -71,3 +71,34 @@ 'use strict';

});
test('returns the certificate details with SANs.', done => {
certificateDetails.get(path.join(__dirname, '..', 'keys', 'localhost-with-san'), (err, details) => {
assert.that(err).is.null();
assert.that(details).is.ofType('object');
assert.that(details.subject).is.equalTo({
country: 'DE',
state: 'Baden-Wuerttemberg',
location: 'Riegel am Kaiserstuhl',
organisation: 'the native web GmbH',
commonName: 'localhost',
email: 'hello@thenativeweb.io',
alternativeNames: [ '1.2.3.4' ]
});
assert.that(details.issuer).is.equalTo({
country: 'DE',
state: 'Baden-Wuerttemberg',
location: 'Riegel am Kaiserstuhl',
organisation: 'the native web GmbH',
commonName: 'localhost',
email: 'hello@thenativeweb.io'
});
assert.that(details.metadata).is.equalTo({
validFrom: new Date(2017, 9, 6, 14, 15, 38),
validTo: new Date(2047, 9, 4, 14, 15, 38),
fingerprint: '7E:1B:07:5A:8A:F8:B2:96:0D:AA:0C:05:35:48:37:08:F8:34:B8:07',
serialNumber: 'DCF2E1CF89D0A5AD'
});
done();
});
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc