/* * wh_tls.h - TLS over an already-connected, already-validated socket. * * POSIX only. _WIN32 uses WinHTTP (which does its own TLS against the system * root store) so this module is an empty translation unit there. * * Policy: TLS 1.2 minimum, VERIFY_PEER always, hostname checked against the * certificate, trust anchors from WEBHOOK_TLS_CA_FILE or the first readable * system bundle. There is deliberately NO insecure bypass anywhere in this * plugin: a webhook that carries a bearer token must not be sendable over a * channel that cannot prove who it is talking to. * * MIT License. Copyright (c) 2026 SCORPIOX INC. */ #ifndef SX_WH_TLS_H #define SX_WH_TLS_H #include #if !defined(_WIN32) typedef struct wh_tls wh_tls; /* Takes ownership of `fd` on success (closed by wh_tls_close) and on failure. * `hostname` is used for SNI and certificate verification. NULL + err on * failure. */ wh_tls *wh_tls_connect_fd(int fd, const char *hostname, char *err, size_t errsz); /* bytes read, 0 at EOF, -1 on error. */ int wh_tls_read(wh_tls *t, char *buf, size_t n); /* bytes written, -1 on error. */ int wh_tls_write(wh_tls *t, const char *buf, size_t n); void wh_tls_close(wh_tls *t); #endif /* !_WIN32 */ #endif /* SX_WH_TLS_H */