-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support self ca ssl #21
Conversation
examples/server/package-lock.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally it would be packet-lock.json or yarn-lock.json.
I would not expect to see both.
Maybe we need to delete one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the npm support more things, so I'll remove the yarn.
We need to make sure we don't add yarn related files to the repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted the yarn lock - we should stick to npm
examples/server/src/server.ts
Outdated
@@ -21,4 +24,18 @@ app.use(helmet()); | |||
|
|||
app.use(`/api`, apiRouter); | |||
|
|||
app.listen(PORT, () => logger.info(SERVER_START_MSG)); | |||
// Use HTTPS if private key and certificate are provided | |||
logger.info(process.env.SELF_SIGNED_SSL_PRIV_KEY_PATH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add some prefix to the print. In this line and the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed, see previous comment
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove key from repo [Nadav]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,22 @@ | |||
-----BEGIN CERTIFICATE----- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove form repo [since we don't have a key]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/ssl-cert.crt
Outdated
@@ -0,0 +1,22 @@ | |||
-----BEGIN CERTIFICATE----- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/ssl-cert.crt
Outdated
@@ -0,0 +1,22 @@ | |||
-----BEGIN CERTIFICATE----- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively you can point or link into the same certificate in the examples folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in the README.md
src/services/customer-server.api.ts
Outdated
// HTTPS | ||
const cert = fs.readFileSync(SSL_CERT_PATH); | ||
const httpsAgent = new https.Agent({ | ||
ca: cert | ||
}); | ||
|
||
const res = await axios.post( | ||
`${CUSTOMER_SERVER_URL}/messagesToSign`, | ||
{ messages }, | ||
{ | ||
headers: { Authorization: CUSTOMER_SERVER_AUTHORIZATION }, | ||
httpsAgent, | ||
}, | ||
); | ||
return res.data.statuses; | ||
} else { | ||
// HTTP | ||
const res = await axios.post( | ||
`${CUSTOMER_SERVER_URL}/messagesToSign`, | ||
{ messages }, | ||
{ | ||
headers: { Authorization: CUSTOMER_SERVER_AUTHORIZATION }, | ||
}, | ||
); | ||
return res.data.statuses; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create 2 classes for HTTP and HTTPS or move this logic to a function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, without classes.
examples/server/env/san.cnf
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this file is needed? Can we delete it?
No description provided.