Miss any of our Open RFC calls?Watch the recordings here! »

get-ssl-certificate-next

3.0.0 • Public • Published

get-ssl-certificate-next

A zero-dependency utility that returns a website's SSL certificate

CI Coverage Status Code Climate NPM version

Installation

npm install --save get-ssl-certificate-next

Usage

Import package:

const sslCertificate = require('get-ssl-certificate-next')

Pass a url / domain name:

sslCertificate.get('nodejs.org').then(function (certificate) {
  console.log(certificate)
  // certificate is a JavaScript object
 
  console.log(certificate.issuer)
  // { C: 'GB',
  //   ST: 'Greater Manchester',
  //   L: 'Salford',
  //   O: 'COMODO CA Limited',
  //   CN: 'COMODO RSA Domain Validation Secure Server CA' }
 
  console.log(certificate.valid_from)
  // 'Aug  14 00:00:00 2017 GMT'
 
  console.log(certificate.valid_to)
  // 'Nov 20 23:59:59 2019 GMT'
 
  // If there was a certificate.raw attribute, then you can access certificate.pemEncoded
  console.log(certificate.pemEncoded)
  // -----BEGIN CERTIFICATE-----
  // ...
  // -----END CERTIFICATE-----
});

Optional parameters: Timeout (in ms), Protocol (Default is 'https:'), Port (Default is 443) and detailed (includes certificate chain, Default is false)

sslCertificate.get('nodejs.org', 250, 443, 'https:', false).then(function (certificate) {
  console.log(certificate)
  // certificate is a JavaScript object
 
  console.log(certificate.issuer)
  // { C: 'GB',
  //   ST: 'Greater Manchester',
  //   L: 'Salford',
  //   O: 'COMODO CA Limited',
  //   CN: 'COMODO RSA Domain Validation Secure Server CA' }
 
  console.log(certificate.valid_from)
  // 'Aug  14 00:00:00 2017 GMT'
 
  console.log(certificate.valid_to)
  // 'Nov 20 23:59:59 2019 GMT'
 
  // If there was a certificate.raw attribute, then you can access certificate.pemEncoded
  console.log(certificate.pemEncoded)
  // -----BEGIN CERTIFICATE-----
  // ...
  // -----END CERTIFICATE-----
});

License

MIT

Install

npm i get-ssl-certificate-next

DownloadsWeekly Downloads

6

Version

3.0.0

License

MIT

Unpacked Size

61.4 kB

Total Files

10

Last publish

Collaborators

  • avatar