@@ -51,18 +51,15 @@ const getCANotAfter = (notBefore: any) => {
51
51
// Function to check if a certificate file has expired
52
52
export const isCertificateExpired = async ( certFilePath : string ) : Promise < boolean > => {
53
53
return new Promise ( ( resolve , reject ) => {
54
-
55
54
try {
56
- // Check if the file exists
57
- if ( ! fs . existsSync ( certFilePath ) ) {
58
- reject ( 'Certificate not found' )
59
- }
60
-
55
+ // Check if the file exists
56
+ if ( ! fs . existsSync ( certFilePath ) ) {
57
+ reject ( 'Certificate not found' )
58
+ }
59
+
61
60
// Read the certificate file
62
61
const certData = fs . readFileSync ( certFilePath , 'utf8' )
63
62
64
-
65
-
66
63
// check if cert exists
67
64
if ( ! certData ) {
68
65
reject ( 'Certificate not found' )
@@ -77,7 +74,6 @@ export const isCertificateExpired = async (certFilePath: string): Promise<boolea
77
74
const isExpired = expiryDate < new Date ( )
78
75
79
76
resolve ( isExpired )
80
-
81
77
} catch ( error ) {
82
78
// Handle errors
83
79
console . error ( `Error checking certificate expiry: ${ error } ` )
@@ -91,9 +87,7 @@ export const isDomainExists = async (domainToCheck: string, certificatePath: str
91
87
// Read the certificate file
92
88
const certificateContents = fs . readFileSync ( certificatePath , 'utf8' )
93
89
94
-
95
- if ( ! certificateContents ) {
96
-
90
+ if ( ! certificateContents ) {
97
91
throw new Error ( 'Certificate not found' )
98
92
}
99
93
0 commit comments