Fix: Make sure in use private keys are not deleted

This commit is contained in:
peaklabs-dev 2024-09-17 14:32:44 +02:00
parent 2ec66fd146
commit 6a6b947fba
No known key found for this signature in database

View file

@ -144,6 +144,10 @@ public function storeInFileSystem()
public static function deleteFromStorage(self $privateKey)
{
if ($privateKey->isInUse()) {
throw new \Exception('Cannot delete a private key that is in use.');
}
$filename = "ssh@{$privateKey->uuid}";
Storage::disk('ssh-keys')->delete($filename);
}