test-certs provides functions that generate temporary SSL certificates for tests.
Its functions generate the certificates as files in a temporary directory
Note: this package depends on HsOpenSSL. It expects the openssl system libraries to be available on your system; this is usually the case on most modern linux distributions.
It's intended for use with warp-tls or similar packages
import Test.Certs.Temp (certificatePath, keyPath, withCertPathsInTmp')
import Network.Wai (Application) -- from package: wai
import Network.Wai.Handler.Warp (Settings) -- from package: warp
import Network.Wai.Handler.WarpTLS (runTLS, tlsSettings) -- from package: warp-tls
-- | Like 'runTLS', but with temporary certificates generated by test-certs
runTLS' :: Settings -> Application -> IO ()
runTLS' appSettings app = withCertPathsInTmp' $ \cp -> do
let tls = tlsSettings (certificatePath cp) (keyPath cp)
runTLS tls appSettings app