Skip to content
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

Merged
merged 10 commits into from
Jul 16, 2024
Merged

Support self ca ssl #21

merged 10 commits into from
Jul 16, 2024

Conversation

nirfireblocks
Copy link
Collaborator

No description provided.

@nirfireblocks nirfireblocks requested a review from motiaFB July 3, 2024 19:54
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

@@ -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);
Copy link
Collaborator

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.

Copy link
Collaborator Author

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-----
Copy link
Collaborator Author

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]

Copy link
Collaborator Author

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-----
Copy link
Collaborator Author

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]

Copy link
Collaborator Author

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-----
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Collaborator Author

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-----
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Comment on lines 12 to 37
// 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;
}
Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, without classes.

Copy link
Collaborator

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?

@nirfireblocks nirfireblocks merged commit 8d0205e into main Jul 16, 2024
1 check passed
@nadav-fireblocks nadav-fireblocks deleted the WLT-135-support-self-CA-SSL branch July 18, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants