2020-03-26 19:04:51 +01:00
|
|
|
|
using System.Collections.Generic;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using System.Linq;
|
2020-03-26 19:04:51 +01:00
|
|
|
|
using MediatR;
|
|
|
|
|
using ModernKeePass.Application.Common.Interfaces;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using ModernKeePass.Application.Parameters.Models;
|
2020-03-26 19:04:51 +01:00
|
|
|
|
|
2020-03-30 19:43:04 +02:00
|
|
|
|
namespace ModernKeePass.Application.Parameters.Queries.GetKeyDerivations
|
2020-03-26 19:04:51 +01:00
|
|
|
|
{
|
|
|
|
|
public class GetKeyDerivationsQuery : IRequest<IEnumerable<KeyDerivationVm>>
|
|
|
|
|
{
|
|
|
|
|
public class GetKeyDerivationsQueryHandler : IRequestHandler<GetKeyDerivationsQuery, IEnumerable<KeyDerivationVm>>
|
|
|
|
|
{
|
|
|
|
|
private readonly ICryptographyClient _cryptography;
|
|
|
|
|
|
2020-03-30 19:43:04 +02:00
|
|
|
|
public GetKeyDerivationsQueryHandler(ICryptographyClient cryptography)
|
2020-03-26 19:04:51 +01:00
|
|
|
|
{
|
|
|
|
|
_cryptography = cryptography;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEnumerable<KeyDerivationVm> Handle(GetKeyDerivationsQuery message)
|
|
|
|
|
{
|
2020-03-30 19:43:04 +02:00
|
|
|
|
return _cryptography.KeyDerivations.Select(c => new KeyDerivationVm
|
|
|
|
|
{
|
|
|
|
|
Id = c.Id,
|
|
|
|
|
Name = c.Name
|
|
|
|
|
});
|
2020-03-26 19:04:51 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|