parse static method
When certs exist we get
Implementation
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Found the following certs:
// Certificate Name: slayer.squarephone.biz
// Domains: slayer.squarephone.biz
// Expiry Date: 2020-10-27 06:10:05+00:00 (INVALID: TEST_CERT)
// Certificate Path: /etc/letsencrypt/config/live/slayer.squarephone.biz/fullchain.pem
// Private Key Path: /etc/letsencrypt/config/live/slayer.squarephone.biz/privkey.pem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// when no certificates found.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// No certs found.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static List<Certificate> parse(List<String> lines) {
final certificates = <Certificate>[];
Certificate? cert;
for (final line in lines) {
if (line.trim().startsWith('Certificate Name:')) {
cert = Certificate();
certificates.add(cert);
cert.parseName(line);
}
if (line.trim().startsWith('Domains:')) {
cert!.parseDomains(line);
}
if (line.trim().startsWith('Expiry Date:')) {
cert!.parseExpiryDate(line);
}
if (line.trim().startsWith('Certificate Path')) {
cert!.parseCertificatePath(line);
}
if (line.trim().startsWith('Private Key Path:')) {
cert!.parsePrivateKeyPath(line);
}
}
return certificates;
}