Fix IKeyManager
Now correctly delete key folder while avoiding issues
This commit is contained in:
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using Akari.Prototype.Server.Models;
|
||||
using Akari.Prototype.Server.Utils;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -58,12 +59,19 @@ namespace Akari.Prototype.Server.Services
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Clear(string applicationName)
|
||||
public void Clear(Application application)
|
||||
{
|
||||
_logger.LogDebug($"Deleted keys for {applicationName}");
|
||||
// Do it safely to avoid deleting unwanted files
|
||||
File.Delete(GetMasterKeyPath(application.Name));
|
||||
|
||||
_logger.LogDebug($"Going to delete {GetKeyDirectoryPath(applicationName)}");
|
||||
//Directory.Delete(GetKeyDirectoryPath(applicationName));
|
||||
foreach (var fingerprint in application.Fingerprints)
|
||||
{
|
||||
File.Delete(GetKeyPath(application.Name, fingerprint));
|
||||
}
|
||||
|
||||
Directory.Delete(GetKeyDirectoryPath(application.Name), recursive: false);
|
||||
|
||||
_logger.LogDebug($"Deleted keys for {application.Name}");
|
||||
}
|
||||
|
||||
public bool Create(string applicationName)
|
||||
|
||||
Reference in New Issue
Block a user