LetsEncrypt class
Let's Encrypt certificate tool.
Constructors
- LetsEncrypt(CertificatesHandler certificatesHandler, {bool production = false, void log(String level, Object? message, Object? error, StackTrace? stackTrace)?})
Properties
- apiBaseURL → String
-
Returns the Let's Encrypt API base URL in use.
no setter
- certificatesHandler → CertificatesHandler
-
The certificate handler to use.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- log → (void Function(String level, Object? message, Object? error, StackTrace? stackTrace)?)
-
final
- minCertificateValidityTime ↔ Duration
-
The minimal accepted HTTPS certificate validity time
when checking the current certificate validity. Default: 5 days
getter/setter pair
- production → bool
-
If
true
uses production API.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
badCertificateCallback(
X509Certificate cert, String host, int port) → bool -
Handles a bad certificate triggered by HttpClient.
Should return
true
to accept a bad certificate (like a self-signed). -
checkCertificate(
String domain, String email, {bool requestCertificate = false, bool forceRequestCertificate = false, int maxRetries = 3, Duration? retryInterval}) → Future< CheckCertificateStatus> -
Checks the
domain
certificate. -
doACMEChallenge(
String cn, List< String> contacts, String accountPrivateKeyPem, String accountPublicKeyPem, String domainCSR) → Future<List< String> > -
Performs an
ACME
challenge. Default toHTTP-1
. -
getChallengeToken(
String cn) → String? -
Returns a challenge toke for
cn
(if one is being executed). -
getURL(
Uri url, {Duration? minCertificateValidityTime, bool checkCertificate = true, bool log = true}) → Future< String?> -
Performs a HTTP request for
url
. Returns aString
with the body if OK. -
isDomainHttpsOK(
String domain, {int maxRetries = 3, Duration? retryInterval}) → Future< bool> -
Returns true if
domain
HTTPS is OK. -
isUrlOK(
Uri url, {Duration? minCertificateValidityTime}) → Future< bool> -
Returns
true
if theurl
is OK (performs a request). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
printToConsole(
Object? o) → void -
processACMEChallengeRequest(
Request request) → Response -
A helper method to process an ACME
shelf
Request
. -
processSelfCheckRequest(
Request request) → Response -
A helper method to process a self check
Request
. -
requestCertificate(
String domain, String email) → Future< bool> -
Request a certificate for
domain
using anACME
client. -
startSecureServer(
Handler handler, Map< String, String> domainsAndEmails, {int port = 80, int securePort = 443, dynamic bindingAddress = '0.0.0.0', int? backlog, bool checkCertificate = true, bool requestCertificate = true, bool forceRequestCertificate = false, bool loadAllHandledDomains = false}) → Future<List< HttpServer> > -
Starts 2 HttpServer instances, one HTTP at
port
and other HTTPS atsecurePort
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isACMEPath(
String path) → bool -
Returns
true
ifpath
is anACME
request path. -
isSelfCheckPath(
String path) → bool -
Returns
true
ifpath
is a self check path. -
isWellKnownPath(
String path) → bool -
Returns
true
ifpath
starts with/.well-known/
. -
isWellknownPath(
String path) → bool