kartikk221 / hyper-express

High performance Node.js webserver with a simple-to-use API powered by uWebsockets.js under the hood.
MIT License
1.73k stars 89 forks source link

Client certificate validation #237

Closed arunnabraham closed 6 months ago

arunnabraham commented 6 months ago

Is there any option to validate ccertificate of client requests? like req.socket.getPeerCertificate()

kartikk221 commented 6 months ago

Hey, I don't think so. HyperExpress wraps uWebsockets.js. If you can find a comparable method on the uWS.HttpResponse instance, then you can use Response.raw.xxx to call that method as needed.

If you end up finding the method on uWS.HttpRequest then things can be a bit more complicated since uWS deallocates HttpRequest after first execution. Even in this case, what you could do is bind a global middleware as early as possible after Server construction and then access the Request.raw property inside of that middleware synchronously and cache the result on the Request property.