New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cocreate/server

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/server - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# [1.1.0](https://github.com/CoCreate-app/CoCreate-server/compare/v1.0.2...v1.1.0) (2024-01-08)
### Bug Fixes
* update server object properties ([762b209](https://github.com/CoCreate-app/CoCreate-server/commit/762b209ffbb22ebf9bb992d14f96eeeac2391bda))
### Features
* bumped CoCreate dependencies to their latest versions ([e6f76a5](https://github.com/CoCreate-app/CoCreate-server/commit/e6f76a57be9e4581c82fcf3e8e57768df35dfcd8))
## [1.0.2](https://github.com/CoCreate-app/CoCreate-server/compare/v1.0.1...v1.0.2) (2024-01-04)

@@ -2,0 +14,0 @@

4

package.json
{
"name": "@cocreate/server",
"version": "1.0.2",
"version": "1.1.0",
"description": "An intergration with Server and CoCreateJS.",

@@ -48,4 +48,4 @@ "keywords": [

"dependencies": {
"@cocreate/acme": "^1.0.0"
"@cocreate/acme": "^1.1.3"
}
}

@@ -0,42 +1,39 @@

const Http = require('http');
const Https = require('https');
const Http = require('http');
const fs = require('fs');
const tls = require('tls');
const acme = require('@cocreate/acme')
const fs = require('fs');
let server = {
acme: new acme(), // Initially an empty object or some placeholder functionality
acme: new acme(),
http: Http.createServer(),
https: Https.createServer({ SNICallback: sniCallback })
};
loadCertificates(domain) {
try {
return {
key: fs.readFileSync(`/etc/certificates/${domain}/private-key.pem`),
cert: fs.readFileSync(`/etc/certificates/${domain}/fullchain.pem`),
};
} catch (error) {
console.error("Error loading certificates for domain:", domain);
throw error; // Or handle it by returning default certificates
}
},
function loadCertificates(domain) {
try {
return {
key: fs.readFileSync(`/etc/certificates/${domain}/private-key.pem`),
cert: fs.readFileSync(`/etc/certificates/${domain}/fullchain.pem`),
};
} catch (error) {
console.error("Error loading certificates for domain:", domain);
throw error; // Or handle it by returning default certificates
}
}
async sniCallback(domain, cb) {
try {
console.log('sni')
await server.acme.checkCertificate(domain); // Referencing `this.acme`
async function sniCallback(domain, cb) {
try {
console.log('sni')
await server.acme.checkCertificate(domain);
const sslContext = tls.createSecureContext(server.loadCertificates(domain));
cb(null, sslContext);
} catch (error) {
console.error("Error in SNI callback for domain:", domain, error);
cb(error); // handle error or use default context
}
},
const sslContext = tls.createSecureContext(loadCertificates(domain));
cb(null, sslContext);
https: null, // Will be set after defining `sniCallback`
http: Http.createServer()
};
} catch (error) {
console.error("Error in SNI callback for domain:", domain, error);
cb(error); // handle error or use default context
}
}
// Creating the HTTPS server with the SNI callback
server.https = Https.createServer({ SNICallback: server.sniCallback });
module.exports = server;
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