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

@small-tech/node-pebble

v5.0.0

Published

A Node.js wrapper for Let’s Encrypt’s Pebble (“a small RFC 8555 ACME test server not suited for a production certificate authority”).

Downloads

123

Readme

Node Pebble

A Node.js wrapper for Let’s Encrypt’s Pebble (“a small RFC 8555 ACME test server not suited for a production certificate authority”).

  • Downloads the correct Pebble binary for your platform.

  • Launches and manages a single Pebble process.

  • Returns a reference to the same process on future calls (safe to include in multiple unit tests where order of tests is undetermined)

  • Automatically patches Node.js’s TLS module to accept Pebble server’s test certificate as well as its dynamically-generated root and intermediary CA certificates.

Version and platform support

Supports Pebble version 2.3.1 under Node.js LTS on platforms with binary Pebble releases:

  • Linux AMD 64.
  • Windows AMD 64.

Installation

npm i @small-tech/node-pebble

As part of the post-installation process, Node Pebble will download the correct Pebble binary for your platform for use at runtime.

Node Pebble has zero runtime dependencies.

API

Pebble.ready ([args], [env]) -> Promise<ChildProcess>

Promises to get the Pebble server ready for use. Resolves once Pebble server is launched and ready and Node.js’s TLS module has been patched to accept Pebble server’s test certificate as well as its dynamically-generated root and intermediary CA certificates.

Note that while this method returns a reference to the Pebble child process, in normal use you should not have to care about the return value.

Example

await Pebble.ready()

Parameters

  • args: Optional array or space-delimited string of arguments to pass to the Pebble binary. By default, no arguments are passed.

  • env: Optional object with additional environment variables to set for the Pebble process.

    For frequently run unit tests, pass the following environment variables for fastest test run time. You may want to include less frequently-run test tasks without these settings for a more robust test harness.

    • PEBBLE_VA_NOSLEEP=1
    • PEBBLE_WFE_NONCEREJECT=0

    You can also customise the default environment variables by simply passing them to the outer process that runs Node Pebble (for example, when specifying npm test tasks).

Pebble.shutdown () -> Promise

Promises to shut down the Pebble server. Resolves once server is closed.

Example

await Pebble.shutdown()

Default configuration

The default configuration file is at bin/test/config/pebble-config.json:

{
  "pebble": {
    "listenAddress": "0.0.0.0:14000",
    "managementListenAddress": "0.0.0.0:15000",
    "certificate": "test/certs/localhost/cert.pem",
    "privateKey": "test/certs/localhost/key.pem",
    "httpPort": 80,
    "tlsPort": 443,
    "ocspResponderURL": "http://localhost:8888",
    "externalAccountBindingRequired": false
  }
}

To customise the configuration, specify your own configuration file by passing the -config argument to the Pebble binary. e.g.,

Pebble.ready('-config customConfig.json')

Basic example

The following listing launches the Pebble server with its default settings and then shuts it down.

import Pebble from '@small-tech/node-pebble'

console.log('\n⏳ Launching Pebble server…\n')

await Pebble.ready()

console.log('✔ Pebble server launched and ready.')
console.log('✔ Node.js’s TLS module patched to accept Pebble’s CA certificates.')

// Do stuff that requires Pebble here.
// …

console.log('\n⏳ Shutting down Pebble server…\n')

await Pebble.shutdown()

console.log('✔ Pebble server shut down.\n')

Install development dependencies (for tests and coverage)

npm install

Run test task

npm -s test

Run coverage task

npm -s run coverage

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.

Copyright

© 2020-2021 Aral Balkan, Small Technology Foundation.

Let’s Encrypt is a trademark of the Internet Security Research Group (ISRG). All rights reserved. Node.js is a trademark of Joyent, Inc. and is used with its permission. We are not endorsed by or affiliated with Joyent or ISRG.

License

AGPL version 3.0 or later.