Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/adetokunbo/test-certs

A haskell package to generate tempororary SSL certificates for use in tests
https://github.com/adetokunbo/test-certs

haskell testing-library tls-certificate

Last synced: about 1 month ago
JSON representation

A haskell package to generate tempororary SSL certificates for use in tests

Awesome Lists containing this project

README

        

# test-certs

[![GitHub CI](https://github.com/adetokunbo/test-certs/actions/workflows/nix-ci.yml/badge.svg)](https://github.com/adetokunbo/test-certs/actions)
[![Stackage Nightly](http://stackage.org/package/test-certs/badge/nightly)](http://stackage.org/nightly/package/test-certs)
[![Hackage][hackage-badge]][hackage]
[![Hackage Dependencies][hackage-deps-badge]][hackage-deps]
[![BSD3](https://img.shields.io/badge/license-BSD3-green.svg?dummy)](https://github.com/adetokunbo/test-certs/blob/master/LICENSE)

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

## Example (wai/warp-tls)

```haskell
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

```

[hackage-deps-badge]:
[hackage-deps]:
[hackage-badge]:
[hackage]:
[HSOpenSSL]:
[warp-tls]: