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: 3 months 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-20T06:07:32.000Z (5 months ago)
- Last Synced: 2025-02-11T04:32:42.387Z (4 months ago)
- Topics: haskell, testing-library, tls-certificate
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/test-certs
- Size: 48.8 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
[](https://github.com/adetokunbo/test-certs/actions)
[](http://stackage.org/nightly/package/test-certs)
[![Hackage][hackage-badge]][hackage]
[![Hackage Dependencies][hackage-deps-badge]][hackage-deps]
[](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]: