npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fib-acme

v2.0.0

Published

a lightweight and flexible wrapper around the ACME protocol that allows you to easily manage SSL certificates for your domains.

Downloads

16

Readme

fib-acme

The fib-acme module is a lightweight and flexible wrapper around the ACME protocol that allows you to easily manage SSL certificates for your domains. It integrates seamlessly with fibjs, providing a simple way to obtain and renew SSL certificates from Let’s Encrypt.

Features

  • Automatic certificate generation and renewal
  • Automatically starts an HTTPS server and upgrades the certificate when it is renewed
  • Integration with Let’s Encrypt services
  • Support for ECDSA and RSA key types
  • Flexible configuration options
  • Easy-to-use API

Installation

$ fibjs --install fib-acme

Usage

const AcmeApp = require('fib-acme');

const app = new AcmeApp({
  config: 'path/to/acme.json',
  domain: '<your_domain>',
  email: '<your_email>',
  handler: function (req) {
    req.response.write("Hello World!");
  },
});

app.start();

The fib-acme module provides a simple way to manage SSL certificates for your domains using the ACME protocol. Here’s how you can use it in your fibjs application:

  1. Install the fib-acme module using the npm package manager.
  2. Import the fib-acme module into your application.
  3. Create a new AcmeApp instance with the desired configuration options.
  4. Call the start() method on the AcmeApp instance to initiate the certificate generation and renewal process.

Upon calling start(), the AcmeApp instance will automatically generate a configuration file and request an SSL certificate from Let’s Encrypt for the specified domain. It will also handle the automatic renewal of the certificate when it approaches expiration. Additionally, the module will start an HTTPS server and upgrade the certificate in real-time when it is renewed.

Configuration

The AcmeApp instance automatically creates and updates a configuration file named acme.json in the current working directory. The configuration file contains the necessary details for the ACME protocol, including the domain, email address, and key pairs.

The acme.json file has the following structure:

{
    "service": "https://acme-staging-v02.api.letsencrypt.org/directory",
    "domain": "<your_domain>",
    "email": "<your_email>",
    "key": {
        "kty": "EC",
        "crv": "P-384",
        "x": "<public_key_x>",
        "y": "<public_key_y>",
        "d": "<private_key>"
    },
    "kid": "https://acme-staging-v02.api.letsencrypt.org/acme/acct/<account_id>",
    "cert": {
        "key": {
            "kty": "EC",
            "crv": "P-384",
            "x": "<public_key_x>",
            "y": "<public_key_y>",
            "d": "<private_key>"
        },
        "cert": "<certificates>“
    }
}
  • service: The URL of the ACME service. By default, it is set to the Let’s Encrypt staging service for testing purposes.
  • domain: The domain for which the SSL certificate is requested.
  • email: The email address to be associated with the SSL certificate.
  • key: The key pair used for the ACME account. It includes the key type, curve, public key coordinates, and the private key.
  • kid: The URL of the ACME account.
  • cert: The key pair used for the SSL certificate. It includes the key type, curve, public key coordinates, and the private key, as well as the certificate itself.

API

new AcmeApp(options)

Creates a new AcmeApp instance with the provided options. The available options are:

  • config (required): The path to the configuration file.
  • domain (required): The domain for which the SSL certificate is requested.
  • email (required): The email address to be associated with the SSL certificate.
  • handler (required): The request handler function called when a verification request is made.

Example:

const AcmeApp = require('fib-acme');

const app = new AcmeApp({
  config: 'path/to/acme.json',
  domain: '<your_domain>',
  email: '<your_email>',
  handler: function (req) {
    req.response.write("Hello World!");
  },
});

Upon creating a new AcmeApp instance, you can specify the domain and email address for which you want an SSL certificate. Optionally, you can provide a request handler function that will be called when a verification request is made.

AcmeApp.start()

Starts the AcmeApp instance, initiating the certificate generation and renewal process.

Example:

app.start();

The start() method triggers the ACME protocol communication with Let’s Encrypt servers, allowing the AcmeApp instance to obtain and renew an SSL certificate for the specified domain.

AcmeApp.stop()

Stops the AcmeApp instance and terminates the certificate generation and renewal process.

Example:

app.stop();

By calling stop(), you can gracefully terminate the certificate generation and renewal process. This properly closes any active connections and ensures that the application can exit cleanly.

Conclusion

The fib-acme module provides an easy and efficient way to manage SSL certificates for your domains using the ACME protocol. The AcmeApp instance automatically handles the creation and updating of the configuration file, as well as the generation and renewal of SSL certificates. Give it a try in your fibjs application today and secure your server with ease!