ohttp

ohttp implements Oblivious HTTP (RFC 9458) in OCaml: a client encapsulates a request for a gateway and sends it through a relay, so that the relay learns who is asking and the gateway what is asked, and neither learns both. It builds on the hpke package for RFC 9180, and on bhttp for the messages that it carries.

The library is unaudited and not production-ready. It is intended for interoperability review.

Application entry points

The library performs no I/O. An encapsulated message is a string that any HTTP library can post, and everything else is a function from strings to strings.

A client reads the gateway's key configurations with Ohttp.Key_config.decode_list, picks one with Ohttp.Key_config.select_from_list, and encapsulates a request with Ohttp.Http_message.encapsulate_request. It posts the result to the relay with Ohttp.Http_binding.Client.request_headers, checks the answer with Ohttp.Http_binding.Client.check_response, and opens it with Ohttp.Http_message.decapsulate_response.

A gateway holds Ohttp.Gateway.Key values in a Ohttp.Gateway.t, serves Ohttp.Gateway.encoded_key_configs, and answers a request with Ohttp.Http_message.decapsulate_request, Ohttp.Http_message.encapsulate_response, and, when the encapsulation cannot be removed, Ohttp.Http_binding.Gateway.error_response. A gateway that serves requests that are not idempotent also checks each one with Ohttp.Replay.check.

Ohttp.Service puts these steps together for each party, as functions from the HTTP message that a client, a relay, or a gateway receives to the one that it sends. The adapter packages ohttp-cohttp-lwt, ohttp-cohttp-eio, and ohttp-piaf wrap it for their HTTP libraries.

Ohttp.Client and Ohttp.Gateway do the same for byte strings that are not Binary HTTP. Ohttp.Chunked is an experimental implementation of chunked Oblivious HTTP (draft-ietf-ohai-chunked-ohttp-08), and its interface may change.

Modules

Application interface

Protocol internals

Guides

These guides are also installed as Markdown under the package's documentation directory.

Security

See the repository's security policy for what the library checks, what it leaves to applications, its known limitations, and private vulnerability reporting.