Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/adetokunbo/test-certs
- Owner: adetokunbo
- License: other
- Created: 2024-03-21T01:53:08.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-07-10T08:13:05.000Z (4 months ago)
- Last Synced: 2024-09-14T08:40:07.774Z (2 months ago)
- Topics: haskell, testing-library, tls-certificate
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/test-certs
- Size: 44.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
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]: