mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-24 04:37:58 +00:00
…eing loaded Fix certificate check and make sure all code paths throw an error. ### Motivation: TimedCertificateReloader currently has an invalid check that accidecanlly enforces self-signed certificates. Additionally some code paths of `reload()` did not throw an error which made it hard for the call site to judge if the reloader was initialized successfully or not. Further, the missing errors also meant that the `run()` method would never be able to log these. ### Modifications: * Updated the certificate check to validate the the public key of the private key matches the cert's public key (instead of checking the signature). * Added three new error cases. ### Result: * A caller can now be sure that their certificate and private key pair are valid after calling `reload()` the first time. * Errors in future reloads will be surfaced using the provided logger and do not go unnoticed. * You can actually use the reloader with normal certificates.