Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@small-tech/auto-encrypt-localhost

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@small-tech/auto-encrypt-localhost - npm Package Compare versions

Comparing version 5.4.1 to 6.0.0

6

CHANGELOG.md

@@ -8,2 +8,8 @@ # Changelog

## [6.0.0] - 2020-11-03
### Changed
- __Breaking change:__ Running multiple servers at different HTTPS ports no longer results in an error due to port 80 being unavailable for the HTTP Server. However, know that only the first server will get the HTTP Server at port 80 that redirects HTTP calls to HTTPS and also serves your local root certificate authority public key. (#14)
## [5.4.1] - 2020-07-11

@@ -10,0 +16,0 @@

18

lib/HttpServer.js

@@ -131,10 +131,16 @@

await new Promise((resolve, reject) => {
try {
this.server.listen(80, () => {
log(` ✨ ❨auto-encrypt-localhost❩ HTTP server is listening on port 80.`)
this.server.on('error', error => {
if (error.code === 'EADDRINUSE') {
console.log(' ❕ ❨auto-encrypt-localhost❩ Port 80 is busy; skipping http redirection server for this instance.')
resolve()
})
} catch (error) {
return
}
reject(error)
}
})
this.server.listen(80, (error) => {
log(` ✨ ❨auto-encrypt-localhost❩ HTTP server is listening on port 80.`)
resolve()
})
})

@@ -141,0 +147,0 @@ }

{
"name": "@small-tech/auto-encrypt-localhost",
"version": "5.4.1",
"version": "6.0.0",
"description": "Automatically provisions and installs locally-trusted TLS certificates for Node.js https servers (including Express.js, etc.) using mkcert.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -72,5 +72,8 @@ # Auto Encrypt Localhost

### Multiple servers
You are not limited to running your server on port 444. You can listen on any port you like and you can have multiple servers with the following caveat: the HTTP server that redirects HTTP calls to HTTPS and serves your local root certificate authority public key (see below) will only be created for the first server and then only if port 80 is free.
### Accessing your local machine from other devices on your local area network
You can access local servers via their IPv4 address over a local area network.

@@ -77,0 +80,0 @@

@@ -95,3 +95,29 @@ const os = require('os')

t.end()
server2.close(() => {
t.end()
})
})
test ('multiple servers', t => {
const server1Response = 'Server 1'
const server2Response = 'Server 2'
const server1 = AutoEncryptLocalhost.https.createServer((request, response) => { response.end(server1Response) })
server1.listen(443, () => {
const server2 = AutoEncryptLocalhost.https.createServer((request, response) => { response.end(server2Response) })
server2.listen(444, async () => {
const result1 = await downloadString('https://localhost')
const result2 = await downloadString('https://localhost:444')
t.strictEquals(result1, server1Response, 'Server 1 response is as expected.')
t.strictEquals(result2, server2Response, 'Server 2 response is as expected.')
server1.close(() => {
server2.close(() => {
t.end()
})
})
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc