Skip to content

A tiny NodeJS module to check SSL expiry ๐Ÿ”’

License

Notifications You must be signed in to change notification settings

dyaa/ssl-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

87 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Node SSL Checker

Build Status npm version npm Codacy Badge Codacy Badge

Installation

Simply add ssl-checker as a dependency:

$ npm install ssl-checker --save # npm i -s ssl-checker

# Or if you prefer using yarn (https://yarnpkg.com/lang/en/)
$ yarn add ssl-checker

Usage

import sslChecker from "ssl-checker";

const getSslDetails = async (hostname: string) =>
  await sslChecker(hostname`ex. badssl.com`);

Options

All valid https.RequestOptions values.

Option Default Description
method HEAD Can be GET too
port 443 Your SSL/TLS entry point
agent default Default HTTPS agent with { maxCachedSessions: 0 }
rejectUnauthorized false Skips authorization by default
validateSubjectAltName false Skips returning/validating subjectaltname
sslChecker("dyaa.me", { method: "GET", port: 443, validateSubjectAltName: true }).then(console.info);

Response Example

{
  "daysRemaining": 90,
  "valid": true,
  "validFrom": "issue date",
  "validTo": "expiry date",
  "validFor": ["www.example.com", "example.com"]
}

NOTE: validFor is only returned if validateSubjectAltName is set to true

License

Copylefted (c) 8008 :trollface: Dyaa Eldin Moustafa Licensed under the MIT license.