ssl-checker
Version:
ssl-checker
64 lines (45 loc) • 2.47 kB
Markdown
[](https://github.com/dyaa/ssl-checker/actions)
[](https://badge.fury.io/js/ssl-checker) [](https://github.com/dyaa/node-ssl-checker)
[](https://www.codacy.com/gh/dyaa/ssl-checker/dashboard?utm_source=github.com&utm_medium=referral&utm_content=dyaa/ssl-checker&utm_campaign=Badge_Coverage)
[](https://www.codacy.com/gh/dyaa/ssl-checker/dashboard?utm_source=github.com&utm_medium=referral&utm_content=dyaa/ssl-checker&utm_campaign=Badge_Grade)
Simply add `ssl-checker` as a dependency:
```bash
$ npm install ssl-checker --save
$ yarn add ssl-checker
```
```ts
import sslChecker from "ssl-checker";
const getSslDetails = async (hostname: string) =>
await sslChecker(hostname`ex. badssl.com`);
```
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` |
```ts
sslChecker("dyaa.me", { method: "GET", port: 443, validateSubjectAltName: true }).then(console.info);
```
```json
{
"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`**
Copylefted (c) 8008 :trollface: [Dyaa Eldin Moustafa][1] Licensed under the [MIT license][2].
[]: https://dyaa.me/
[]: https://github.com/dyaa/node-ssl-checker/blob/master/LICENSE