GithubHelp home page GithubHelp logo

gamote / cert127 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 20 KB

There is no place like 127.0.0.1 ๐Ÿ 

License: Other

TypeScript 100.00%
makecert cert127 127 certificate development https local mkcert ssl tls

cert127's Introduction

cert127

npm version npm downloads/month GitHub license

Small utility to generate ๐Ÿ”’ trusted self-signed certificates for local development.

Prerequisites

This package requires mkcert to be installed on your system. Please follow the installation instructions for your platform.

Installation

# With Yarn
yarn add cert127

# or with npm
npm i cert127

Usage

import cert127 from 'cert127';

const { key, cert } = await cert127();

Example

Let's create a quick Fastify server with the listening socket configured for TLS:

import cert127 from 'cert127';
import Fastify from 'fastify';

/**
 * Run the server!
 */
const start = async () => {
  const fastify = Fastify({ https: await cert127() });

  fastify.get('/secure', (req, reply) =>
    reply.send("There is no place like 127.0.0.1 ๐Ÿ "));

  await fastify.listen({ port: 3000 });
};

void start();

Now you can open https://localhost:3000/secure in your browser and see:

There is no place like 127.0.0.1 ๐Ÿ 

IMPORTANT: This will not work on production, as it is meant only for local development.

โœจ Roadmap

  • Try to include the mkcert binary in the package, so that it can be used without installing it on the system. (check node-pre-gyp)
  • Make it a class, so we offer more ways to retrieve the cert
  • Add a check to see if mkcert is installed and if not, install it
  • Make sure that mkcert was initialized: mkcert -install
  • Add a check to see if the certificate is already created and ask the user if they want to overwrite it
  • Add more options for customizations (e.g. hosts, expiration time etc.)
  • Add a way to revoke the certificate
  • Add a way to check if the certificate is valid
  • Allow creating multiple certificates
  • Add tests
  • Add CI/CD
  • Add ESLint and Prettier
  • Add sync method

cert127's People

Contributors

gamote avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.