Okay, how bad can getting client HTTPS to work be really?

This article is part of a series.

My chosen deployment method for the server part of my Swift-IoT-Hello project, a Digital Ocean App Server, ONLY does HTTPS connections. Meanwhile my client can only handle HTTP.

I could get around this a few ways. Many of them versions of:

Those types of solutions push the complexity into the project’s architecture in a way that might make it difficult for a student or beginner to spin up. IF I can get HTTPS working the complexity will feel more invisible, perhaps.

So that leaves trying spending at least some time to trying to get HTTPS to work.

For some chips HTTPS would be too much math and too much storage space, but the ESP32-C6 should be able to do it. At this stage, most things that can run Embedded Swift at all can probably do it.

So what does that look like? Here’s my initial todo list and some of resources I’ll need to get it done.

TODO:

Watch Some Videos

For instruction and reference I prefer written articles, but for orienting myself to a space I like video.

Before creating an implementation I want refresh my memory / understand current best practices on the TLS handshake which distinguishes HTTPS from HTTP.

Here are some videos that help clarify the problems involved. The first one a lone is enough for the already conversant. It’s both specific to the exact topic and an overview. At the end is an “off-topic” but interesting discussion of Rust and Zephyr.

A couple little text items to add because not a lot of decent video on it 1.2 vs 1.3:

Do a couple of hello worlds on the chips I’ll use

The espidf and the pico sdk both have https client examples that I’ll get rolling just to make sure there aren’t hardware/tool chain problems waiting to bite me.

Study SwiftNIO

I’d like the API for my library to feel similar to how swift-nio-ssl works if the ergonomics are right for embedded. This assumes I’ll even get to that level of control for it. Which I probably won’t.

NOTE: An example Swift based HTTP->HTTPS proxy exits in the SwiftNIO examples repo if I decide to fall back from this problem.

Look at my (and other’s) Swift HTTP clients

This might be a good moment to revisit the actual client ergonomics.

Look at some API packages / type-only packages

Swift Log, Swift Metrics, Swift Distributed Tracing, Swift Configure all are API definition and/or types only packages. I’d like my client to work similarly. I should spend some time looking at how these get laid out and used.

Choose a base framework

So BoringSSL, which swift-nio-ssl uses, isn’t a great fit for embedded.

I’ve got to say that mbed-tls is winning just because I know that espressif, pico and zephyr all use it. If I push the implementation down low enough then it doesn’t matter as much what future implementers want to use. Here are some links, but I think I’m already pretty focused on mbed-tls.

Summary

This is just an orientation post. In the next couple I’ll get the hello worlds working without Swift, as a base goal. If it’s easy… I’ll do more!

This article is part of a series.