Skip to content

GeisonJr/certfy

Repository files navigation

Logo

Certificate Generator with Let's Encrypt API

Easy to use, fast and lightweight library for Node.js.

MIT Licence NPM version NPM downloads

Warning

This project is under development and is not yet ready for use.

🌱 Overview

This library is designed to facilitate the generation of certificates using the Let's Encrypt API.

✨ Features

  • Create a new certificate
  • Renew a certificate
  • Revoke a certificate
  • Support for wildcard domains
  • Scheduled certificate renewal

🚀 Tecnologies

The following tools were used in the construction of the project:

📦 Install

Use the package manager npm, yarn.

npm install @geisonjr/certfy
yarn add @geisonjr/certfy

🏗️ Usage

Environment Variables

Tip

You can use the .env file to set the environment variables.

  • CERTFY_DIR: The path where the certificates will be saved.
CERTFY_DIR=/Users/<username>/certificates
# or
CERTFY_DIR=C:\Users\<username>\certificates
# or
CERTFY_DIR=./certificates

Example

import { Certificate } from "@geisonjr/certfy";

const cert = new Certificate();

// Create a new certificate
await cert.obtain({
	domains: ["www.example.com", "example.com"],
	email: ["[email protected]"], // Optional
});

// Renew a certificate
await cert.renew({
	domains: ["www.example.com", "example.com"],
	email: ["[email protected]"], // Optional
  force: true, // Optional
  revoke: true, // Optional
  reason: REASON.unspecified, // Optional
});

// Revoke a certificate
const certificate: string = "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----";
const privateKey: string = "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----";

await cert.revoke(certificate, privateKey, {
  reason: REASON.unspecified, // Optional
});

Can you see a complete example here, to run the example use the following commands:

npm run example
yarn example

📚 References

📋 License

This project is under the MIT License