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

@getflywheel/localcert

v1.4.4

Published

Generate and trust SSL certificates locally.

Downloads

1,221

Readme

localcert: SSL Certificate Generation and Trust

Build Status

Generates and trusts self-signed SSL certificates for local development. Based off the popular mkcert library for Go.

Requirements

In order to install certificates in NSS browsers such as Firefox, the Mozilla certutil is required. You can install it with the following:

Mac

brew install certutil

Linux

sudo apt install libnss3-tools
    -or-
sudo yum install nss-tools
    -or-
sudo pacman -S nss
    -or-
sudo zypper install mozilla-nss-tools

Windows

Installation to Firefox is not yet supported on Windows. Localcert will only install the certificate to the system store.

Usage

Import and instantiate the the localcert module:

var localcert = require('localcert')

var certgen = new localcert()

Generate the certificate:

certgen.generate(['test.local'], 'US', 'FL', 'Sarasota', 'Acme Inc', '')

const certPaths = await certgen.saveCertificate();

Note, you can pass a "certPath" to the saveCertificate method. Without it, localcert will save certificates to ~/.localcert

You can also load an existing certificate with the following:

const certPaths = certgen.loadCertificate(certPath,privateKeyPath);

Next, trust the certificate either in the system store, NSS browsers such as Firefox and Chrome, or both:

certgen.trustCertificatePlatform();
certgen.trustCertificateNSS();

To remove the certificate trusts, locate the certificate to remove and run the following:

certgen.removeCertificateTrustPlatform();
certgen.removeCertificateTrustNSS();

For the following functions, you can pass a second, optional, parameter of execute (bool) which defaults to true. If false, the command called will simply return the command parameters and not execute. Hopefully this will be handy in applications that may have wrapped sudo and/or other system calls.

Some utility functions

Determine if the user has certutil installed:

certgen.hasCertUtil();

Determine if the user has any NSS browsers that need to be trusted:

certgen.hasNSS();

Verify if the current certificate has been trusted in the system store

await verifyPlatformTrust();

Changelog

1.4.4

  • Added support for Apple Silicon in sudo-prompt applet.

1.4.3

  • Added serialNumber prop to certificate object upon verification
  • Updated trust verification on windows to use serialNumber and commonName
  • Removed meaningless verification check

1.4.2

  • Resolved missing 'certutil' command in windows truststore

1.4.0

  • Update sha1 to sha256
  • Have self-signed certs also be Certificate Authorities

1.3.0

  • Fix issue with duplicate DNS names

1.2.8

  • Fix inconsistencies with package-lock

1.2.7

  • Move to getflywheel organization

1.2.6

  • Remove dependencies on native node modules

1.2.5

  • Ensure we're properly verifying the certificate to build NSS commands

1.2.4

  • Fix default certPath when removing NSS trusts

1.2.3

  • Improve readme documentation
  • Fix bug where commands weren't returned from nss de-trust
  • Make certPath optional on most functions

1.2.2

  • Setup testing
  • Use npm instead of yarn

1.2.1

  • Fix filename when generating new key

1.2.0

  • Minor refactor

1.1.6

  • Savecertificate method is now properly async.

1.1.5

  • Use which package to avoid errors.

1.1.4

  • Add ability to verify system store on host machine has been trusted.

1.1.3

  • We need to escape paths for the child_process.exec execution

1.1.2

  • Send the correct database string to the NSS insert method.

1.1.1

  • export NSS command paths without normalized paths

1.1.0

  • Add helper function to retrieve NSS operations
  • Add ability to not execute NSS trust commands

1.0.7

  • Generated cert should not be listed as a CA.

1.0.6

  • Properly escape spaces in all paths for NSS browser trust

1.0.5

  • Don't escape Mac and Linux paths unless we have to

1.0.4

  • Add ability to avoid direct execution of sudo commands with optional "execute" parameter.

1.0.3

  • Ensure spaces are accounted for in Linux and Mac paths

1.0.2

  • Ensure certutil path is populated in Linux
  • Cleanout some unused variables after the port from mkcert

1.0.1

  • Add ability to load an existing certificate for trusting

1.0.0

  • Initial release