Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

localhost-cert

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localhost-cert

A secure and convenient solution for enabling HTTPS on localhost

Source
npmnpm
Version
1.0.13
Version published
Weekly downloads
9
-90.72%
Maintainers
1
Weekly downloads
 
Created
Source

Localhost Https / Localhost Cert

A secure and convenient solution for enabling HTTPS on localhost

Other languages

chinese

When to use Localhost Cert?

If you need to enable HTTPS when starting a local development server, then Localhost Cert is the tool you need. It allows you to quickly obtain pre-generated certificates.

Is it necessary to install the root certificate?

Similar to most proxy tools, you still need to install the root certificate. This is because Localhost Cert uses a self-signed certificate, which is not trusted by default in browsers. Although installing the root certificate locally is safe.

Why is it secure?

If you have a basic understanding of HTTPS, you know that installing a CA root certificate locally can be risky. This is because the root certificate can be used to sign any domain, such as google.com, enabling man-in-the-middle attacks. However, Localhost Cert immediately discards the private key of the root certificate after generating the localhost domain certificate. Therefore, it is impossible for anyone to use this root certificate to sign other websites.

To ensure that the private key is not remembered, Localhost Cert utilizes GitHub Actions to generate the root certificate. The process of generating the certificate and the code at that time are fully traceable on GitHub. If you're interested, you can view the GitHub Action for more details.

In summary, it is completely secure due to two reasons:

  • The process of generating the root certificate is based on GitHub Actions and is fully traceable.
  • After signing the localhost domain, the private key of the root certificate is discarded and cannot be used to sign other domains.

How to use?

npm install localhost-https --save-dev

webpack-dev-server

const getHttps = require('localhost-https');

// webpack config
module.exports = {
    devServer: {
        https: getHttps(),
    },
};
// vite config
const getHttps = require('localhost-https');
export default defineConfig({
    server: {
        https: getHttps(),
    },
});

License

Localhost Cert is licensed under the MIT License.

Keywords

localhost

FAQs

Package last updated on 01 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts