Skip to content

hjerling/certificate-expiry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

certificate-expiry

Check when a certificate for a domain expires.

Installation

npm install certificate-expiry

Usage

const cert = require('certificate-expiry');

cert.daysLeft('bbc.co.uk', (err, daysLeft) => {
  console.log(daysLeft);
});
const cert = require('certificate-expiry');

cert.expiresIn('bbc.co.uk', 'hours', (err, hoursLeft) => {
  console.log(hoursLeft);
});

API

cert.daysLeft(host, callback)

  • host - the host for the certificate you want to check. (example: 'bbc.co.uk' or 'google.com')
  • callback - returns an error or the number of days until the certificate expires as an integer. (example: 104)

cert.expiresOn(host, callback)

  • host - the host for the certificate you want to check. (example: 'bbc.co.uk' or 'google.com')
  • callback - returns an error or the date of expiry as a string. (example: '2017-03-15T17:01:06+00:00')

cert.expiresIn(host, unit, callback)

  • host - the host for the certificate you want to check. (example: 'bbc.co.uk' or 'google.com')
  • unit - optional - unit of measurement as string. Accepts same units as moment duration create. If this argument is omitted a moment duration object is returned in the callback. (example: 'days', 'hours', 'minutes')
  • callback - returns an error or the number of units left until the certificate expires. (example: 92) If a unit is not specified the return value is a moment duration object.

About

Check when a certificate for a domain expires.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published