Update IMasterKeyService
Use an explicit property instead of a method for CheckConfig
This commit is contained in:
@@ -9,8 +9,7 @@ namespace Akari.Prototype.Server.Services
|
||||
public interface IMasterKeyService
|
||||
{
|
||||
public bool IsLoggedIn { get; }
|
||||
|
||||
public bool CheckConfig();
|
||||
public bool IsPasswordSet { get; }
|
||||
|
||||
public bool Login(string password);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Akari.Prototype.Server.Services
|
||||
public const int MasterKeyLength = 256 / 8;
|
||||
|
||||
public bool IsLoggedIn => _key is not null;
|
||||
public bool IsPasswordSet => File.Exists(_akariPath.GetPath(ConfigPath));
|
||||
|
||||
private readonly ILogger<MasterKeyService> _logger;
|
||||
private readonly AkariPath _akariPath;
|
||||
@@ -33,8 +34,6 @@ namespace Akari.Prototype.Server.Services
|
||||
_akariPath = akariPath;
|
||||
}
|
||||
|
||||
public bool CheckConfig() => File.Exists(_akariPath.GetPath(ConfigPath));
|
||||
|
||||
public bool Login(string password)
|
||||
{
|
||||
if (_key is not null)
|
||||
@@ -81,7 +80,7 @@ namespace Akari.Prototype.Server.Services
|
||||
|
||||
public bool CreatePassword(string password)
|
||||
{
|
||||
if (CheckConfig())
|
||||
if (IsPasswordSet)
|
||||
{
|
||||
_logger.LogDebug("Tried to create password but it's already set.");
|
||||
|
||||
@@ -103,7 +102,7 @@ namespace Akari.Prototype.Server.Services
|
||||
|
||||
private bool LoadConfig()
|
||||
{
|
||||
if (!CheckConfig())
|
||||
if (!IsPasswordSet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user