getExpiredByDomain method

  1. @override
Future<String> getExpiredByDomain(
  1. String domain
)
override

Implementation

@override
Future<String> getExpiredByDomain(String domain) async {
  final p = await Process.run('bash', [
    '-c',
    'openssl s_client -servername $domain -connect $domain:443 2>/dev/null | openssl x509 -noout -dates',
  ]);
  String notAfterStr = '';
  if (p.exitCode == 0) {
    notAfterStr = p.stdout.toString();
    if (notAfterStr.startsWith('notAfter=')) {
      notAfterStr = notAfterStr.substring('notAfter='.length);
    }
  }
  return notAfterStr.replaceAll('\n', '');
}