mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
WIP Clean Architecture
Windows 8.1 App Uses keepasslib v2.44 (temporarily)
This commit is contained in:
35
ModernKeePass.Application/Services/SecurityService.cs
Normal file
35
ModernKeePass.Application/Services/SecurityService.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Threading.Tasks;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
|
||||
namespace ModernKeePass.Application.Services
|
||||
{
|
||||
public class SecurityService: ISecurityService
|
||||
{
|
||||
private readonly IPasswordProxy _passwordProxy;
|
||||
private readonly IFileService _fileService;
|
||||
|
||||
public SecurityService(IPasswordProxy passwordProxy, IFileService fileService)
|
||||
{
|
||||
_passwordProxy = passwordProxy;
|
||||
_fileService = fileService;
|
||||
}
|
||||
|
||||
public string GeneratePassword(PasswordGenerationOptions options)
|
||||
{
|
||||
return _passwordProxy.GeneratePassword(options);
|
||||
}
|
||||
|
||||
public uint EstimatePasswordComplexity(string password)
|
||||
{
|
||||
return _passwordProxy.EstimatePasswordComplexity(password);
|
||||
}
|
||||
|
||||
public async Task GenerateKeyFile(string filePath)
|
||||
{
|
||||
var fileContents = _passwordProxy.GenerateKeyFile(null);
|
||||
await _fileService.WriteBinaryContentsToFile(filePath, fileContents);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user