Skip to content

Latest commit

 

History

History
131 lines (80 loc) · 5.77 KB

developer-documentation.md

File metadata and controls

131 lines (80 loc) · 5.77 KB

Developer Documentation

This documentation includes the implementation details of Auto Encrypt Localhost and is intended to aid you if you’re trying to improve, debug, or get a deeper understanding of Auto Encrypt.

If you just want to use Auto Encrypt Localhost, please see the public API, as documented in the README.

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.

Requirements

Auto Encrypt Localhost is supported on:

  • Node: LTS (currently 12.16.1).
  • ECMAScript: ES2019

Overview of relationships

Dependency relationship diagram for Auto Correct

Not shown (for clarity): third-party Node modules, the util namespace with helper modules – for logging, error handling, and an async forEach implementation – and the typedefs namespace with JSDoc type definitions.

Generated using dependency cruiser.

How it works in more detail

Auto Encrypt Localhost is a Node.js wrapper for mkcert that:

  • Uses the 64-bit release binaries to support Linux, macOS, and Windows.

  • Automatically installs the certutil (nss) dependency on Linux on systems with apt, pacman, yum (untested) and and on macOS if you have Homebrew or MacPorts (untested).

  • Creates a root Certificate Authority.

  • Creates locally-trusted TLS certificates for localhost, 127.0.0.1, and ::1.

You can use these certificates for local development without triggering self-signed certificate errors.

For more details on how Auto Encrypt Localhost works behind the scenes, please see the mkcert README.

Tests

npm test

To see debug output, run npm run test-debug instead.

Coverage

npm run coverage

To see debug output, run npm run coverage-debug instead.

Documentation

To regenerate the dependency diagram and this documentation:

npm run generate-developer-documentation

@small-tech/auto-encrypt-localhost

Automatically provisions and installs locally-trusted TLS certificates for Node.js® https servers (including Express.js, etc.) using mkcert.

License: AGPLv3 or later.
Copyright: © 2020 Aral Balkan, Small Technology Foundation.

AutoEncryptLocalhost ⏏

Auto Encrypt Localhost is a static class. Please do not instantiate.

Use: AutoEncryptLocalhost.https.createServer(…)

Kind: Exported class

AutoEncryptLocalhost.https

By aliasing the https property to the AutoEncryptLocalhost static class itself, we enable people to add AutoEncryptLocalhost to their existing apps by requiring the module and prefixing their https.createServer(…) line with AutoEncryptLocalhost:

Kind: static property of AutoEncryptLocalhost
Example

const AutoEncryptLocalhost = require('@small-tech/auto-encrypt-localhost')
const server = AutoEncryptLocalhost.https.createServer()

AutoEncryptLocalhost.createServer([options]) ⇒ https.Server

Automatically provisions trusted development-time (localhost) certificates in Node.js via mkcert.

Kind: static method of AutoEncryptLocalhost
Returns: https.Server - The server instance returned by Node’s https.createServer() method.

Param Type Default Description
[options] Object Optional HTTPS options object with optional additional Auto Encrypt-specific configuration settings.
[options.settingsPath] String ~/.small-tech.org/auto-encrypt-localhost/ Custom path to save the certificate and private key to.

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 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.