SSLko is a lightweight JavaScript library for retrieving SSL/TLS certificate details, including validity and expiration information.
You can install SSLko using npm, yarn, pnpm, or bun:
npm install sslkoyarn add sslkopnpm add sslkobun add sslkoimport { getCertificateInfo } from "sslko";
const certInfo = await getCertificateInfo("example.com");
console.log(certInfo);Will return an CertificateInfo object. The most important properties are:
daysLeft- Number of days until the certificate expires.daysTotal- Total number of days the certificate is valid for.errorCode- The error code if the certificate validation failed.errors- List of errors found during certificate validation.expired- Boolean indicating if the certificate has expired.valid- Boolean indicating if the certificate is currently valid.validFor- The list of valid subject alternative names (SANs) for the certificate.validFromDate- The date from which the certificate is valid.validToDate- The date until which the certificate is valid.warnings- List of warnings found during certificate validation.
import { getCertificate } from 'sslko';
const cert = await getCertificate('example.com');There is few options you can pass to the getCertificate function:
import { getCertificate } from 'sslko';
const cert = await getCertificate('example.com', {
port: 488, // Default is 443
timeout: 10000, // Default is 5000ms => 5 seconds
});More information about the options can be found in the API documentation.
MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Made with โค๏ธ by the Roman Oลพana