feat(server): add an embedded ACME directory server and certificate authority with challenge, order, and certificate endpoints
This commit is contained in:
29
ts_server/server.handlers.nonce.ts
Normal file
29
ts_server/server.handlers.nonce.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type * as http from 'node:http';
|
||||
|
||||
/**
|
||||
* HEAD /new-nonce — Returns 200 with Replay-Nonce header (added by router).
|
||||
* GET /new-nonce — Returns 204 with Replay-Nonce header (added by router).
|
||||
*/
|
||||
export function createNonceHeadHandler() {
|
||||
return async (
|
||||
_req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
_params: Record<string, string>,
|
||||
_body: any,
|
||||
): Promise<void> => {
|
||||
res.writeHead(200, { 'Content-Type': 'application/octet-stream' });
|
||||
res.end();
|
||||
};
|
||||
}
|
||||
|
||||
export function createNonceGetHandler() {
|
||||
return async (
|
||||
_req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
_params: Record<string, string>,
|
||||
_body: any,
|
||||
): Promise<void> => {
|
||||
res.writeHead(204);
|
||||
res.end();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user