@@ -51,18 +51,15 @@ const getCANotAfter = (notBefore: any) => {
5151// Function to check if a certificate file has expired
5252export const isCertificateExpired = async ( certFilePath : string ) : Promise < boolean > => {
5353 return new Promise ( ( resolve , reject ) => {
54-
5554 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+
6160 // Read the certificate file
6261 const certData = fs . readFileSync ( certFilePath , 'utf8' )
6362
64-
65-
6663 // check if cert exists
6764 if ( ! certData ) {
6865 reject ( 'Certificate not found' )
@@ -77,7 +74,6 @@ export const isCertificateExpired = async (certFilePath: string): Promise<boolea
7774 const isExpired = expiryDate < new Date ( )
7875
7976 resolve ( isExpired )
80-
8177 } catch ( error ) {
8278 // Handle errors
8379 console . error ( `Error checking certificate expiry: ${ error } ` )
@@ -91,9 +87,7 @@ export const isDomainExists = async (domainToCheck: string, certificatePath: str
9187 // Read the certificate file
9288 const certificateContents = fs . readFileSync ( certificatePath , 'utf8' )
9389
94-
95- if ( ! certificateContents ) {
96-
90+ if ( ! certificateContents ) {
9791 throw new Error ( 'Certificate not found' )
9892 }
9993
0 commit comments