New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.1.2 to 5.2.0

6

CHANGELOG.md

@@ -8,6 +8,8 @@ # Changelog

## [Unreleased]
## [5.2.0] - 2020-07-06
Nothing yet.
### Added
- Local server can how be accessed over external IPv4 address. This means that you can now test with other devices on your local area network without having to expose your server over the wide area network / Internet.
## [5.1.2] - 2020-06-16

@@ -14,0 +16,0 @@

@@ -99,8 +99,20 @@ /**

log(' 📜 ❨auto-encrypt-localhost❩ Creating local TLS certificates using mkcert…')
const createCertificateArguments = [
// Support all local interfaces so that the machine can be reached over the local network via IPv4.
// This is very useful for testing with multiple devices over the local area network without needing to expose
// the machine over the wide area network/Internet using a service like ngrok.
const localIPv4Addresses =
Object.entries(os.networkInterfaces())
.map(iface =>
iface[1].filter(addresses =>
addresses.family === 'IPv4')
.map(addresses => addresses.address)).flat()
const certificateDetails = [
`-key-file=${keyFilePath}`,
`-cert-file=${certFilePath}`,
'localhost', '127.0.0.1', '::1'
]
childProcess.execFileSync(mkcertBinary, createCertificateArguments, mkcertProcessOptions)
'localhost'
].concat(localIPv4Addresses)
childProcess.execFileSync(mkcertBinary, certificateDetails, mkcertProcessOptions)
log(' 📜 ❨auto-encrypt-localhost❩ Local TLS certificates created.')

@@ -107,0 +119,0 @@ } catch (error) {

{
"name": "@small-tech/auto-encrypt-localhost",
"version": "5.1.2",
"version": "5.2.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": [

@@ -10,2 +10,8 @@ const os = require('os')

async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
test('certificate creation', async t => {

@@ -49,4 +55,17 @@ // t.plan(12)

t.strictEquals(response, 'ok', 'The response from the server is as expected.')
t.strictEquals(response, 'ok', 'Response from server is as expected for access via localhost.')
// Test access from all local interfaces with IPv4 addresses.
const localIPv4Addresses =
Object.entries(os.networkInterfaces())
.map(iface =>
iface[1].filter(addresses =>
addresses.family === 'IPv4')
.map(addresses => addresses.address)).flat()
await asyncForEach(localIPv4Addresses, async localIPv4Address => {
const response = await getHttpsString(`https://${localIPv4Address}`)
t.strictEquals(response, 'ok', `Response from server is as expected for access via ${localIPv4Address}`)
})
server.close()

@@ -53,0 +72,0 @@

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