WIP Split composite key user control

Some refactoring
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-20 20:02:43 +02:00
parent 73670e8689
commit 310bd777b2
54 changed files with 849 additions and 1200 deletions

View File

@@ -10,7 +10,6 @@ namespace ModernKeePass.Infrastructure.KeePass
{
public EntryMappingProfile()
{
Uri url;
CreateMap<PwEntry, EntryEntity>()
.ForMember(dest => dest.ParentId, opt => opt.MapFrom(src => src.ParentGroup.Uuid.ToHexString()))
.ForMember(dest => dest.ParentName, opt => opt.MapFrom(src => src.ParentGroup.Name))
@@ -18,12 +17,7 @@ namespace ModernKeePass.Infrastructure.KeePass
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.TitleField)))
.ForMember(dest => dest.UserName, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.UserNameField)))
.ForMember(dest => dest.Password, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.PasswordField)))
.ForMember(dest => dest.Url, opt =>
{
opt.PreCondition(src =>
Uri.TryCreate(GetEntryValue(src, PwDefs.UrlField), UriKind.Absolute, out url));
opt.MapFrom(src => new Uri(GetEntryValue(src, PwDefs.UrlField)));
})
.ForMember(dest => dest.Url, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.UrlField)))
.ForMember(dest => dest.Notes, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.NotesField)))
.ForMember(dest => dest.ForegroundColor, opt => opt.MapFrom(src => src.ForegroundColor))
.ForMember(dest => dest.BackgroundColor, opt => opt.MapFrom(src => src.BackgroundColor))

View File

@@ -7,7 +7,7 @@ using ModernKeePassLib.Security;
namespace ModernKeePass.Infrastructure.KeePass
{
public class KeePassPasswordClient: IPasswordProxy
public class KeePassCredentialsClient: ICredentialsProxy
{
public string GeneratePassword(PasswordGenerationOptions options)
{
@@ -35,9 +35,9 @@ namespace ModernKeePass.Infrastructure.KeePass
return password.ReadString();
}
public uint EstimatePasswordComplexity(string password)
public int EstimatePasswordComplexity(string password)
{
return QualityEstimation.EstimatePasswordBits(password?.ToCharArray());
return (int)QualityEstimation.EstimatePasswordBits(password?.ToCharArray());
}
public byte[] GenerateKeyFile(byte[] additionalEntropy)