getFingerprintList method
Implementation
@override
Future<List<String>> getFingerprintList({
String? domain,
required String filepath,
}) async {
final fingerprints = <String>[];
List<String> certificatesList = [];
if (domain != null) {
await getCertificateByDomain(domain, filepath);
}
certificatesList = await parseToList(filepath);
for (final cert in certificatesList) {
final x509RootCert = X509Utils.x509CertificateFromPem(cert);
final fingerprint = x509RootCert.sha256Thumbprint?.toLowerCase();
if (fingerprint != null) {
fingerprints.add(fingerprint);
}
}
String fingerprint = '';
if (domain != null) {
fingerprint = await getFingerprintByDomain(domain);
final expiredAt = await getExpiredByDomain(domain);
print('ExpiredAt: $expiredAt');
} else {
fingerprint = await getFingerprintByFile(filepath);
final expiredAt = await getExpiredByFile(filepath);
print('ExpiredAt: $expiredAt');
}
// Append when fingerprint is not exist
if (!fingerprints.contains(fingerprint)) {
fingerprints.add(fingerprint);
}
return fingerprints;
}