pytest-localserver icon indicating copy to clipboard operation
pytest-localserver copied to clipboard

Evaluate using the trustme package to generate a certificate

Open diazona opened this issue 1 year ago • 1 comments

In a conversation on Mastodon I found out about the trustme package which generates SSL certificates from a temporary local CA. This seems like a good addition to pytest-localserver, better than hardcoding a certificate (because it'd be more clear about what it's doing).

diazona avatar Apr 03 '24 08:04 diazona

Just a progress report/note for myself... I've been playing around with this for a while, and it's rather difficult to make usage of trustme fit in to the existing interface where the SecureContentServer has certificate and key properties that return filenames. trustme certificates don't necessarily exist in a file at all, except for the brief moments you specifically ask them to. So I think this will be a good opportunity to redesign the API somewhat, perhaps to make SecureContentServer act like trustme.Blob: instead of providing certificate and key files directly, it'll have a tempfile() method (or something along those lines) that returns a context manager which writes the cert/key to a temporary file, and also something akin to write_to_path() which writes the cert/key to a path provided by the caller. That can be one of the notable features of the 1.0 release.

diazona avatar Oct 22 '25 08:10 diazona