gleam-lang / gleam-lang/httpc

Add client certificate (mTLS) support to Configuration

Open
#54 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Gleam
Stars
175
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Some HTTP APIs require mutual TLS (mTLS) for authentication, where the client presents a certificate and private key during the TLS handshake. This is the equivalent of curl's `--cert` and `--key` flags:

```bash
$ curl -X GET https://api.example.com/resource \
--cert certificate.pem \
--key private_key.pem
```

Currently, `Configuration` only exposes `verify_tls`, `timeout`, and `follow_redirects`. There is no way to pass a client certificate and key to the underlying Erlang `ssl` module.

One approach would be individual builder functions on `Configuration`, consistent with the existing style:

```gleam
httpc.configure()
|> httpc.client_certificate(certfile: "certificate.pem", keyfile: "private_key.pem")
|> httpc.dispatch(request)
```

Would you consider this as a valid feature request?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.