Skip to content

Commit 54eb720

Browse files
committed
server-ssl.js
make some changes to checkChallengesMixin only create the jwkThumbPrint once /root │ ├── /error │ ├── 404.html │ └── 500.html │ ├── /ssl │ ├── /openssl │ ├── /module │ │ ├── /crypt │ │ ├── /jose │ │ └── lets-encrypt-acme-client.js │ │ │ ├── acmeKeys │ ├── private-key.pem │ └── certificate.pem │ └── ssl.js │ ├── /website │ └── index.html <---- Your website goes here │ ├── node.exe ├── server-ssl.js <--- server config └── start-windows.bat
1 parent 7d669bf commit 54eb720

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ It can be as simple as this:
3434
./start-windows.bat --cert="your-certificate.pem" --pk="your-private-key.pem"
3535
```
3636

37-
[![](https://i.imgur.com/NxJQeLm.gif)](https://github.com/FirstTimeEZ/server-ssl/archive/refs/heads/main.zip)
38-
3937
[![](https://i.imgur.com/HuaQTrJ.png)](https://github.com/FirstTimeEZ/server-ssl/archive/refs/heads/main.zip)
4038

39+
[![](https://i.imgur.com/NxJQeLm.gif)](https://github.com/FirstTimeEZ/server-ssl/archive/refs/heads/main.zip)
40+
4141
### Optional Arguments
4242

4343
`server-ssl.js` has some optional arguments you can use in production if the defaults aren't enough.

ssl/module/lets-encrypt-acme-client.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ let localHost = false;
7373
let checkedForLocalHost = false;
7474

7575
let jsonWebKey = undefined;
76+
let jsonWebKeyThumbPrint = null;
77+
7678
let acmeDirectory = DIRECTORY_PRODUCTION;
7779

7880
let attemptWhen = null;
7981
let startedWhen = null;
8082

81-
let jwkThumbPrint = null;
82-
8383
/**
8484
* Starts the Let's Encrypt daemon to manage SSL certificates.
8585
*
@@ -290,7 +290,7 @@ export async function startLetsEncryptDaemon(fqdns, sslPath, daysRemaining, cert
290290
* createServerHTTP((req, res) => { if (checkChallengesMixin(req, res)) { return; } }).listen(80);
291291
*/
292292
export async function checkChallengesMixin(req, res) {
293-
if (pendingChallenges.length === 0 || localHost === true || jwkThumbPrint == undefined || internalCheckChallenges()) {
293+
if (pendingChallenges.length === 0 || localHost === true || jsonWebKeyThumbPrint == undefined || internalCheckChallenges()) {
294294
return false;
295295
}
296296

@@ -315,7 +315,7 @@ export async function checkChallengesMixin(req, res) {
315315
console.log(ACME_CHALLENGE, challenge.token);
316316

317317
res.writeHead(SUCCESS, { [CONTENT_TYPE]: CONTENT_TYPE_OCTET });
318-
res.end(Buffer.from(`${challenge.token}.${jwkThumbPrint}`));
318+
res.end(Buffer.from(`${challenge.token}.${jsonWebKeyThumbPrint}`));
319319

320320
bufferModified = true;
321321

@@ -369,7 +369,7 @@ async function newNonceAsync(newNonceUrl) {
369369
async function createAccount(nonce, newAccountUrl, keyChain) {
370370
try {
371371
jsonWebKey = await jose.exportJWK(keyChain.publicKey);
372-
jwkThumbPrint = await jose.calculateJwkThumbprint(jsonWebKey, DIGEST);
372+
jsonWebKeyThumbPrint = await jose.calculateJwkThumbprint(jsonWebKey, DIGEST);
373373

374374
const payload = { termsOfServiceAgreed: true };
375375

0 commit comments

Comments
 (0)