Correct package version installed

Dependency injection works
Project renaming
WIP replacement of services with CQRS
This commit is contained in:
Geoffroy BONNEVILLE
2020-03-24 17:31:34 +01:00
parent ba8bbe045b
commit f208e2d0b6
34 changed files with 310 additions and 124 deletions

View File

@@ -17,6 +17,7 @@ namespace ModernKeePass.Infrastructure.KeePass
private void FromDtoToModel()
{
Uri url;
CreateMap<PwEntry, EntryEntity>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Uuid.ToHexString()))
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.TitleField)))
@@ -24,7 +25,7 @@ namespace ModernKeePass.Infrastructure.KeePass
.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 _));
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.Notes, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.NotesField)))

View File

@@ -26,6 +26,7 @@ namespace ModernKeePass.Infrastructure.KeePass
private CompositeKey _compositeKey;
public bool IsOpen => (_pwDatabase?.IsOpen).GetValueOrDefault();
public string Name => _pwDatabase?.Name;
public GroupEntity RecycleBin { get; set; }
@@ -40,7 +41,7 @@ namespace ModernKeePass.Infrastructure.KeePass
Name = cipher.DisplayName
};
}
set => _pwDatabase.DataCipherUuid = BuildIdFromString(value.Id);
set { _pwDatabase.DataCipherUuid = BuildIdFromString(value.Id); }
}
public BaseEntity KeyDerivation
@@ -53,15 +54,18 @@ namespace ModernKeePass.Infrastructure.KeePass
Id = keyDerivation.Uuid.ToHexString(),
Name = keyDerivation.Name
};
}
set => _pwDatabase.KdfParameters = KdfPool.Engines
.FirstOrDefault(e => e.Uuid.Equals(BuildIdFromString(value.Name)))?.GetDefaultParameters();
}
set
{
_pwDatabase.KdfParameters = KdfPool.Engines
.FirstOrDefault(e => e.Uuid.Equals(BuildIdFromString(value.Name)))?.GetDefaultParameters();
}
}
public string Compression
{
get => _pwDatabase.Compression.ToString("G");
set => _pwDatabase.Compression = (PwCompressionAlgorithm)Enum.Parse(typeof(PwCompressionAlgorithm), value);
get { return _pwDatabase.Compression.ToString("G"); }
set { _pwDatabase.Compression = (PwCompressionAlgorithm) Enum.Parse(typeof(PwCompressionAlgorithm), value); }
}
public KeePassDatabaseClient(ISettingsProxy settings, IFileProxy fileService, IMapper mapper)

View File

@@ -3,6 +3,7 @@ using ModernKeePass.Domain.Dtos;
using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Cryptography.PasswordGenerator;
using ModernKeePassLib.Keys;
using ModernKeePassLib.Security;
namespace ModernKeePass.Infrastructure.KeePass
{
@@ -28,7 +29,8 @@ namespace ModernKeePass.Infrastructure.KeePass
pwProfile.CharSet.Add(options.CustomChars);
PwGenerator.Generate(out var password, pwProfile, null, new CustomPwGeneratorPool());
ProtectedString password;
PwGenerator.Generate(out password, pwProfile, null, new CustomPwGeneratorPool());
return password.ReadString();
}