diff --git a/Akari.Prototype.Server/Services/IMasterKeyService.cs b/Akari.Prototype.Server/Services/IMasterKeyService.cs index e80d255..7b562c1 100644 --- a/Akari.Prototype.Server/Services/IMasterKeyService.cs +++ b/Akari.Prototype.Server/Services/IMasterKeyService.cs @@ -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); diff --git a/Akari.Prototype.Server/Services/MasterKeyService.cs b/Akari.Prototype.Server/Services/MasterKeyService.cs index c03a04e..765c7a5 100644 --- a/Akari.Prototype.Server/Services/MasterKeyService.cs +++ b/Akari.Prototype.Server/Services/MasterKeyService.cs @@ -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 _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; }