@@ -50,21 +50,30 @@ public function handle(): int
5050
5151            $ buildData$ responsejson ();
5252
53-             if  (! isset ($ buildData'download_url ' ])) {
53+             if  (! isset ($ buildData'data '  ][ ' download_url '
5454                $ this error ('Bundle download URL not found in response. ' );
5555
5656                return  static ::FAILURE ;
5757            }
5858
59-             $ this displayBundleInfo ($ buildData
59+             $ this displayBundleInfo ($ buildData[ ' data ' ] );
6060
6161            $ bundlePath$ this prepareBundlePath ();
6262
63-             if  (! $ this downloadBundle ($ buildData'download_url ' ], $ bundlePath
63+             if  (! $ this downloadBundle ($ buildData'data '  ][ ' download_url '$ bundlePath
6464                return  static ::FAILURE ;
6565            }
6666
67-             $ this displaySuccessInfo ($ bundlePath
67+             // Download GPG signature if available 
68+             $ signaturePathnull ;
69+             if  (isset ($ buildData'data ' ]['signature_url ' ])) {
70+                 $ signaturePath$ bundlePath'.asc ' ;
71+                 if  (! $ this downloadSignature ($ buildData'data ' ]['signature_url ' ], $ signaturePath
72+                     $ this warn ('Failed to download GPG signature file. ' );
73+                 }
74+             }
75+ 
76+             $ this displaySuccessInfo ($ bundlePath$ signaturePath
6877
6978            return  static ::SUCCESS ;
7079        } catch  (Exception $ e
@@ -143,7 +152,27 @@ private function cleanupFailedDownload(string $bundlePath): void
143152        }
144153    }
145154
146-     private  function  displaySuccessInfo (string  $ bundlePathvoid 
155+     private  function  downloadSignature (string  $ signatureUrlstring  $ signaturePathbool 
156+     {
157+         $ this line ('' );
158+         $ this info ('Downloading GPG signature... ' );
159+ 
160+         try  {
161+             $ downloadResponseget ($ signatureUrl
162+ 
163+             if  ($ downloadResponsefailed ()) {
164+                 return  false ;
165+             }
166+ 
167+             file_put_contents ($ signaturePath$ downloadResponsebody ());
168+ 
169+             return  true ;
170+         } catch  (Exception $ e
171+             return  false ;
172+         }
173+     }
174+ 
175+     private  function  displaySuccessInfo (string  $ bundlePathstring  $ signaturePathnull ): void 
147176    {
148177        $ this line ('' );
149178        $ this info ('Bundle downloaded successfully! ' );
@@ -153,6 +182,13 @@ private function displaySuccessInfo(string $bundlePath): void
153182            $ sizeInMBnumber_format (filesize ($ bundlePath1024  / 1024 , 2 );
154183            $ this line ("Size:  {$ sizeInMB MB " );
155184        }
185+ 
186+         if  ($ signaturePathfile_exists ($ signaturePath
187+             $ this line ('GPG Signature:  ' .$ signaturePath
188+             $ this line ('' );
189+             $ this info ('To verify the bundle integrity: ' );
190+             $ this line ('gpg --verify  ' .basename ($ signaturePath'  ' .basename ($ bundlePath
191+         }
156192    }
157193
158194    private  function  handleApiError ($ responsevoid 
0 commit comments