ReloadableFileTls class

A TlsProvider backed by certificate/key files that are reloaded when their contents change on disk — for externally-managed certificates (a cert-manager, certbot, a mounted secret) without restarting the hub.

maybeRenew re-reads both files and byte-compares them against the loaded material; on any content change it rebuilds the SecurityContext and returns true, so the hub's renewTls() gap-free rebind swaps the listener to the new certificate. Byte comparison (not mtime) means a same-size rotation is detected, and a partial write that fails to parse leaves the previous certificate in place. There is no ACME/challenge involvement — use LetsEncryptTls for that.

Implemented types

Constructors

ReloadableFileTls.directory(String directory, {String certName = 'fullchain.pem', String keyName = 'privkey.pem', String? password})
Loads from a directory containing certName/keyName (defaults match the common fullchain.pem/privkey.pem layout).
factory
ReloadableFileTls.files(String certificate, String privateKey, {String? password})
Loads from the certificate chain file certificate and key file privateKey.
factory

Properties

certificatePath String
The certificate chain file path.
final
challengeMiddleware Middleware?
A middleware that answers ACME HTTP-01 challenges, mounted first in the pipeline of the plaintext transport. null for providers that need no challenge handling (e.g. StaticTls).
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hotReloadable bool
Whether the securityContext may change at runtime (ACME renewal), in which case the hub rebinds the HTTPS transport after maybeRenew reports a refresh.
no setteroverride
password String?
The private key password, if any.
final
privateKeyPath String
The private key file path.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

maybeRenew() Future<bool>
Renews certificates if they are near expiry. Returns true if the securityContext changed and the listener should be rebound. A no-op (returning false) for static providers.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
provision() Future<void>
Ensures certificates exist, provisioning them if necessary. A no-op for static providers.
override
securityContext() SecurityContext
The current SecurityContext to bind the listener with.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited