mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Compare commits
377 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7b88461333 | ||
![]() |
8de493f987 | ||
![]() |
e5353478f4 | ||
![]() |
1b981b00d5 | ||
![]() |
d2814c6c67 | ||
![]() |
9fdc727787 | ||
![]() |
14cd3ab57a | ||
![]() |
d6529646a8 | ||
![]() |
7917a8b388 | ||
![]() |
b8e1bbd9d7 | ||
![]() |
f158e5aced | ||
![]() |
8e06bf4bb0 | ||
![]() |
59ab43ca9c | ||
![]() |
7778e45deb | ||
![]() |
df973c5f62 | ||
![]() |
3967db41b3 | ||
![]() |
eacb3b182e | ||
![]() |
d211453553 | ||
![]() |
2b8f9bd5f0 | ||
![]() |
722790e5e4 | ||
![]() |
a9ed588c9a | ||
![]() |
61f5e9df0b | ||
![]() |
a7da427ded | ||
![]() |
a88051bc0c | ||
![]() |
1df9cbce1c | ||
![]() |
0b19d8d50a | ||
![]() |
004f1a35a8 | ||
![]() |
ac66faa9e2 | ||
![]() |
c81f8bc835 | ||
![]() |
a1085b6010 | ||
![]() |
75f6e2f840 | ||
![]() |
310bd777b2 | ||
![]() |
73670e8689 | ||
![]() |
2fb5b14085 | ||
![]() |
f950564000 | ||
![]() |
9befdc321a | ||
![]() |
98ac418f62 | ||
![]() |
0063ef1977 | ||
![]() |
b66e79f97c | ||
![]() |
9603c1ff01 | ||
![]() |
3def21bc7d | ||
![]() |
a2eba91a3b | ||
![]() |
d972b6cb5a | ||
![]() |
14fd4634db | ||
![]() |
752e96884d | ||
![]() |
1046110dd2 | ||
![]() |
d1047a92ba | ||
![]() |
009382ea03 | ||
![]() |
4863eb9fae | ||
![]() |
1fa799bdf8 | ||
![]() |
56d93a5187 | ||
![]() |
e795a8c3c4 | ||
![]() |
b875f3c89d | ||
![]() |
36aa8914fa | ||
![]() |
b61a9652d1 | ||
![]() |
57be6bb917 | ||
![]() |
90c592d7ee | ||
![]() |
e4bd788ed3 | ||
![]() |
d1ba73ee9d | ||
![]() |
45fcf7e8ab | ||
![]() |
e3638c2f5c | ||
![]() |
22072bb2fe | ||
![]() |
903e7649e4 | ||
![]() |
a17d6b05ae | ||
![]() |
4b1210f414 | ||
![]() |
f208e2d0b6 | ||
![]() |
ba8bbe045b | ||
![]() |
7e44d47065 | ||
![]() |
34cd4ca3d8 | ||
638bfacadd | |||
d341535d60 | |||
![]() |
38e2d1ac51 | ||
![]() |
5b1039b81f | ||
![]() |
37deac2ab9 | ||
![]() |
34f6d4e793 | ||
![]() |
bbae2c356a | ||
deec19a60c | |||
b1167594db | |||
![]() |
0da6a5fc60 | ||
![]() |
549006036b | ||
![]() |
6ed29e788c | ||
![]() |
e437f65f83 | ||
![]() |
6f96e698ec | ||
![]() |
b2dd028fc7 | ||
![]() |
62f2be8823 | ||
![]() |
89d43e21eb | ||
![]() |
5d9831efb5 | ||
![]() |
b65cb87e58 | ||
![]() |
7e687f7001 | ||
![]() |
1d5a4d6fab | ||
![]() |
2a2a934006 | ||
![]() |
4ae65fdbac | ||
![]() |
dd347b56a2 | ||
![]() |
ff1cdc265a | ||
![]() |
9863195684 | ||
![]() |
d6765904a1 | ||
![]() |
7e4d6a2836 | ||
![]() |
8a0b3a0870 | ||
![]() |
6f53fc79bb | ||
![]() |
6f161e8699 | ||
![]() |
8f1f80ae38 | ||
![]() |
aec09a6890 | ||
![]() |
8e557c608e | ||
![]() |
991a678788 | ||
![]() |
b88d6131c5 | ||
![]() |
c25ae2ad0f | ||
![]() |
2abab27d5c | ||
![]() |
a91f8b6c5c | ||
![]() |
83d37d943f | ||
![]() |
81ca11a955 | ||
![]() |
931f79ac16 | ||
![]() |
2ab84ef4af | ||
![]() |
056d1af9d0 | ||
![]() |
34f5f2f6c8 | ||
![]() |
6d32161312 | ||
![]() |
df6914d1e0 | ||
![]() |
6f277e7b33 | ||
![]() |
7ffcf1c82b | ||
![]() |
c6e27c35c8 | ||
![]() |
a6f82b4541 | ||
![]() |
d533abada5 | ||
![]() |
4393aada3e | ||
![]() |
559fbe65c3 | ||
![]() |
803dab0fb5 | ||
![]() |
ca377a6684 | ||
![]() |
188233cc81 | ||
![]() |
408b4eed90 | ||
![]() |
b456e56789 | ||
![]() |
9225732c1a | ||
![]() |
e9601e8d13 | ||
![]() |
b1ded11fa5 | ||
![]() |
978929ba48 | ||
![]() |
7e337c4a40 | ||
![]() |
62c9719a77 | ||
![]() |
2b48b64f2f | ||
![]() |
799b896bfe | ||
![]() |
8a5db88225 | ||
![]() |
cc65c56042 | ||
![]() |
0a4df01354 | ||
![]() |
25945b8b3b | ||
![]() |
9921a4db52 | ||
![]() |
2c6530f3b0 | ||
![]() |
f158191e52 | ||
![]() |
a7f2ae91a7 | ||
![]() |
49e1b709f7 | ||
![]() |
59c903b635 | ||
![]() |
c9d599216d | ||
![]() |
8fa3a75a63 | ||
![]() |
e31d1edb99 | ||
![]() |
915cad8c85 | ||
![]() |
7bd6c0dd09 | ||
![]() |
0aa8e886ce | ||
![]() |
1334b266b9 | ||
![]() |
9566c9a719 | ||
![]() |
0643701c4a | ||
![]() |
4d86c25411 | ||
![]() |
ad02740d8a | ||
![]() |
0b95669db0 | ||
![]() |
4aefbcb8b9 | ||
![]() |
56129253d9 | ||
![]() |
7613629d87 | ||
![]() |
fb0eab00c2 | ||
![]() |
5b8c3b9b11 | ||
![]() |
700f76679a | ||
![]() |
e7d731bb04 | ||
![]() |
49637fcc3b | ||
![]() |
fc25d7ea93 | ||
![]() |
cca6579274 | ||
![]() |
7dbf93fe7b | ||
![]() |
b46ab8db51 | ||
![]() |
a19519fa73 | ||
![]() |
4a3f36d38b | ||
![]() |
4ae02fc07b | ||
![]() |
047fca32bf | ||
![]() |
abbff449c0 | ||
![]() |
fba668860b | ||
![]() |
acb196d9c2 | ||
![]() |
dfa3a21e6b | ||
![]() |
7ff6bccbc4 | ||
![]() |
88e5b80778 | ||
![]() |
d127431396 | ||
![]() |
588703ecd6 | ||
![]() |
223c9b641a | ||
![]() |
7db34d6517 | ||
![]() |
13901d17ab | ||
![]() |
19bc9005e9 | ||
![]() |
7c86a325d9 | ||
![]() |
d203b521c1 | ||
![]() |
0afa59fb66 | ||
![]() |
470a08f4bc | ||
![]() |
50c5940a0a | ||
![]() |
35f64eec1b | ||
![]() |
e25f9f4aae | ||
![]() |
a86dbf9dac | ||
![]() |
026bfcba78 | ||
![]() |
3b66824c58 | ||
![]() |
898a9a0935 | ||
![]() |
7aa342cf9c | ||
![]() |
f173283a66 | ||
![]() |
4f69b5cdcc | ||
![]() |
744858df81 | ||
![]() |
f172e31250 | ||
![]() |
7530cf8006 | ||
![]() |
33223934e3 | ||
![]() |
f2731c49dd | ||
![]() |
227bc30dde | ||
![]() |
7b39fe79c8 | ||
![]() |
fcbda1e33d | ||
![]() |
42ac04b02c | ||
![]() |
7cd05cb1d8 | ||
![]() |
1b2d25e171 | ||
![]() |
675a718107 | ||
![]() |
a8f5897364 | ||
![]() |
5120c8177b | ||
![]() |
f2d97b4e7e | ||
![]() |
197e061bc5 | ||
![]() |
d1a6b418d5 | ||
![]() |
e9c79b192b | ||
![]() |
52c56757ca | ||
![]() |
559af0ddd8 | ||
![]() |
cd1b3ce1ed | ||
![]() |
5273a25385 | ||
![]() |
3089609c19 | ||
![]() |
e1f62342d9 | ||
![]() |
9313ac1abf | ||
7a632c8f80 | |||
7f9a0e5b1e | |||
![]() |
b0a3f796cb | ||
![]() |
97521f174a | ||
432d5e49d5 | |||
b2c8f2e0f4 | |||
23011568b7 | |||
078f9535cf | |||
![]() |
ea481187d5 | ||
![]() |
810caaf8e2 | ||
![]() |
d290d9b4e3 | ||
![]() |
abb12accc7 | ||
2779e5b7c7 | |||
3970d485f6 | |||
![]() |
7b888cc4a2 | ||
![]() |
117513d6bf | ||
97511ab290 | |||
3131eca8a1 | |||
91a5507217 | |||
7d904b7120 | |||
![]() |
be72fc4f7e | ||
![]() |
ecba11a9a9 | ||
![]() |
65f2e529f4 | ||
![]() |
29e7b22953 | ||
![]() |
a61d4573a6 | ||
![]() |
ce127f55c8 | ||
![]() |
c982a177f7 | ||
![]() |
401630da1e | ||
a8f8715648 | |||
![]() |
a8a3cd5437 | ||
75e18c859c | |||
c33120ec18 | |||
ec0372accd | |||
aa0b21dd31 | |||
ed766848be | |||
c73ce18368 | |||
d996209888 | |||
00278b8710 | |||
10a4941b26 | |||
c3b8c97eea | |||
8e690747e2 | |||
![]() |
53a54252e3 | ||
278b2759d5 | |||
e495a1c2e7 | |||
536bddf442 | |||
a0d1c82afa | |||
473a3700a7 | |||
![]() |
82ef424365 | ||
7e642e3b73 | |||
d32f312d60 | |||
699452667c | |||
![]() |
fa3d38db18 | ||
dd1e128e17 | |||
d247aa8334 | |||
5f995a10c1 | |||
![]() |
b89998c053 | ||
d10f617910 | |||
1b439a4960 | |||
![]() |
5cf4ff3012 | ||
46c8429cde | |||
8cd3801897 | |||
b47d7fb69b | |||
52e08d8c98 | |||
ad0d8d6c97 | |||
5b31d3ff72 | |||
2bbd931b1a | |||
8c09d266e8 | |||
a11d209280 | |||
![]() |
e95e62f184 | ||
![]() |
84e7afc819 | ||
![]() |
c82d6d001d | ||
d5b7845242 | |||
9de9ae54da | |||
6548d1d9c1 | |||
54ad395d13 | |||
6bb37d9e70 | |||
66fd87124b | |||
7bb78fd374 | |||
dc62cedb74 | |||
![]() |
bc6e7d0097 | ||
01ed1bc9c1 | |||
![]() |
19008cdad2 | ||
8a312bec71 | |||
2b8d37057c | |||
5497e6fc00 | |||
86064af3a2 | |||
3265244f06 | |||
2698070328 | |||
5638b59fda | |||
9f94dd55c2 | |||
0ded991673 | |||
cddda7adcd | |||
69a63f4b2e | |||
10b6330ac6 | |||
676365460c | |||
acb5bcc230 | |||
![]() |
f1737ca9f7 | ||
2f1355104e | |||
97b1475100 | |||
454e074c44 | |||
951172e36f | |||
f5fd3effaf | |||
ec4f2e7d88 | |||
98ecb0b8a1 | |||
![]() |
f2794f8055 | ||
![]() |
dfb5ec9683 | ||
3d033417ad | |||
f22ca4c46f | |||
11fb82573b | |||
4aa3b17398 | |||
c611f5a8a2 | |||
013108f2ec | |||
616d922145 | |||
![]() |
95771878fc | ||
267d9f25c2 | |||
2bcc4fde60 | |||
30838d0e00 | |||
![]() |
6d69dd4d15 | ||
![]() |
324553c58c | ||
![]() |
1ca3f29da0 | ||
817f25e8a8 | |||
![]() |
056e1624be | ||
b5c04d524d | |||
1582060466 | |||
caaf34918e | |||
![]() |
3a045dbb16 | ||
40256be135 | |||
26e9b78b3b | |||
a76b0ff350 | |||
7e0f21f88f | |||
d78e75f449 | |||
93be4cf01c | |||
ec037b97fd | |||
2b469d764d | |||
cfd61a87e8 | |||
1faa26473d | |||
27aaa8023a | |||
22ea657885 | |||
34996da19d | |||
![]() |
3bf8015280 | ||
![]() |
32e629231c | ||
![]() |
9d78d59a15 | ||
668afbe817 | |||
a43bc20eb3 | |||
![]() |
baba70e56d | ||
c4ac244270 | |||
668ffcb107 | |||
a7cdd248c9 | |||
f976a2cc86 | |||
![]() |
5d271d4133 | ||
![]() |
25d1564a8d | ||
00897307a4 |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -33,4 +33,10 @@ _ReSharper*/
|
|||||||
Translation/TrlUtil.vshost.exe.manifest
|
Translation/TrlUtil.vshost.exe.manifest
|
||||||
*.nupkg
|
*.nupkg
|
||||||
.vs/
|
.vs/
|
||||||
/UpgradeLog.htm
|
/UpgradeLog*.htm
|
||||||
|
packages/
|
||||||
|
project.lock.json
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
*.DotSettings
|
||||||
|
/ModernKeePass/Win81App_StoreKey.pfx
|
||||||
|
674
LICENSE
Normal file
674
LICENSE
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{one line to give the program's name and a brief idea of what it does.}
|
||||||
|
Copyright (C) {year} {name of author}
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
{project} Copyright (C) {year} {fullname}
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
155
ModernKeePass.Application/Application.csproj
Normal file
155
ModernKeePass.Application/Application.csproj
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{42353562-5E43-459C-8E3E-2F21E575261D}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>ModernKeePass.Application</RootNamespace>
|
||||||
|
<AssemblyName>ModernKeePass.Application</AssemblyName>
|
||||||
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<TargetFrameworkProfile>
|
||||||
|
</TargetFrameworkProfile>
|
||||||
|
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||||
|
<None Include="project.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Common\Behaviors\DirtyStatusBehavior.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\ICryptographyClient.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\IDatabaseProxy.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\IEntityVm.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\IFileProxy.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\IImportFormat.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\ICredentialsProxy.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\INotificationService.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\IRecentProxy.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\IResourceProxy.cs" />
|
||||||
|
<Compile Include="Common\Interfaces\ISettingsProxy.cs" />
|
||||||
|
<Compile Include="Common\Mappings\IMapFrom.cs" />
|
||||||
|
<Compile Include="Common\Mappings\MappingProfile.cs" />
|
||||||
|
<Compile Include="Entry\Commands\AddHistory\AddHistoryCommand.cs" />
|
||||||
|
<Compile Include="Entry\Commands\DeleteHistory\DeleteHistoryCommand.cs" />
|
||||||
|
<Compile Include="Entry\Commands\RestoreHistory\RestoreHistoryCommand.cs" />
|
||||||
|
<Compile Include="Entry\Queries\GetEntry\GetEntryQuery.cs" />
|
||||||
|
<Compile Include="Group\Commands\DeleteEntry\DeleteEntryCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\DeleteGroup\DeleteGroupCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\UpdateGroup\UpdateGroupCommand.cs" />
|
||||||
|
<Compile Include="Group\Queries\GetAllGroups\GetAllGroupsQuery.cs" />
|
||||||
|
<Compile Include="Group\Queries\GetGroup\GetGroupQuery.cs" />
|
||||||
|
<Compile Include="Group\Queries\SearchEntries\SearchEntriesQuery.cs" />
|
||||||
|
<Compile Include="Parameters\Commands\SetCipher\SetCipherCommand.cs" />
|
||||||
|
<Compile Include="Parameters\Commands\SetCompression\SetCompressionCommand.cs" />
|
||||||
|
<Compile Include="Parameters\Commands\SetHasRecycleBin\SetHasRecycleBinCommand.cs" />
|
||||||
|
<Compile Include="Parameters\Commands\SetKeyDerivation\SetKeyDerivationCommand.cs" />
|
||||||
|
<Compile Include="Parameters\Commands\SetRecycleBin\SetRecycleBinCommand.cs" />
|
||||||
|
<Compile Include="Parameters\Models\CipherVm.cs" />
|
||||||
|
<Compile Include="Parameters\Models\KeyDerivationVm.cs" />
|
||||||
|
<Compile Include="Parameters\Queries\GetCiphers\GetCiphersQuery.cs" />
|
||||||
|
<Compile Include="Parameters\Queries\GetCompressions\GetCompressionsQuery.cs" />
|
||||||
|
<Compile Include="Parameters\Queries\GetKeyDerivations\GetKeyDerivationsQuery.cs" />
|
||||||
|
<Compile Include="Database\Commands\CloseDatabase\CloseDatabaseCommand.cs" />
|
||||||
|
<Compile Include="Database\Commands\CreateDatabase\CreateDatabaseCommand.cs" />
|
||||||
|
<Compile Include="Database\Commands\CreateDatabase\CreateDatabaseQueryValidator.cs" />
|
||||||
|
<Compile Include="Database\Commands\SaveDatabase\SaveDatabaseCommand.cs" />
|
||||||
|
<Compile Include="Database\Commands\UpdateCredentials\UpdateCredentialsCommand.cs" />
|
||||||
|
<Compile Include="Database\Models\DatabaseVm.cs" />
|
||||||
|
<Compile Include="Database\Queries\GetDatabase\GetDatabaseQuery.cs" />
|
||||||
|
<Compile Include="Database\Queries\OpenDatabase\OpenDatabaseQuery.cs" />
|
||||||
|
<Compile Include="Database\Queries\OpenDatabase\OpenDatabaseQueryValidator.cs" />
|
||||||
|
<Compile Include="Database\Queries\ReOpenDatabase\ReOpenDatabaseQuery.cs" />
|
||||||
|
<Compile Include="DependencyInjection.cs" />
|
||||||
|
<Compile Include="Entry\Commands\SetFieldValue\SetFieldValueCommand.cs" />
|
||||||
|
<Compile Include="Entry\Commands\SetFieldValue\SetFieldValueCommandValidator.cs" />
|
||||||
|
<Compile Include="Entry\Models\EntryVm.cs" />
|
||||||
|
<Compile Include="Group\Commands\AddEntry\AddEntryCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\AddGroup\AddGroupCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\CreateEntry\CreateEntryCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\CreateGroup\CreateGroupCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\MoveEntry\MoveEntryCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\RemoveEntry\RemoveEntryCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\RemoveGroup\RemoveGroupCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\SortEntries\SortEntriesCommand.cs" />
|
||||||
|
<Compile Include="Group\Commands\SortGroups\SortGroupsCommand.cs" />
|
||||||
|
<Compile Include="Group\Models\GroupVm.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Security\Commands\GenerateKeyFile\GenerateKeyFileCommand.cs" />
|
||||||
|
<Compile Include="Security\Commands\GeneratePassword\GeneratePasswordCommand.cs" />
|
||||||
|
<Compile Include="Security\Queries\EstimatePasswordComplexity\EstimatePasswordComplexityQuery.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ModernKeePass.Domain\Domain.csproj">
|
||||||
|
<Project>{9a0759f1-9069-4841-99e3-3bec44e17356}</Project>
|
||||||
|
<Name>Domain</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Database.Commands.CloseDatabase;
|
||||||
|
using ModernKeePass.Application.Database.Commands.SaveDatabase;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Behaviors
|
||||||
|
{
|
||||||
|
public class DirtyStatusBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||||
|
{
|
||||||
|
private readonly List<string> _excludedCommands = new List<string>
|
||||||
|
{nameof(SaveDatabaseCommand), nameof(CloseDatabaseCommand)};
|
||||||
|
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public DirtyStatusBehavior(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next)
|
||||||
|
{
|
||||||
|
var response = await next();
|
||||||
|
var queryName = typeof(TRequest).Name;
|
||||||
|
if (queryName.Contains("Command"))
|
||||||
|
{
|
||||||
|
_database.IsDirty = !_excludedCommands.Contains(queryName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICredentialsProxy
|
||||||
|
{
|
||||||
|
string GeneratePassword(PasswordGenerationOptions options);
|
||||||
|
int EstimatePasswordComplexity(string password);
|
||||||
|
byte[] GenerateKeyFile(byte[] additionalEntropy);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICryptographyClient
|
||||||
|
{
|
||||||
|
IEnumerable<BaseEntity> Ciphers { get; }
|
||||||
|
IEnumerable<BaseEntity> KeyDerivations { get; }
|
||||||
|
IEnumerable<string> CompressionAlgorithms { get; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,56 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDatabaseProxy
|
||||||
|
{
|
||||||
|
// PW Database properties
|
||||||
|
bool IsOpen { get; }
|
||||||
|
string Name { get; }
|
||||||
|
string RootGroupId { get; }
|
||||||
|
string RecycleBinId { get; set; }
|
||||||
|
string CipherId { get; set; }
|
||||||
|
string KeyDerivationId { get; set; }
|
||||||
|
string Compression { get; set; }
|
||||||
|
bool IsRecycleBinEnabled { get; set; }
|
||||||
|
|
||||||
|
// Custom properties
|
||||||
|
string FileAccessToken { get; set; }
|
||||||
|
int Size { get; set; }
|
||||||
|
bool IsDirty { get; set; }
|
||||||
|
|
||||||
|
Task Open(byte[] file, Credentials credentials);
|
||||||
|
Task ReOpen(byte[] file);
|
||||||
|
Task Create(Credentials credentials, string name, DatabaseVersion version = DatabaseVersion.V3);
|
||||||
|
Task<byte[]> SaveDatabase();
|
||||||
|
Task<byte[]> SaveDatabase(byte[] newFileContents);
|
||||||
|
void UpdateCredentials(Credentials credentials);
|
||||||
|
void CloseDatabase();
|
||||||
|
|
||||||
|
EntryEntity GetEntry(string id);
|
||||||
|
GroupEntity GetGroup(string id);
|
||||||
|
Task AddEntry(string parentGroupId, string entryId);
|
||||||
|
Task MoveEntry(string parentGroupId, string entryId, int index);
|
||||||
|
Task AddGroup(string parentGroupId, string groupId);
|
||||||
|
void UpdateEntry(string entryId, string fieldName, object fieldValue);
|
||||||
|
void UpdateGroup(GroupEntity group);
|
||||||
|
Task RemoveEntry(string parentGroupId, string entryId);
|
||||||
|
Task RemoveGroup(string parentGroupId, string groupId);
|
||||||
|
void DeleteEntity(string entityId);
|
||||||
|
EntryEntity CreateEntry(string parentGroupId);
|
||||||
|
GroupEntity CreateGroup(string parentGroupId, string name, bool isRecycleBin = false);
|
||||||
|
void SortEntries(string groupId);
|
||||||
|
void SortSubGroups(string groupId);
|
||||||
|
|
||||||
|
EntryEntity AddHistory(string entryId);
|
||||||
|
EntryEntity RestoreFromHistory(string entryId, int historyIndex);
|
||||||
|
void DeleteHistory(string entryId, int historyIndex);
|
||||||
|
|
||||||
|
IEnumerable<EntryEntity> Search(string groupId, string text);
|
||||||
|
IEnumerable<BaseEntity> GetAllGroups(string groupId);
|
||||||
|
}
|
||||||
|
}
|
13
ModernKeePass.Application/Common/Interfaces/IEntityVm.cs
Normal file
13
ModernKeePass.Application/Common/Interfaces/IEntityVm.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEntityVm
|
||||||
|
{
|
||||||
|
string Id { get; set; }
|
||||||
|
string Title { get; set; }
|
||||||
|
Icon Icon { get; set; }
|
||||||
|
string ParentGroupId { get; set; }
|
||||||
|
string ParentGroupName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
ModernKeePass.Application/Common/Interfaces/IFileProxy.cs
Normal file
13
ModernKeePass.Application/Common/Interfaces/IFileProxy.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IFileProxy
|
||||||
|
{
|
||||||
|
Task<byte[]> OpenBinaryFile(string path);
|
||||||
|
Task<IList<string>> OpenTextFile(string path);
|
||||||
|
Task WriteBinaryContentsToFile(string path, byte[] contents);
|
||||||
|
void ReleaseFile(string path);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IImportFormat
|
||||||
|
{
|
||||||
|
List<Dictionary<string, string>> Import(IList<string> fileContents);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface INotificationService
|
||||||
|
{
|
||||||
|
void Show(string title, string text);
|
||||||
|
}
|
||||||
|
}
|
12
ModernKeePass.Application/Common/Interfaces/IRecentProxy.cs
Normal file
12
ModernKeePass.Application/Common/Interfaces/IRecentProxy.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IRecentProxy
|
||||||
|
{
|
||||||
|
int EntryCount { get; }
|
||||||
|
IEnumerable<FileInfo> GetAll();
|
||||||
|
void ClearAll();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IResourceProxy
|
||||||
|
{
|
||||||
|
string GetResourceValue(string key);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface ISettingsProxy
|
||||||
|
{
|
||||||
|
T GetSetting<T>(string property, T defaultValue = default(T));
|
||||||
|
void PutSetting<T>(string property, T value);
|
||||||
|
}
|
||||||
|
}
|
10
ModernKeePass.Application/Common/Mappings/IMapFrom.cs
Normal file
10
ModernKeePass.Application/Common/Mappings/IMapFrom.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Mappings
|
||||||
|
{
|
||||||
|
|
||||||
|
public interface IMapFrom<T>
|
||||||
|
{
|
||||||
|
void Mapping(Profile profile);
|
||||||
|
}
|
||||||
|
}
|
30
ModernKeePass.Application/Common/Mappings/MappingProfile.cs
Normal file
30
ModernKeePass.Application/Common/Mappings/MappingProfile.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Common.Mappings
|
||||||
|
{
|
||||||
|
public class MappingProfile : Profile
|
||||||
|
{
|
||||||
|
public MappingProfile()
|
||||||
|
{
|
||||||
|
ApplyMappingsFromAssembly(typeof(MappingProfile).GetTypeInfo().Assembly);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyMappingsFromAssembly(Assembly assembly)
|
||||||
|
{
|
||||||
|
var types = assembly.ExportedTypes
|
||||||
|
.Where(t => t.GetTypeInfo().ImplementedInterfaces.Any(i =>
|
||||||
|
i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == typeof(IMapFrom<>)))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
var instance = Activator.CreateInstance(type);
|
||||||
|
var methodInfo = type.GetTypeInfo().GetDeclaredMethod("Mapping");
|
||||||
|
methodInfo?.Invoke(instance, new object[] { this });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Commands.CloseDatabase
|
||||||
|
{
|
||||||
|
public class CloseDatabaseCommand: IRequest
|
||||||
|
{
|
||||||
|
public class CloseDatabaseCommandHandler : IRequestHandler<CloseDatabaseCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public CloseDatabaseCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
public void Handle(CloseDatabaseCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
_database.CloseDatabase();
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
_database.FileAccessToken = null;
|
||||||
|
_database.Size = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
using MediatR;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Commands.CreateDatabase
|
||||||
|
{
|
||||||
|
public class CreateDatabaseCommand : IRequest
|
||||||
|
{
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
public string Password { get; set; }
|
||||||
|
public string KeyFilePath { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Version { get; set; }
|
||||||
|
public bool CreateSampleData { get; set; }
|
||||||
|
|
||||||
|
public class CreateDatabaseCommandHandler : IAsyncRequestHandler<CreateDatabaseCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IFileProxy _file;
|
||||||
|
|
||||||
|
public CreateDatabaseCommandHandler(IDatabaseProxy database, IFileProxy file)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(CreateDatabaseCommand message)
|
||||||
|
{
|
||||||
|
if (_database.IsDirty) throw new DatabaseOpenException();
|
||||||
|
|
||||||
|
var version = DatabaseVersion.V2;
|
||||||
|
switch (message.Version)
|
||||||
|
{
|
||||||
|
case "4":
|
||||||
|
version = DatabaseVersion.V4;
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
version = DatabaseVersion.V3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _database.Create(new Credentials
|
||||||
|
{
|
||||||
|
KeyFileContents = !string.IsNullOrEmpty(message.KeyFilePath) ? await _file.OpenBinaryFile(message.KeyFilePath) : null,
|
||||||
|
Password = message.Password
|
||||||
|
}, message.Name, version);
|
||||||
|
_database.FileAccessToken = message.FilePath;
|
||||||
|
|
||||||
|
if (message.CreateSampleData)
|
||||||
|
{
|
||||||
|
var bankingGroup = _database.CreateGroup(_database.RootGroupId, "Banking");
|
||||||
|
bankingGroup.Icon = Icon.Shop;
|
||||||
|
_database.UpdateGroup(bankingGroup);
|
||||||
|
|
||||||
|
var emailGroup = _database.CreateGroup(_database.RootGroupId, "Email");
|
||||||
|
emailGroup.Icon = Icon.Mail;
|
||||||
|
_database.UpdateGroup(emailGroup);
|
||||||
|
|
||||||
|
var internetGroup = _database.CreateGroup(_database.RootGroupId, "Internet");
|
||||||
|
internetGroup.Icon = Icon.World;
|
||||||
|
_database.UpdateGroup(internetGroup);
|
||||||
|
|
||||||
|
var sample1 = _database.CreateEntry(_database.RootGroupId);
|
||||||
|
_database.UpdateEntry(sample1.Id, EntryFieldName.Title, "Sample Entry" );
|
||||||
|
_database.UpdateEntry(sample1.Id, EntryFieldName.UserName, "Username" );
|
||||||
|
_database.UpdateEntry(sample1.Id, EntryFieldName.Password, "Password" );
|
||||||
|
_database.UpdateEntry(sample1.Id, EntryFieldName.Url, "https://keepass.info/" );
|
||||||
|
_database.UpdateEntry(sample1.Id, EntryFieldName.Notes, "You may safely delete this sample" );
|
||||||
|
|
||||||
|
var sample2 = _database.CreateEntry(_database.RootGroupId);
|
||||||
|
_database.UpdateEntry(sample2.Id, EntryFieldName.Title, "Sample Entry #2" );
|
||||||
|
_database.UpdateEntry(sample2.Id, EntryFieldName.UserName, "Michael321" );
|
||||||
|
_database.UpdateEntry(sample2.Id, EntryFieldName.Password, "12345" );
|
||||||
|
_database.UpdateEntry(sample2.Id, EntryFieldName.Url, "https://keepass.info/help/kb/testform.html" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Commands.CreateDatabase
|
||||||
|
{
|
||||||
|
public class CreateDatabaseQueryValidator : AbstractValidator<CreateDatabaseCommand>
|
||||||
|
{
|
||||||
|
public CreateDatabaseQueryValidator()
|
||||||
|
{
|
||||||
|
RuleFor(v => v.FilePath)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty();
|
||||||
|
RuleFor(v => v.Password)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty()
|
||||||
|
.When(v => string.IsNullOrEmpty(v.KeyFilePath));
|
||||||
|
RuleFor(v => v.KeyFilePath)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty()
|
||||||
|
.When(v => string.IsNullOrEmpty(v.Password));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using MediatR;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Commands.SaveDatabase
|
||||||
|
{
|
||||||
|
public class SaveDatabaseCommand : IRequest
|
||||||
|
{
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
|
||||||
|
public class SaveDatabaseCommandHandler : IAsyncRequestHandler<SaveDatabaseCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IFileProxy _file;
|
||||||
|
|
||||||
|
public SaveDatabaseCommandHandler(IDatabaseProxy database, IFileProxy file)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(SaveDatabaseCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] contents;
|
||||||
|
if (string.IsNullOrEmpty(message.FilePath))
|
||||||
|
{
|
||||||
|
contents = await _database.SaveDatabase();
|
||||||
|
|
||||||
|
// Test DB integrity before writing changes to file
|
||||||
|
_database.CloseDatabase();
|
||||||
|
await _database.ReOpen(contents);
|
||||||
|
|
||||||
|
await _file.WriteBinaryContentsToFile(_database.FileAccessToken, contents);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var newFileContents = await _file.OpenBinaryFile(message.FilePath);
|
||||||
|
contents = await _database.SaveDatabase(newFileContents);
|
||||||
|
await _file.WriteBinaryContentsToFile(message.FilePath, contents);
|
||||||
|
|
||||||
|
_file.ReleaseFile(_database.FileAccessToken);
|
||||||
|
_database.FileAccessToken = message.FilePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
throw new SaveException(exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Commands.UpdateCredentials
|
||||||
|
{
|
||||||
|
public class UpdateCredentialsCommand: IRequest
|
||||||
|
{
|
||||||
|
public string Password { get; set; }
|
||||||
|
public string KeyFilePath { get; set; }
|
||||||
|
|
||||||
|
public class UpdateCredentialsCommandHandler : IAsyncRequestHandler<UpdateCredentialsCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IFileProxy _file;
|
||||||
|
|
||||||
|
public UpdateCredentialsCommandHandler(IDatabaseProxy database, IFileProxy file)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(UpdateCredentialsCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
_database.UpdateCredentials(new Credentials
|
||||||
|
{
|
||||||
|
KeyFileContents = !string.IsNullOrEmpty(message.KeyFilePath) ? await _file.OpenBinaryFile(message.KeyFilePath) : null,
|
||||||
|
Password = message.Password
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
ModernKeePass.Application/Database/Models/DatabaseVm.cs
Normal file
16
ModernKeePass.Application/Database/Models/DatabaseVm.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
namespace ModernKeePass.Application.Database.Models
|
||||||
|
{
|
||||||
|
public class DatabaseVm
|
||||||
|
{
|
||||||
|
public bool IsOpen { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string RootGroupId { get; set; }
|
||||||
|
public string RecycleBinId { get; set; }
|
||||||
|
public bool IsRecycleBinEnabled { get; set; }
|
||||||
|
public string Compression { get; set; }
|
||||||
|
public string CipherId { get; set; }
|
||||||
|
public string KeyDerivationId { get; set; }
|
||||||
|
public int Size { get; internal set; }
|
||||||
|
public bool IsDirty { get; internal set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Database.Models;
|
||||||
|
using ModernKeePass.Domain.Common;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Queries.GetDatabase
|
||||||
|
{
|
||||||
|
public class GetDatabaseQuery: IRequest<DatabaseVm>
|
||||||
|
{
|
||||||
|
public class GetDatabaseQueryHandler : IRequestHandler<GetDatabaseQuery, DatabaseVm>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _databaseProxy;
|
||||||
|
|
||||||
|
public GetDatabaseQueryHandler(IDatabaseProxy databaseProxy)
|
||||||
|
{
|
||||||
|
_databaseProxy = databaseProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatabaseVm Handle(GetDatabaseQuery message)
|
||||||
|
{
|
||||||
|
var database = new DatabaseVm
|
||||||
|
{
|
||||||
|
IsOpen = _databaseProxy.IsOpen
|
||||||
|
};
|
||||||
|
if (database.IsOpen)
|
||||||
|
{
|
||||||
|
database.Name = _databaseProxy.Name;
|
||||||
|
database.RootGroupId = _databaseProxy.RootGroupId;
|
||||||
|
database.IsRecycleBinEnabled = _databaseProxy.IsRecycleBinEnabled;
|
||||||
|
database.RecycleBinId = _databaseProxy.RecycleBinId == Constants.EmptyId ? null : _databaseProxy.RecycleBinId;
|
||||||
|
database.Compression = _databaseProxy.Compression;
|
||||||
|
database.CipherId = _databaseProxy.CipherId;
|
||||||
|
database.KeyDerivationId = _databaseProxy.KeyDerivationId;
|
||||||
|
database.Size = _databaseProxy.Size;
|
||||||
|
database.IsDirty = _databaseProxy.IsDirty;
|
||||||
|
}
|
||||||
|
return database;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,43 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Queries.OpenDatabase
|
||||||
|
{
|
||||||
|
public class OpenDatabaseQuery: IRequest
|
||||||
|
{
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
public string Password { get; set; }
|
||||||
|
public string KeyFilePath { get; set; }
|
||||||
|
|
||||||
|
public class OpenDatabaseQueryHandler : IAsyncRequestHandler<OpenDatabaseQuery>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IFileProxy _file;
|
||||||
|
|
||||||
|
public OpenDatabaseQueryHandler(IDatabaseProxy database, IFileProxy file)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(OpenDatabaseQuery message)
|
||||||
|
{
|
||||||
|
if (_database.IsDirty) throw new DatabaseOpenException();
|
||||||
|
|
||||||
|
var file = await _file.OpenBinaryFile(message.FilePath);
|
||||||
|
var hasKeyFile = !string.IsNullOrEmpty(message.KeyFilePath);
|
||||||
|
await _database.Open(file, new Credentials
|
||||||
|
{
|
||||||
|
KeyFileContents = hasKeyFile ? await _file.OpenBinaryFile(message.KeyFilePath): null,
|
||||||
|
Password = message.Password
|
||||||
|
});
|
||||||
|
if (hasKeyFile) _file.ReleaseFile(message.KeyFilePath);
|
||||||
|
_database.Size = file.Length;
|
||||||
|
_database.FileAccessToken = message.FilePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Queries.OpenDatabase
|
||||||
|
{
|
||||||
|
public class OpenDatabaseQueryValidator : AbstractValidator<OpenDatabaseQuery>
|
||||||
|
{
|
||||||
|
public OpenDatabaseQueryValidator()
|
||||||
|
{
|
||||||
|
RuleFor(v => v.FilePath)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty();
|
||||||
|
RuleFor(v => v.Password)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty()
|
||||||
|
.When(v => string.IsNullOrEmpty(v.KeyFilePath));
|
||||||
|
RuleFor(v => v.KeyFilePath)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty()
|
||||||
|
.When(v => string.IsNullOrEmpty(v.Password));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Database.Queries.ReOpenDatabase
|
||||||
|
{
|
||||||
|
public class ReOpenDatabaseQuery: IRequest
|
||||||
|
{
|
||||||
|
public class ReOpenDatabaseQueryHandler : IAsyncRequestHandler<ReOpenDatabaseQuery>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IFileProxy _file;
|
||||||
|
|
||||||
|
public ReOpenDatabaseQueryHandler(IDatabaseProxy database, IFileProxy file)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(ReOpenDatabaseQuery message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
var file = await _file.OpenBinaryFile(_database.FileAccessToken);
|
||||||
|
await _database.ReOpen(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
ModernKeePass.Application/DependencyInjection.cs
Normal file
21
ModernKeePass.Application/DependencyInjection.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using FluentValidation;
|
||||||
|
using MediatR;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using ModernKeePass.Application.Common.Behaviors;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application
|
||||||
|
{
|
||||||
|
public static class DependencyInjection
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddApplication(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
var assembly = typeof(DependencyInjection).GetTypeInfo().Assembly;
|
||||||
|
services.AddMediatR(assembly);
|
||||||
|
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(DirtyStatusBehavior<,>));
|
||||||
|
//services.AddValidatorsFromAssembly(assembly);
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,33 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Entry.Commands.AddHistory
|
||||||
|
{
|
||||||
|
public class AddHistoryCommand : IRequest
|
||||||
|
{
|
||||||
|
public EntryVm Entry { get; set; }
|
||||||
|
|
||||||
|
public class AddHistoryCommandHandler : IRequestHandler<AddHistoryCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public AddHistoryCommandHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(AddHistoryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
var history = _database.AddHistory(message.Entry.Id);
|
||||||
|
message.Entry.History.Add(_mapper.Map<EntryVm>(history));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Entry.Commands.DeleteHistory
|
||||||
|
{
|
||||||
|
public class DeleteHistoryCommand : IRequest
|
||||||
|
{
|
||||||
|
public EntryVm Entry { get; set; }
|
||||||
|
public int HistoryIndex { get; set; }
|
||||||
|
|
||||||
|
public class DeleteHistoryCommandHandler : IRequestHandler<DeleteHistoryCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public DeleteHistoryCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(DeleteHistoryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
_database.DeleteHistory(message.Entry.Id, message.HistoryIndex);
|
||||||
|
message.Entry.History.RemoveAt(message.HistoryIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Entry.Commands.RestoreHistory
|
||||||
|
{
|
||||||
|
public class RestoreHistoryCommand : IRequest
|
||||||
|
{
|
||||||
|
public EntryVm Entry { get; set; }
|
||||||
|
public int HistoryIndex { get; set; }
|
||||||
|
|
||||||
|
public class RestoreHistoryCommandHandler : IRequestHandler<RestoreHistoryCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public RestoreHistoryCommandHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(RestoreHistoryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
var entry = _database.RestoreFromHistory(message.Entry.Id, message.HistoryIndex);
|
||||||
|
message.Entry = _mapper.Map<EntryVm>(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,30 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Entry.Commands.SetFieldValue
|
||||||
|
{
|
||||||
|
public class SetFieldValueCommand : IRequest
|
||||||
|
{
|
||||||
|
public string EntryId { get; set; }
|
||||||
|
public string FieldName { get; set; }
|
||||||
|
public object FieldValue { get; set; }
|
||||||
|
|
||||||
|
public class SetFieldValueCommandHandler : IRequestHandler<SetFieldValueCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SetFieldValueCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SetFieldValueCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
_database.UpdateEntry(message.EntryId, message.FieldName, message.FieldValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Entry.Commands.SetFieldValue
|
||||||
|
{
|
||||||
|
public class SetFieldValueCommandValidator: AbstractValidator<SetFieldValueCommand>
|
||||||
|
{
|
||||||
|
public SetFieldValueCommandValidator()
|
||||||
|
{
|
||||||
|
RuleFor(v => v.EntryId)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty();
|
||||||
|
RuleFor(v => v.FieldName)
|
||||||
|
.NotNull()
|
||||||
|
.NotEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
59
ModernKeePass.Application/Entry/Models/EntryVm.cs
Normal file
59
ModernKeePass.Application/Entry/Models/EntryVm.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using AutoMapper;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Common.Mappings;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Entry.Models
|
||||||
|
{
|
||||||
|
public class EntryVm: IEntityVm, IMapFrom<EntryEntity>
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string ParentGroupName { get; set; }
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Username { get; set; }
|
||||||
|
public string Password { get; set; }
|
||||||
|
public string Notes { get; set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
public bool HasUrl => !string.IsNullOrEmpty(Url);
|
||||||
|
public Dictionary<string, string> AdditionalFields { get; set; }
|
||||||
|
public List<EntryVm> History { get; set; }
|
||||||
|
public Icon Icon { get; set; }
|
||||||
|
public Color ForegroundColor { get; set; }
|
||||||
|
public Color BackgroundColor { get; set; }
|
||||||
|
public bool HasExpirationDate { get; set; }
|
||||||
|
public DateTimeOffset ExpirationDate { get; set; }
|
||||||
|
public DateTimeOffset ModificationDate { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return ModificationDate.ToString("g");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Mapping(Profile profile)
|
||||||
|
{
|
||||||
|
profile.CreateMap<EntryEntity, EntryVm>()
|
||||||
|
.ForMember(d => d.ParentGroupId, opts => opts.MapFrom(s => s.ParentId))
|
||||||
|
.ForMember(d => d.ParentGroupName, opts => opts.MapFrom(s => s.ParentName))
|
||||||
|
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
||||||
|
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
||||||
|
.ForMember(d => d.Username, opts => opts.MapFrom(s => s.UserName))
|
||||||
|
.ForMember(d => d.Password, opts => opts.MapFrom(s => s.Password))
|
||||||
|
.ForMember(d => d.Url, opts => opts.MapFrom(s => s.Url))
|
||||||
|
.ForMember(d => d.Notes, opts => opts.MapFrom(s => s.Notes))
|
||||||
|
.ForMember(d => d.AdditionalFields, opts => opts.MapFrom(s => s.AdditionalFields))
|
||||||
|
.ForMember(d => d.History, opts => opts.MapFrom(s => s.History.Reverse()))
|
||||||
|
.ForMember(d => d.HasExpirationDate, opts => opts.MapFrom(s => s.HasExpirationDate))
|
||||||
|
.ForMember(d => d.ExpirationDate, opts => opts.MapFrom(s => s.ExpirationDate))
|
||||||
|
.ForMember(d => d.ModificationDate, opts => opts.MapFrom(s => s.LastModificationDate))
|
||||||
|
.ForMember(d => d.Icon, opts => opts.MapFrom(s => s.HasExpirationDate && s.ExpirationDate < DateTimeOffset.Now ? Icon.ReportHacked : s.Icon))
|
||||||
|
.ForMember(d => d.ForegroundColor, opts => opts.MapFrom(s => s.ForegroundColor))
|
||||||
|
.ForMember(d => d.BackgroundColor, opts => opts.MapFrom(s => s.BackgroundColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Entry.Queries.GetEntry
|
||||||
|
{
|
||||||
|
public class GetEntryQuery: IRequest<EntryVm>
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public class GetEntryQueryHandler: IRequestHandler<GetEntryQuery, EntryVm>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public GetEntryQueryHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntryVm Handle(GetEntryQuery message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
return _mapper.Map<EntryVm>(_database.GetEntry(message.Id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.AddEntry
|
||||||
|
{
|
||||||
|
public class AddEntryCommand : IRequest
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string EntryId { get; set; }
|
||||||
|
|
||||||
|
public class AddEntryCommandHandler : IAsyncRequestHandler<AddEntryCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public AddEntryCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(AddEntryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
await _database.AddEntry(message.ParentGroupId, message.EntryId);
|
||||||
|
//message.ParentGroup.Entries.Add(message.Entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.AddGroup
|
||||||
|
{
|
||||||
|
public class AddGroupCommand : IRequest
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string GroupId { get; set; }
|
||||||
|
|
||||||
|
public class AddGroupCommandHandler : IAsyncRequestHandler<AddGroupCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public AddGroupCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(AddGroupCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
await _database.AddGroup(message.ParentGroupId, message.GroupId);
|
||||||
|
//message.ParentGroup.SubGroups.Add(message.Group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,36 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.CreateEntry
|
||||||
|
{
|
||||||
|
public class CreateEntryCommand : IRequest<EntryVm>
|
||||||
|
{
|
||||||
|
public GroupVm ParentGroup { get; set; }
|
||||||
|
|
||||||
|
public class CreateEntryCommandHandler : IRequestHandler<CreateEntryCommand, EntryVm>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public CreateEntryCommandHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntryVm Handle(CreateEntryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
var entry = _database.CreateEntry(message.ParentGroup.Id);
|
||||||
|
var entryVm = _mapper.Map<EntryVm>(entry);
|
||||||
|
message.ParentGroup.Entries.Add(entryVm);
|
||||||
|
return entryVm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,37 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.CreateGroup
|
||||||
|
{
|
||||||
|
public class CreateGroupCommand : IRequest<GroupVm>
|
||||||
|
{
|
||||||
|
public GroupVm ParentGroup { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public bool IsRecycleBin { get; set; }
|
||||||
|
|
||||||
|
public class CreateGroupCommandHandler : IRequestHandler<CreateGroupCommand, GroupVm>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public CreateGroupCommandHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupVm Handle(CreateGroupCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
var group = _database.CreateGroup(message.ParentGroup.Id, message.Name, message.IsRecycleBin);
|
||||||
|
var groupVm = _mapper.Map<GroupVm>(group);
|
||||||
|
message.ParentGroup.SubGroups.Add(groupVm);
|
||||||
|
return groupVm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Common;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.DeleteEntry
|
||||||
|
{
|
||||||
|
public class DeleteEntryCommand : IRequest
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string EntryId { get; set; }
|
||||||
|
public string RecycleBinName { get; set; }
|
||||||
|
|
||||||
|
public class DeleteEntryCommandHandler : IAsyncRequestHandler<DeleteEntryCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public DeleteEntryCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(DeleteEntryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
if (_database.IsRecycleBinEnabled && (string.IsNullOrEmpty(_database.RecycleBinId) || _database.RecycleBinId.Equals(Constants.EmptyId)))
|
||||||
|
{
|
||||||
|
_database.CreateGroup(_database.RootGroupId, message.RecycleBinName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_database.IsRecycleBinEnabled || message.ParentGroupId.Equals(_database.RecycleBinId))
|
||||||
|
{
|
||||||
|
_database.DeleteEntity(message.EntryId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _database.AddEntry(_database.RecycleBinId, message.EntryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _database.RemoveEntry(message.ParentGroupId, message.EntryId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Common;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.DeleteGroup
|
||||||
|
{
|
||||||
|
public class DeleteGroupCommand : IRequest
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string GroupId { get; set; }
|
||||||
|
public string RecycleBinName { get; set; }
|
||||||
|
|
||||||
|
public class DeleteGroupCommandHandler : IAsyncRequestHandler<DeleteGroupCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public DeleteGroupCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(DeleteGroupCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
if (_database.IsRecycleBinEnabled && (string.IsNullOrEmpty(_database.RecycleBinId) || _database.RecycleBinId.Equals(Constants.EmptyId)))
|
||||||
|
{
|
||||||
|
_database.CreateGroup(_database.RootGroupId, message.RecycleBinName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_database.IsRecycleBinEnabled || message.ParentGroupId.Equals(_database.RecycleBinId))
|
||||||
|
{
|
||||||
|
_database.DeleteEntity(message.GroupId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _database.AddGroup(_database.RecycleBinId, message.GroupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _database.RemoveGroup(message.ParentGroupId, message.GroupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.MoveEntry
|
||||||
|
{
|
||||||
|
public class MoveEntryCommand : IRequest
|
||||||
|
{
|
||||||
|
public GroupVm ParentGroup { get; set; }
|
||||||
|
public EntryVm Entry { get; set; }
|
||||||
|
public int Index { get; set; }
|
||||||
|
|
||||||
|
public class MoveEntryCommandHandler : IAsyncRequestHandler<MoveEntryCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public MoveEntryCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(MoveEntryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
await _database.MoveEntry(message.ParentGroup.Id, message.Entry.Id, message.Index);
|
||||||
|
message.ParentGroup.Entries.Insert(message.Index, message.Entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.RemoveEntry
|
||||||
|
{
|
||||||
|
public class RemoveEntryCommand : IRequest
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string EntryId { get; set; }
|
||||||
|
|
||||||
|
public class RemoveEntryCommandHandler : IAsyncRequestHandler<RemoveEntryCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public RemoveEntryCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(RemoveEntryCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
await _database.RemoveEntry(message.ParentGroupId, message.EntryId);
|
||||||
|
//message.ParentGroup.Entries.Remove(message.Entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.RemoveGroup
|
||||||
|
{
|
||||||
|
public class RemoveGroupCommand : IRequest
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string GroupId { get; set; }
|
||||||
|
|
||||||
|
public class RemoveGroupCommandHandler : IAsyncRequestHandler<RemoveGroupCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public RemoveGroupCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(RemoveGroupCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
await _database.RemoveGroup(message.ParentGroupId, message.GroupId);
|
||||||
|
//message.ParentGroup.SubGroups.Remove(message.Group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.SortEntries
|
||||||
|
{
|
||||||
|
public class SortEntriesCommand : IRequest
|
||||||
|
{
|
||||||
|
public GroupVm Group { get; set; }
|
||||||
|
|
||||||
|
public class SortEntriesCommandHandler : IRequestHandler<SortEntriesCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SortEntriesCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SortEntriesCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
_database.SortEntries(message.Group.Id);
|
||||||
|
message.Group.Entries = message.Group.Entries.OrderBy(e => e.Title).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.SortGroups
|
||||||
|
{
|
||||||
|
public class SortGroupsCommand : IRequest
|
||||||
|
{
|
||||||
|
public GroupVm Group { get; set; }
|
||||||
|
|
||||||
|
public class SortGroupsCommandHandler : IRequestHandler<SortGroupsCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SortGroupsCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SortGroupsCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
_database.SortSubGroups(message.Group.Id);
|
||||||
|
message.Group.SubGroups = message.Group.SubGroups.OrderBy(g => g.Title).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Commands.UpdateGroup
|
||||||
|
{
|
||||||
|
public class UpdateGroupCommand : IRequest
|
||||||
|
{
|
||||||
|
public GroupVm Group { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public Icon Icon { get; set; }
|
||||||
|
|
||||||
|
public class UpdateGroupCommandHandler : IRequestHandler<UpdateGroupCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public UpdateGroupCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(UpdateGroupCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
|
var group = new GroupEntity
|
||||||
|
{
|
||||||
|
Id = message.Group.Id,
|
||||||
|
Name = message.Title,
|
||||||
|
Icon = message.Icon
|
||||||
|
};
|
||||||
|
_database.UpdateGroup(group);
|
||||||
|
message.Group.Title = message.Title;
|
||||||
|
message.Group.Icon = message.Icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
ModernKeePass.Application/Group/Models/GroupVm.cs
Normal file
39
ModernKeePass.Application/Group/Models/GroupVm.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Common.Mappings;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Models
|
||||||
|
{
|
||||||
|
public class GroupVm: IEntityVm, IMapFrom<GroupEntity>
|
||||||
|
{
|
||||||
|
public string ParentGroupId { get; set; }
|
||||||
|
public string ParentGroupName { get; set; }
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public Icon Icon { get; set; }
|
||||||
|
public List<GroupVm> SubGroups { get; set; }
|
||||||
|
public List<EntryVm> Entries { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Mapping(Profile profile)
|
||||||
|
{
|
||||||
|
profile.CreateMap<GroupEntity, GroupVm>()
|
||||||
|
.ForMember(d => d.ParentGroupId, opts => opts.MapFrom(s => s.ParentId))
|
||||||
|
.ForMember(d => d.ParentGroupName, opts => opts.MapFrom(s => s.ParentName))
|
||||||
|
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
||||||
|
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
||||||
|
.ForMember(d => d.Icon, opts => opts.MapFrom(s => s.Icon))
|
||||||
|
.ForMember(d => d.Entries, opts => opts.MapFrom(s => s.Entries))
|
||||||
|
.ForMember(d => d.SubGroups, opts => opts.MapFrom(s => s.SubGroups))
|
||||||
|
.MaxDepth(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Queries.GetAllGroups
|
||||||
|
{
|
||||||
|
public class GetAllGroupsQuery : IRequest<IEnumerable<GroupVm>>
|
||||||
|
{
|
||||||
|
public string GroupId { get; set; }
|
||||||
|
|
||||||
|
public class GetAllGroupsQueryHandler : IRequestHandler<GetAllGroupsQuery, IEnumerable<GroupVm>>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public GetAllGroupsQueryHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<GroupVm> Handle(GetAllGroupsQuery message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
var groups = new List<GroupVm> {_mapper.Map<GroupVm>(_database.GetGroup(message.GroupId))};
|
||||||
|
groups.AddRange(_database.GetAllGroups(message.GroupId).Select(g => _mapper.Map<GroupVm>(g)));
|
||||||
|
return groups;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Queries.GetGroup
|
||||||
|
{
|
||||||
|
public class GetGroupQuery : IRequest<GroupVm>
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public class GetGroupQueryHandler : IRequestHandler<GetGroupQuery, GroupVm>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public GetGroupQueryHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupVm Handle(GetGroupQuery message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
return _mapper.Map<GroupVm>(_database.GetGroup(message.Id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using AutoMapper;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Group.Queries.SearchEntries
|
||||||
|
{
|
||||||
|
public class SearchEntriesQuery : IRequest<IEnumerable<EntryVm>>
|
||||||
|
{
|
||||||
|
public string GroupId { get; set; }
|
||||||
|
public string SearchText { get; set; }
|
||||||
|
|
||||||
|
public class SearchEntriesQueryHandler : IRequestHandler<SearchEntriesQuery, IEnumerable<EntryVm>>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public SearchEntriesQueryHandler(IDatabaseProxy database, IMapper mapper)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<EntryVm> Handle(SearchEntriesQuery message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
return _database.Search(message.GroupId, message.SearchText).Select(e => _mapper.Map<EntryVm>(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Commands.SetCipher
|
||||||
|
{
|
||||||
|
public class SetCipherCommand : IRequest
|
||||||
|
{
|
||||||
|
public string CipherId { get; set; }
|
||||||
|
|
||||||
|
public class SetCipherCommandHandler : IRequestHandler<SetCipherCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SetCipherCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SetCipherCommand message)
|
||||||
|
{
|
||||||
|
if (_database.IsOpen) _database.CipherId = message.CipherId;
|
||||||
|
else throw new DatabaseClosedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Commands.SetCompression
|
||||||
|
{
|
||||||
|
public class SetCompressionCommand : IRequest
|
||||||
|
{
|
||||||
|
public string Compression { get; set; }
|
||||||
|
|
||||||
|
public class SetCompressionCommandHandler : IRequestHandler<SetCompressionCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SetCompressionCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SetCompressionCommand message)
|
||||||
|
{
|
||||||
|
if (_database.IsOpen) _database.Compression = message.Compression;
|
||||||
|
else throw new DatabaseClosedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Commands.SetHasRecycleBin
|
||||||
|
{
|
||||||
|
public class SetHasRecycleBinCommand : IRequest
|
||||||
|
{
|
||||||
|
public bool HasRecycleBin { get; set; }
|
||||||
|
|
||||||
|
public class SetHasRecycleBinCommandHandler : IRequestHandler<SetHasRecycleBinCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SetHasRecycleBinCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SetHasRecycleBinCommand message)
|
||||||
|
{
|
||||||
|
if (_database.IsOpen) _database.IsRecycleBinEnabled = message.HasRecycleBin;
|
||||||
|
else throw new DatabaseClosedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Commands.SetKeyDerivation
|
||||||
|
{
|
||||||
|
public class SetKeyDerivationCommand : IRequest
|
||||||
|
{
|
||||||
|
public string KeyDerivationId { get; set; }
|
||||||
|
|
||||||
|
public class SetKeyDerivationCommandHandler : IRequestHandler<SetKeyDerivationCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SetKeyDerivationCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SetKeyDerivationCommand message)
|
||||||
|
{
|
||||||
|
if (_database.IsOpen) _database.KeyDerivationId = message.KeyDerivationId;
|
||||||
|
else throw new DatabaseClosedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Common;
|
||||||
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
|
||||||
|
{
|
||||||
|
public class SetRecycleBinCommand : IRequest
|
||||||
|
{
|
||||||
|
public string RecycleBinId { get; set; }
|
||||||
|
|
||||||
|
public class SetRecycleBinCommandHandler : IRequestHandler<SetRecycleBinCommand>
|
||||||
|
{
|
||||||
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
|
public SetRecycleBinCommandHandler(IDatabaseProxy database)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SetRecycleBinCommand message)
|
||||||
|
{
|
||||||
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
_database.RecycleBinId = message.RecycleBinId ?? Constants.EmptyId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
ModernKeePass.Application/Parameters/Models/CipherVm.cs
Normal file
8
ModernKeePass.Application/Parameters/Models/CipherVm.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace ModernKeePass.Application.Parameters.Models
|
||||||
|
{
|
||||||
|
public class CipherVm
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
namespace ModernKeePass.Application.Parameters.Models
|
||||||
|
{
|
||||||
|
public class KeyDerivationVm
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Parameters.Models;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Queries.GetCiphers
|
||||||
|
{
|
||||||
|
public class GetCiphersQuery: IRequest<IEnumerable<CipherVm>>
|
||||||
|
{
|
||||||
|
public class GetCiphersQueryHandler: IRequestHandler<GetCiphersQuery, IEnumerable<CipherVm>>
|
||||||
|
{
|
||||||
|
private readonly ICryptographyClient _cryptography;
|
||||||
|
|
||||||
|
public GetCiphersQueryHandler(ICryptographyClient cryptography)
|
||||||
|
{
|
||||||
|
_cryptography = cryptography;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<CipherVm> Handle(GetCiphersQuery message)
|
||||||
|
{
|
||||||
|
return _cryptography.Ciphers.Select(c => new CipherVm
|
||||||
|
{
|
||||||
|
Id = c.Id,
|
||||||
|
Name = c.Name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Queries.GetCompressions
|
||||||
|
{
|
||||||
|
public class GetCompressionsQuery : IRequest<IEnumerable<string>>
|
||||||
|
{
|
||||||
|
public class GetCompressionsQueryHandler : IRequestHandler<GetCompressionsQuery, IEnumerable<string>>
|
||||||
|
{
|
||||||
|
private readonly ICryptographyClient _cryptography;
|
||||||
|
|
||||||
|
public GetCompressionsQueryHandler(ICryptographyClient cryptography)
|
||||||
|
{
|
||||||
|
_cryptography = cryptography;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> Handle(GetCompressionsQuery message)
|
||||||
|
{
|
||||||
|
return _cryptography.CompressionAlgorithms.OrderBy(c => c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Parameters.Models;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Parameters.Queries.GetKeyDerivations
|
||||||
|
{
|
||||||
|
public class GetKeyDerivationsQuery : IRequest<IEnumerable<KeyDerivationVm>>
|
||||||
|
{
|
||||||
|
public class GetKeyDerivationsQueryHandler : IRequestHandler<GetKeyDerivationsQuery, IEnumerable<KeyDerivationVm>>
|
||||||
|
{
|
||||||
|
private readonly ICryptographyClient _cryptography;
|
||||||
|
|
||||||
|
public GetKeyDerivationsQueryHandler(ICryptographyClient cryptography)
|
||||||
|
{
|
||||||
|
_cryptography = cryptography;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<KeyDerivationVm> Handle(GetKeyDerivationsQuery message)
|
||||||
|
{
|
||||||
|
return _cryptography.KeyDerivations.Select(c => new KeyDerivationVm
|
||||||
|
{
|
||||||
|
Id = c.Id,
|
||||||
|
Name = c.Name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
ModernKeePass.Application/Properties/AssemblyInfo.cs
Normal file
28
ModernKeePass.Application/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System.Resources;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("ModernKeePass.Application")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("ModernKeePass.Application")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Security.Commands.GenerateKeyFile
|
||||||
|
{
|
||||||
|
public class GenerateKeyFileCommand : IRequest
|
||||||
|
{
|
||||||
|
public string KeyFilePath { get; set; }
|
||||||
|
public bool AddAdditionalEntropy { get; set; }
|
||||||
|
|
||||||
|
public class GenerateKeyFileCommandHandler : IAsyncRequestHandler<GenerateKeyFileCommand>
|
||||||
|
{
|
||||||
|
private readonly ICredentialsProxy _security;
|
||||||
|
private readonly IFileProxy _file;
|
||||||
|
|
||||||
|
public GenerateKeyFileCommandHandler(ICredentialsProxy security, IFileProxy file)
|
||||||
|
{
|
||||||
|
_security = security;
|
||||||
|
_file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Handle(GenerateKeyFileCommand message)
|
||||||
|
{
|
||||||
|
byte[] entropy = null;
|
||||||
|
if (message.AddAdditionalEntropy)
|
||||||
|
{
|
||||||
|
entropy = new byte[10];
|
||||||
|
var random = new Random();
|
||||||
|
random.NextBytes(entropy);
|
||||||
|
}
|
||||||
|
var keyFile = _security.GenerateKeyFile(entropy);
|
||||||
|
await _file.WriteBinaryContentsToFile(message.KeyFilePath, keyFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,48 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Security.Commands.GeneratePassword
|
||||||
|
{
|
||||||
|
public class GeneratePasswordCommand: IRequest<string>
|
||||||
|
{
|
||||||
|
public int PasswordLength { get; set; }
|
||||||
|
public bool UpperCasePatternSelected { get; set; }
|
||||||
|
public bool LowerCasePatternSelected { get; set; }
|
||||||
|
public bool DigitsPatternSelected { get; set; }
|
||||||
|
public bool SpecialPatternSelected { get; set; }
|
||||||
|
public bool MinusPatternSelected { get; set; }
|
||||||
|
public bool UnderscorePatternSelected { get; set; }
|
||||||
|
public bool SpacePatternSelected { get; set; }
|
||||||
|
public bool BracketsPatternSelected { get; set; }
|
||||||
|
public string CustomChars { get; set; }
|
||||||
|
|
||||||
|
public class GeneratePasswordCommandHandler: IRequestHandler<GeneratePasswordCommand, string>
|
||||||
|
{
|
||||||
|
private readonly ICredentialsProxy _security;
|
||||||
|
|
||||||
|
public GeneratePasswordCommandHandler(ICredentialsProxy security)
|
||||||
|
{
|
||||||
|
_security = security;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Handle(GeneratePasswordCommand message)
|
||||||
|
{
|
||||||
|
var options = new PasswordGenerationOptions
|
||||||
|
{
|
||||||
|
PasswordLength = message.PasswordLength,
|
||||||
|
BracketsPatternSelected = message.BracketsPatternSelected,
|
||||||
|
CustomChars = message.CustomChars,
|
||||||
|
DigitsPatternSelected = message.DigitsPatternSelected,
|
||||||
|
LowerCasePatternSelected = message.LowerCasePatternSelected,
|
||||||
|
MinusPatternSelected = message.MinusPatternSelected,
|
||||||
|
SpacePatternSelected = message.SpacePatternSelected,
|
||||||
|
SpecialPatternSelected = message.SpecialPatternSelected,
|
||||||
|
UnderscorePatternSelected = message.UnderscorePatternSelected,
|
||||||
|
UpperCasePatternSelected = message.UpperCasePatternSelected
|
||||||
|
};
|
||||||
|
return _security.GeneratePassword(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,25 @@
|
|||||||
|
using MediatR;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity
|
||||||
|
{
|
||||||
|
public class EstimatePasswordComplexityQuery : IRequest<int>
|
||||||
|
{
|
||||||
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
public class EstimatePasswordComplexityQueryHandler : IRequestHandler<EstimatePasswordComplexityQuery, int>
|
||||||
|
{
|
||||||
|
private readonly ICredentialsProxy _security;
|
||||||
|
|
||||||
|
public EstimatePasswordComplexityQueryHandler(ICredentialsProxy security)
|
||||||
|
{
|
||||||
|
_security = security;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Handle(EstimatePasswordComplexityQuery message)
|
||||||
|
{
|
||||||
|
return _security.EstimatePasswordComplexity(message.Password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
ModernKeePass.Application/project.json
Normal file
16
ModernKeePass.Application/project.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"supports": {},
|
||||||
|
"dependencies": {
|
||||||
|
"AutoMapper": "5.2.0",
|
||||||
|
"FluentValidation": "8.6.2",
|
||||||
|
"MediatR": "3.0.1",
|
||||||
|
"MediatR.Extensions.Microsoft.DependencyInjection": "2.0.0",
|
||||||
|
"Microsoft.Extensions.DependencyInjection": "1.1.1",
|
||||||
|
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
|
||||||
|
"NETStandard.Library": "2.0.3",
|
||||||
|
"Splat": "3.0.0"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"netstandard1.2": {}
|
||||||
|
}
|
||||||
|
}
|
7
ModernKeePass.Domain/Common/Constants.cs
Normal file
7
ModernKeePass.Domain/Common/Constants.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Domain.Common
|
||||||
|
{
|
||||||
|
public static class Constants
|
||||||
|
{
|
||||||
|
public static string EmptyId => "00000000000000000000000000000000";
|
||||||
|
}
|
||||||
|
}
|
111
ModernKeePass.Domain/Domain.csproj
Normal file
111
ModernKeePass.Domain/Domain.csproj
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{9A0759F1-9069-4841-99E3-3BEC44E17356}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>ModernKeePass.Domain</RootNamespace>
|
||||||
|
<AssemblyName>ModernKeePass.Domain</AssemblyName>
|
||||||
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<TargetFrameworkProfile>
|
||||||
|
</TargetFrameworkProfile>
|
||||||
|
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||||
|
<None Include="project.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Common\Constants.cs" />
|
||||||
|
<Compile Include="Dtos\Credentials.cs" />
|
||||||
|
<Compile Include="Dtos\FileInfo.cs" />
|
||||||
|
<Compile Include="Dtos\PasswordGenerationOptions.cs" />
|
||||||
|
<Compile Include="Entities\BaseEntity.cs" />
|
||||||
|
<Compile Include="Entities\EntryEntity.cs" />
|
||||||
|
<Compile Include="Entities\GroupEntity.cs" />
|
||||||
|
<Compile Include="Enums\CredentialStatusTypes.cs" />
|
||||||
|
<Compile Include="Enums\DatabaseVersion.cs" />
|
||||||
|
<Compile Include="Enums\EntryFieldName.cs" />
|
||||||
|
<Compile Include="Enums\Icon.cs" />
|
||||||
|
<Compile Include="Enums\ImportFormat.cs" />
|
||||||
|
<Compile Include="Exceptions\DatabaseClosedException.cs" />
|
||||||
|
<Compile Include="Exceptions\DatabaseOpenException.cs" />
|
||||||
|
<Compile Include="Exceptions\DatabaseTooBigException.cs" />
|
||||||
|
<Compile Include="Exceptions\NavigationException.cs" />
|
||||||
|
<Compile Include="Exceptions\SaveException.cs" />
|
||||||
|
<Compile Include="Interfaces\IDateTime.cs" />
|
||||||
|
<Compile Include="Interfaces\IHasSelectableObject.cs" />
|
||||||
|
<Compile Include="Interfaces\IImportFormat.cs" />
|
||||||
|
<Compile Include="Interfaces\IIsEnabled.cs" />
|
||||||
|
<Compile Include="Interfaces\ISelectableModel.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
9
ModernKeePass.Domain/Dtos/Credentials.cs
Normal file
9
ModernKeePass.Domain/Dtos/Credentials.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace ModernKeePass.Domain.Dtos
|
||||||
|
{
|
||||||
|
public class Credentials
|
||||||
|
{
|
||||||
|
public string Password { get; set; }
|
||||||
|
public byte[] KeyFileContents { get; set; }
|
||||||
|
// TODO: add Windows Hello
|
||||||
|
}
|
||||||
|
}
|
9
ModernKeePass.Domain/Dtos/FileInfo.cs
Normal file
9
ModernKeePass.Domain/Dtos/FileInfo.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace ModernKeePass.Domain.Dtos
|
||||||
|
{
|
||||||
|
public class FileInfo
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Path { get; set; }
|
||||||
|
}
|
||||||
|
}
|
16
ModernKeePass.Domain/Dtos/PasswordGenerationOptions.cs
Normal file
16
ModernKeePass.Domain/Dtos/PasswordGenerationOptions.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
namespace ModernKeePass.Domain.Dtos
|
||||||
|
{
|
||||||
|
public class PasswordGenerationOptions
|
||||||
|
{
|
||||||
|
public int PasswordLength { get; set; }
|
||||||
|
public bool UpperCasePatternSelected { get; set; }
|
||||||
|
public bool LowerCasePatternSelected { get; set; }
|
||||||
|
public bool DigitsPatternSelected { get; set; }
|
||||||
|
public bool SpecialPatternSelected { get; set; }
|
||||||
|
public bool MinusPatternSelected { get; set; }
|
||||||
|
public bool UnderscorePatternSelected { get; set; }
|
||||||
|
public bool SpacePatternSelected { get; set; }
|
||||||
|
public bool BracketsPatternSelected { get; set; }
|
||||||
|
public string CustomChars { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
ModernKeePass.Domain/Entities/BaseEntity.cs
Normal file
13
ModernKeePass.Domain/Entities/BaseEntity.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Entities
|
||||||
|
{
|
||||||
|
public class BaseEntity
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string ParentId { get; set; }
|
||||||
|
public string ParentName { get; set; }
|
||||||
|
public DateTimeOffset LastModificationDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
22
ModernKeePass.Domain/Entities/EntryEntity.cs
Normal file
22
ModernKeePass.Domain/Entities/EntryEntity.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Entities
|
||||||
|
{
|
||||||
|
public class EntryEntity: BaseEntity
|
||||||
|
{
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string Password { get; set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
public string Notes { get; set; }
|
||||||
|
public DateTimeOffset ExpirationDate { get; set; }
|
||||||
|
public Dictionary<string, string> AdditionalFields { get; set; } = new Dictionary<string, string>();
|
||||||
|
public IEnumerable<EntryEntity> History { get; set; } = new List<EntryEntity>();
|
||||||
|
public Icon Icon { get; set; }
|
||||||
|
public Color ForegroundColor { get; set; }
|
||||||
|
public Color BackgroundColor { get; set; }
|
||||||
|
public bool HasExpirationDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
12
ModernKeePass.Domain/Entities/GroupEntity.cs
Normal file
12
ModernKeePass.Domain/Entities/GroupEntity.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Entities
|
||||||
|
{
|
||||||
|
public class GroupEntity : BaseEntity
|
||||||
|
{
|
||||||
|
public List<GroupEntity> SubGroups { get; set; } = new List<GroupEntity>();
|
||||||
|
public List<EntryEntity> Entries { get; set; } = new List<EntryEntity>();
|
||||||
|
public Icon Icon { get; set; }
|
||||||
|
}
|
||||||
|
}
|
10
ModernKeePass.Domain/Enums/CredentialStatusTypes.cs
Normal file
10
ModernKeePass.Domain/Enums/CredentialStatusTypes.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace ModernKeePass.Domain.Enums
|
||||||
|
{
|
||||||
|
public enum CredentialStatusTypes
|
||||||
|
{
|
||||||
|
Normal = 0,
|
||||||
|
Error = 1,
|
||||||
|
Warning = 3,
|
||||||
|
Success = 5
|
||||||
|
}
|
||||||
|
}
|
9
ModernKeePass.Domain/Enums/DatabaseVersion.cs
Normal file
9
ModernKeePass.Domain/Enums/DatabaseVersion.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace ModernKeePass.Domain.Enums
|
||||||
|
{
|
||||||
|
public enum DatabaseVersion
|
||||||
|
{
|
||||||
|
V2,
|
||||||
|
V3,
|
||||||
|
V4
|
||||||
|
}
|
||||||
|
}
|
16
ModernKeePass.Domain/Enums/EntryFieldName.cs
Normal file
16
ModernKeePass.Domain/Enums/EntryFieldName.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
namespace ModernKeePass.Domain.Enums
|
||||||
|
{
|
||||||
|
public static class EntryFieldName
|
||||||
|
{
|
||||||
|
public const string Title = nameof(Title);
|
||||||
|
public const string UserName = nameof(UserName);
|
||||||
|
public const string Password = nameof(Password);
|
||||||
|
public const string Url = nameof(Url);
|
||||||
|
public const string Notes = nameof(Notes);
|
||||||
|
public const string Icon = nameof(Icon);
|
||||||
|
public const string ExpirationDate = nameof(ExpirationDate);
|
||||||
|
public const string HasExpirationDate = nameof(HasExpirationDate);
|
||||||
|
public const string BackgroundColor = nameof(BackgroundColor);
|
||||||
|
public const string ForegroundColor = nameof(ForegroundColor);
|
||||||
|
}
|
||||||
|
}
|
54
ModernKeePass.Domain/Enums/Icon.cs
Normal file
54
ModernKeePass.Domain/Enums/Icon.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
namespace ModernKeePass.Domain.Enums
|
||||||
|
{
|
||||||
|
public enum Icon
|
||||||
|
{
|
||||||
|
Delete,
|
||||||
|
Edit,
|
||||||
|
Save,
|
||||||
|
Cancel,
|
||||||
|
Accept,
|
||||||
|
Home,
|
||||||
|
Camera,
|
||||||
|
Setting,
|
||||||
|
Mail,
|
||||||
|
Find,
|
||||||
|
Help,
|
||||||
|
Clock,
|
||||||
|
Crop,
|
||||||
|
World,
|
||||||
|
Flag,
|
||||||
|
PreviewLink,
|
||||||
|
Document,
|
||||||
|
ProtectedDocument,
|
||||||
|
ContactInfo,
|
||||||
|
ViewAll,
|
||||||
|
Rotate,
|
||||||
|
List,
|
||||||
|
Shop,
|
||||||
|
BrowsePhotos,
|
||||||
|
Caption,
|
||||||
|
Repair,
|
||||||
|
Page,
|
||||||
|
Paste,
|
||||||
|
Important,
|
||||||
|
SlideShow,
|
||||||
|
MapDrive,
|
||||||
|
ContactPresence,
|
||||||
|
Contact,
|
||||||
|
Folder,
|
||||||
|
View,
|
||||||
|
Permissions,
|
||||||
|
Map,
|
||||||
|
CellPhone,
|
||||||
|
OutlineStar,
|
||||||
|
Calculator,
|
||||||
|
Library,
|
||||||
|
SyncFolder,
|
||||||
|
GoToStart,
|
||||||
|
ZeroBars,
|
||||||
|
FourBars,
|
||||||
|
Scan,
|
||||||
|
ReportHacked,
|
||||||
|
Stop
|
||||||
|
}
|
||||||
|
}
|
7
ModernKeePass.Domain/Enums/ImportFormat.cs
Normal file
7
ModernKeePass.Domain/Enums/ImportFormat.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Domain.Enums
|
||||||
|
{
|
||||||
|
public enum ImportFormat
|
||||||
|
{
|
||||||
|
CSV
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Exceptions
|
||||||
|
{
|
||||||
|
public class DatabaseClosedException: Exception
|
||||||
|
{ }
|
||||||
|
}
|
7
ModernKeePass.Domain/Exceptions/DatabaseOpenException.cs
Normal file
7
ModernKeePass.Domain/Exceptions/DatabaseOpenException.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Exceptions
|
||||||
|
{
|
||||||
|
public class DatabaseOpenException: Exception
|
||||||
|
{ }
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Exceptions
|
||||||
|
{
|
||||||
|
public class DatabaseTooBigException: Exception { }
|
||||||
|
}
|
11
ModernKeePass.Domain/Exceptions/NavigationException.cs
Normal file
11
ModernKeePass.Domain/Exceptions/NavigationException.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Exceptions
|
||||||
|
{
|
||||||
|
public class NavigationException: Exception
|
||||||
|
{
|
||||||
|
public NavigationException(Type pageType) : base($"Failed to load Page {pageType.FullName}")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
ModernKeePass.Domain/Exceptions/SaveException.cs
Normal file
16
ModernKeePass.Domain/Exceptions/SaveException.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Exceptions
|
||||||
|
{
|
||||||
|
public class SaveException : Exception
|
||||||
|
{
|
||||||
|
public new string Message { get; }
|
||||||
|
public new string Source { get; }
|
||||||
|
|
||||||
|
public SaveException(Exception exception)
|
||||||
|
{
|
||||||
|
Message = exception.Message;
|
||||||
|
Source = exception.Source;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
ModernKeePass.Domain/Interfaces/IDateTime.cs
Normal file
9
ModernKeePass.Domain/Interfaces/IDateTime.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDateTime
|
||||||
|
{
|
||||||
|
DateTime Now { get; }
|
||||||
|
}
|
||||||
|
}
|
7
ModernKeePass.Domain/Interfaces/IHasSelectableObject.cs
Normal file
7
ModernKeePass.Domain/Interfaces/IHasSelectableObject.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Domain.Interfaces
|
||||||
|
{
|
||||||
|
public interface IHasSelectableObject
|
||||||
|
{
|
||||||
|
ISelectableModel SelectedItem { get; set; }
|
||||||
|
}
|
||||||
|
}
|
10
ModernKeePass.Domain/Interfaces/IImportFormat.cs
Normal file
10
ModernKeePass.Domain/Interfaces/IImportFormat.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Domain.Interfaces
|
||||||
|
{
|
||||||
|
public interface IImportFormat
|
||||||
|
{
|
||||||
|
Task<List<Dictionary<string, string>>> Import(string path);
|
||||||
|
}
|
||||||
|
}
|
7
ModernKeePass.Domain/Interfaces/IIsEnabled.cs
Normal file
7
ModernKeePass.Domain/Interfaces/IIsEnabled.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Domain.Interfaces
|
||||||
|
{
|
||||||
|
public interface IIsEnabled
|
||||||
|
{
|
||||||
|
bool IsEnabled { get; }
|
||||||
|
}
|
||||||
|
}
|
7
ModernKeePass.Domain/Interfaces/ISelectableModel.cs
Normal file
7
ModernKeePass.Domain/Interfaces/ISelectableModel.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Domain.Interfaces
|
||||||
|
{
|
||||||
|
public interface ISelectableModel
|
||||||
|
{
|
||||||
|
bool IsSelected { get; set; }
|
||||||
|
}
|
||||||
|
}
|
28
ModernKeePass.Domain/Properties/AssemblyInfo.cs
Normal file
28
ModernKeePass.Domain/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System.Resources;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("ModernKeePass.Domain")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("ModernKeePass.Domain")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
11
ModernKeePass.Domain/project.json
Normal file
11
ModernKeePass.Domain/project.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"supports": {},
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
|
||||||
|
"NETStandard.Library": "2.0.3",
|
||||||
|
"Splat": "3.0.0"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"netstandard1.2": {}
|
||||||
|
}
|
||||||
|
}
|
10
ModernKeePass.Infrastructure/Common/MachineDateTime.cs
Normal file
10
ModernKeePass.Infrastructure/Common/MachineDateTime.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using ModernKeePass.Domain.Interfaces;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.Common
|
||||||
|
{
|
||||||
|
public class MachineDateTime: IDateTime
|
||||||
|
{
|
||||||
|
public DateTime Now => DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
36
ModernKeePass.Infrastructure/DependencyInjection.cs
Normal file
36
ModernKeePass.Infrastructure/DependencyInjection.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Interfaces;
|
||||||
|
using ModernKeePass.Infrastructure.Common;
|
||||||
|
using ModernKeePass.Infrastructure.KeePass;
|
||||||
|
using ModernKeePass.Infrastructure.UWP;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure
|
||||||
|
{
|
||||||
|
public static class DependencyInjection
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddInfrastructureCommon(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddTransient(typeof(IDateTime), typeof(MachineDateTime));
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IServiceCollection AddInfrastructureKeePass(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton(typeof(IDatabaseProxy), typeof(KeePassDatabaseClient));
|
||||||
|
services.AddTransient(typeof(ICryptographyClient), typeof(KeePassCryptographyClient));
|
||||||
|
services.AddTransient(typeof(ICredentialsProxy), typeof(KeePassCredentialsClient));
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IServiceCollection AddInfrastructureUwp(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddScoped(typeof(IFileProxy), typeof(StorageFileClient));
|
||||||
|
services.AddTransient(typeof(ISettingsProxy), typeof(UwpSettingsClient));
|
||||||
|
services.AddTransient(typeof(IRecentProxy), typeof(UwpRecentFilesClient));
|
||||||
|
services.AddTransient(typeof(IResourceProxy), typeof(UwpResourceClient));
|
||||||
|
services.AddTransient(typeof(INotificationService), typeof(ToastNotificationService));
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
ModernKeePass.Infrastructure/File/CsvImportFormat.cs
Normal file
31
ModernKeePass.Infrastructure/File/CsvImportFormat.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.File
|
||||||
|
{
|
||||||
|
public class CsvImportFormat: IImportFormat
|
||||||
|
{
|
||||||
|
private const bool HasHeaderRow = true;
|
||||||
|
private const char Delimiter = ';';
|
||||||
|
private const char LineDelimiter = '\n';
|
||||||
|
|
||||||
|
public List<Dictionary<string, string>> Import(IList<string> fileContents)
|
||||||
|
{
|
||||||
|
var parsedResult = new List<Dictionary<string, string>>();
|
||||||
|
foreach (var line in fileContents)
|
||||||
|
{
|
||||||
|
var fields = line.Split(Delimiter);
|
||||||
|
var recordItem = new Dictionary<string, string>();
|
||||||
|
var i = 0;
|
||||||
|
foreach (var field in fields)
|
||||||
|
{
|
||||||
|
recordItem.Add(i.ToString(), field);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
parsedResult.Add(recordItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsedResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
122
ModernKeePass.Infrastructure/Infrastructure.csproj
Normal file
122
ModernKeePass.Infrastructure/Infrastructure.csproj
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{09577E4C-4899-45B9-BF80-1803D617CCAE}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>ModernKeePass.Infrastructure</RootNamespace>
|
||||||
|
<AssemblyName>ModernKeePass.Infrastructure</AssemblyName>
|
||||||
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<TargetFrameworkProfile>
|
||||||
|
</TargetFrameworkProfile>
|
||||||
|
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||||
|
<None Include="Libs\Windows.winmd" />
|
||||||
|
<None Include="project.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Common\MachineDateTime.cs" />
|
||||||
|
<Compile Include="DependencyInjection.cs" />
|
||||||
|
<Compile Include="File\CsvImportFormat.cs" />
|
||||||
|
<Compile Include="KeePass\EntryFieldMapper.cs" />
|
||||||
|
<Compile Include="KeePass\EntryMappingProfile.cs" />
|
||||||
|
<Compile Include="KeePass\GroupMappingProfile.cs" />
|
||||||
|
<Compile Include="KeePass\IconMapper.cs" />
|
||||||
|
<Compile Include="KeePass\KeePassCryptographyClient.cs" />
|
||||||
|
<Compile Include="KeePass\KeePassDatabaseClient.cs" />
|
||||||
|
<Compile Include="KeePass\KeePassCredentialsClient.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="UWP\StorageFileClient.cs" />
|
||||||
|
<Compile Include="UWP\ToastNotificationService.cs" />
|
||||||
|
<Compile Include="UWP\UwpRecentFilesClient.cs" />
|
||||||
|
<Compile Include="UWP\UwpResourceClient.cs" />
|
||||||
|
<Compile Include="UWP\UwpSettingsClient.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ModernKeePass.Application\Application.csproj">
|
||||||
|
<Project>{42353562-5e43-459c-8e3e-2f21e575261d}</Project>
|
||||||
|
<Name>Application</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\ModernKeePass.Domain\Domain.csproj">
|
||||||
|
<Project>{9a0759f1-9069-4841-99e3-3bec44e17356}</Project>
|
||||||
|
<Name>Domain</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Windows, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>Libs\Windows.winmd</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
33
ModernKeePass.Infrastructure/KeePass/EntryFieldMapper.cs
Normal file
33
ModernKeePass.Infrastructure/KeePass/EntryFieldMapper.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
using ModernKeePassLib;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.KeePass
|
||||||
|
{
|
||||||
|
public static class EntryFieldMapper
|
||||||
|
{
|
||||||
|
public static string MapPwDefsToField(string value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case PwDefs.TitleField: return EntryFieldName.Title;
|
||||||
|
case PwDefs.UserNameField: return EntryFieldName.UserName;
|
||||||
|
case PwDefs.PasswordField: return EntryFieldName.Password;
|
||||||
|
case PwDefs.NotesField: return EntryFieldName.Notes;
|
||||||
|
case PwDefs.UrlField: return EntryFieldName.Url;
|
||||||
|
default: return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static string MapFieldToPwDef(string value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case EntryFieldName.Title: return PwDefs.TitleField;
|
||||||
|
case EntryFieldName.UserName: return PwDefs.UserNameField;
|
||||||
|
case EntryFieldName.Password: return PwDefs.PasswordField;
|
||||||
|
case EntryFieldName.Notes: return PwDefs.NotesField;
|
||||||
|
case EntryFieldName.Url: return PwDefs.UrlField;
|
||||||
|
default: return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
ModernKeePass.Infrastructure/KeePass/EntryMappingProfile.cs
Normal file
35
ModernKeePass.Infrastructure/KeePass/EntryMappingProfile.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using AutoMapper;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
using ModernKeePassLib;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.KeePass
|
||||||
|
{
|
||||||
|
public class EntryMappingProfile: Profile
|
||||||
|
{
|
||||||
|
public EntryMappingProfile()
|
||||||
|
{
|
||||||
|
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))
|
||||||
|
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Uuid.ToHexString()))
|
||||||
|
.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.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))
|
||||||
|
.ForMember(dest => dest.ExpirationDate, opt => opt.MapFrom(src => new DateTimeOffset(src.ExpiryTime)))
|
||||||
|
.ForMember(dest => dest.HasExpirationDate, opt => opt.MapFrom(src => src.Expires))
|
||||||
|
.ForMember(dest => dest.Icon, opt => opt.MapFrom(src => IconMapper.MapPwIconToIcon(src.IconId)))
|
||||||
|
.ForMember(dest => dest.AdditionalFields, opt => opt.MapFrom(src =>
|
||||||
|
src.Strings.Where(s => !PwDefs.GetStandardFields().Contains(s.Key))
|
||||||
|
.ToDictionary(s => s.Key, s => GetEntryValue(src, s.Key))))
|
||||||
|
.ForMember(dest => dest.LastModificationDate, opt => opt.MapFrom(src => new DateTimeOffset(src.LastModificationTime)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetEntryValue(PwEntry entry, string key) => entry.Strings.GetSafe(key).ReadString();
|
||||||
|
}
|
||||||
|
}
|
23
ModernKeePass.Infrastructure/KeePass/GroupMappingProfile.cs
Normal file
23
ModernKeePass.Infrastructure/KeePass/GroupMappingProfile.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
using ModernKeePassLib;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.KeePass
|
||||||
|
{
|
||||||
|
public class GroupMappingProfile : Profile
|
||||||
|
{
|
||||||
|
public GroupMappingProfile()
|
||||||
|
{
|
||||||
|
CreateMap<PwGroup, GroupEntity>()
|
||||||
|
.ForMember(d => d.ParentId, opts => opts.MapFrom(s => s.ParentGroup.Uuid.ToHexString()))
|
||||||
|
.ForMember(d => d.ParentName, opts => opts.MapFrom(s => s.ParentGroup.Name))
|
||||||
|
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Uuid.ToHexString()))
|
||||||
|
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name))
|
||||||
|
.ForMember(d => d.Icon, opts => opts.MapFrom(s => IconMapper.MapPwIconToIcon(s.IconId)))
|
||||||
|
.ForMember(d => d.LastModificationDate, opts => opts.MapFrom(s => s.LastModificationTime))
|
||||||
|
.ForMember(d => d.Entries, opts => opts.MapFrom(s => s.Entries))
|
||||||
|
.ForMember(d => d.SubGroups, opts => opts.MapFrom(s => s.Groups))
|
||||||
|
.MaxDepth(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
ModernKeePass.Infrastructure/KeePass/IconMapper.cs
Normal file
126
ModernKeePass.Infrastructure/KeePass/IconMapper.cs
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
using ModernKeePassLib;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.KeePass
|
||||||
|
{
|
||||||
|
public static class IconMapper
|
||||||
|
{
|
||||||
|
public static Icon MapPwIconToIcon(PwIcon value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case PwIcon.Key: return Icon.Permissions;
|
||||||
|
case PwIcon.WorldSocket:
|
||||||
|
case PwIcon.World: return Icon.World;
|
||||||
|
case PwIcon.Warning: return Icon.Important;
|
||||||
|
case PwIcon.WorldComputer:
|
||||||
|
case PwIcon.Drive:
|
||||||
|
case PwIcon.DriveWindows:
|
||||||
|
case PwIcon.NetworkServer: return Icon.MapDrive;
|
||||||
|
case PwIcon.MarkedDirectory: return Icon.Map;
|
||||||
|
case PwIcon.UserCommunication: return Icon.ContactInfo;
|
||||||
|
case PwIcon.Parts: return Icon.ViewAll;
|
||||||
|
case PwIcon.Notepad: return Icon.Document;
|
||||||
|
case PwIcon.Identity: return Icon.Contact;
|
||||||
|
case PwIcon.PaperReady: return Icon.SyncFolder;
|
||||||
|
case PwIcon.Digicam: return Icon.Camera;
|
||||||
|
case PwIcon.IRCommunication: return Icon.View;
|
||||||
|
case PwIcon.Energy: return Icon.ZeroBars;
|
||||||
|
case PwIcon.Scanner: return Icon.Scan;
|
||||||
|
case PwIcon.CDRom: return Icon.Rotate;
|
||||||
|
case PwIcon.Monitor: return Icon.Caption;
|
||||||
|
case PwIcon.EMailBox:
|
||||||
|
case PwIcon.EMail: return Icon.Mail;
|
||||||
|
case PwIcon.Configuration: return Icon.Setting;
|
||||||
|
case PwIcon.ClipboardReady: return Icon.Paste;
|
||||||
|
case PwIcon.PaperNew: return Icon.Page;
|
||||||
|
case PwIcon.Screen: return Icon.GoToStart;
|
||||||
|
case PwIcon.EnergyCareful: return Icon.FourBars;
|
||||||
|
case PwIcon.Disk: return Icon.Save;
|
||||||
|
case PwIcon.Console: return Icon.SlideShow;
|
||||||
|
case PwIcon.Printer: return Icon.Scan;
|
||||||
|
case PwIcon.ProgramIcons: return Icon.GoToStart;
|
||||||
|
case PwIcon.Settings:
|
||||||
|
case PwIcon.Tool: return Icon.Repair;
|
||||||
|
case PwIcon.Archive: return Icon.Crop;
|
||||||
|
case PwIcon.Count: return Icon.Calculator;
|
||||||
|
case PwIcon.Clock: return Icon.Clock;
|
||||||
|
case PwIcon.EMailSearch: return Icon.Find;
|
||||||
|
case PwIcon.PaperFlag: return Icon.Flag;
|
||||||
|
case PwIcon.TrashBin: return Icon.Delete;
|
||||||
|
case PwIcon.Expired: return Icon.ReportHacked;
|
||||||
|
case PwIcon.Info: return Icon.Help;
|
||||||
|
case PwIcon.Folder:
|
||||||
|
case PwIcon.FolderOpen:
|
||||||
|
case PwIcon.FolderPackage: return Icon.Folder;
|
||||||
|
case PwIcon.PaperLocked: return Icon.ProtectedDocument;
|
||||||
|
case PwIcon.Checked: return Icon.Accept;
|
||||||
|
case PwIcon.Pen: return Icon.Edit;
|
||||||
|
case PwIcon.Thumbnail: return Icon.BrowsePhotos;
|
||||||
|
case PwIcon.Book: return Icon.Library;
|
||||||
|
case PwIcon.List: return Icon.List;
|
||||||
|
case PwIcon.UserKey: return Icon.ContactPresence;
|
||||||
|
case PwIcon.Home: return Icon.Home;
|
||||||
|
case PwIcon.Star: return Icon.OutlineStar;
|
||||||
|
case PwIcon.Money: return Icon.Shop;
|
||||||
|
case PwIcon.Certificate: return Icon.PreviewLink;
|
||||||
|
case PwIcon.BlackBerry: return Icon.CellPhone;
|
||||||
|
default: return Icon.Stop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PwIcon MapIconToPwIcon(Icon value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case Icon.Delete: return PwIcon.TrashBin;
|
||||||
|
case Icon.Edit: return PwIcon.Pen;
|
||||||
|
case Icon.Save: return PwIcon.Disk;
|
||||||
|
case Icon.Cancel: return PwIcon.Expired;
|
||||||
|
case Icon.Accept: return PwIcon.Checked;
|
||||||
|
case Icon.Home: return PwIcon.Home;
|
||||||
|
case Icon.Camera: return PwIcon.Digicam;
|
||||||
|
case Icon.Setting: return PwIcon.Configuration;
|
||||||
|
case Icon.Mail: return PwIcon.EMail;
|
||||||
|
case Icon.Find: return PwIcon.EMailSearch;
|
||||||
|
case Icon.Help: return PwIcon.Info;
|
||||||
|
case Icon.Clock: return PwIcon.Clock;
|
||||||
|
case Icon.Crop: return PwIcon.Archive;
|
||||||
|
case Icon.World: return PwIcon.World;
|
||||||
|
case Icon.Flag: return PwIcon.PaperFlag;
|
||||||
|
case Icon.PreviewLink: return PwIcon.Certificate;
|
||||||
|
case Icon.Document: return PwIcon.Notepad;
|
||||||
|
case Icon.ProtectedDocument: return PwIcon.PaperLocked;
|
||||||
|
case Icon.ContactInfo: return PwIcon.UserCommunication;
|
||||||
|
case Icon.ViewAll: return PwIcon.Parts;
|
||||||
|
case Icon.Rotate: return PwIcon.CDRom;
|
||||||
|
case Icon.List: return PwIcon.List;
|
||||||
|
case Icon.Shop: return PwIcon.Money;
|
||||||
|
case Icon.BrowsePhotos: return PwIcon.Thumbnail;
|
||||||
|
case Icon.Caption: return PwIcon.Monitor;
|
||||||
|
case Icon.Repair: return PwIcon.Tool;
|
||||||
|
case Icon.Page: return PwIcon.PaperNew;
|
||||||
|
case Icon.Paste: return PwIcon.ClipboardReady;
|
||||||
|
case Icon.Important: return PwIcon.Warning;
|
||||||
|
case Icon.SlideShow: return PwIcon.Console;
|
||||||
|
case Icon.MapDrive: return PwIcon.NetworkServer;
|
||||||
|
case Icon.ContactPresence: return PwIcon.UserKey;
|
||||||
|
case Icon.Contact: return PwIcon.Identity;
|
||||||
|
case Icon.Folder: return PwIcon.Folder;
|
||||||
|
case Icon.View: return PwIcon.IRCommunication;
|
||||||
|
case Icon.Permissions: return PwIcon.Key;
|
||||||
|
case Icon.Map: return PwIcon.MarkedDirectory;
|
||||||
|
case Icon.CellPhone: return PwIcon.BlackBerry;
|
||||||
|
case Icon.OutlineStar: return PwIcon.Star;
|
||||||
|
case Icon.Calculator: return PwIcon.Count;
|
||||||
|
case Icon.Library: return PwIcon.Book;
|
||||||
|
case Icon.SyncFolder: return PwIcon.PaperReady;
|
||||||
|
case Icon.GoToStart: return PwIcon.Screen;
|
||||||
|
case Icon.ZeroBars: return PwIcon.Energy;
|
||||||
|
case Icon.FourBars: return PwIcon.EnergyCareful;
|
||||||
|
case Icon.Scan: return PwIcon.Scanner;
|
||||||
|
default: return PwIcon.Key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,48 @@
|
|||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
using ModernKeePassLib.Cryptography;
|
||||||
|
using ModernKeePassLib.Cryptography.PasswordGenerator;
|
||||||
|
using ModernKeePassLib.Keys;
|
||||||
|
using ModernKeePassLib.Security;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.KeePass
|
||||||
|
{
|
||||||
|
public class KeePassCredentialsClient: ICredentialsProxy
|
||||||
|
{
|
||||||
|
public string GeneratePassword(PasswordGenerationOptions options)
|
||||||
|
{
|
||||||
|
var pwProfile = new PwProfile
|
||||||
|
{
|
||||||
|
GeneratorType = PasswordGeneratorType.CharSet,
|
||||||
|
Length = (uint)options.PasswordLength,
|
||||||
|
CharSet = new PwCharSet()
|
||||||
|
};
|
||||||
|
|
||||||
|
if (options.UpperCasePatternSelected) pwProfile.CharSet.Add(PwCharSet.UpperCase);
|
||||||
|
if (options.LowerCasePatternSelected) pwProfile.CharSet.Add(PwCharSet.LowerCase);
|
||||||
|
if (options.DigitsPatternSelected) pwProfile.CharSet.Add(PwCharSet.Digits);
|
||||||
|
if (options.SpecialPatternSelected) pwProfile.CharSet.Add(PwCharSet.Special);
|
||||||
|
if (options.MinusPatternSelected) pwProfile.CharSet.Add('-');
|
||||||
|
if (options.UnderscorePatternSelected) pwProfile.CharSet.Add('_');
|
||||||
|
if (options.SpacePatternSelected) pwProfile.CharSet.Add(' ');
|
||||||
|
if (options.BracketsPatternSelected) pwProfile.CharSet.Add(PwCharSet.Brackets);
|
||||||
|
|
||||||
|
pwProfile.CharSet.Add(options.CustomChars);
|
||||||
|
|
||||||
|
ProtectedString password;
|
||||||
|
PwGenerator.Generate(out password, pwProfile, null, new CustomPwGeneratorPool());
|
||||||
|
|
||||||
|
return password.ReadString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int EstimatePasswordComplexity(string password)
|
||||||
|
{
|
||||||
|
return (int)QualityEstimation.EstimatePasswordBits(password?.ToCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] GenerateKeyFile(byte[] additionalEntropy)
|
||||||
|
{
|
||||||
|
return KcpKeyFile.Create(additionalEntropy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
|
using ModernKeePassLib;
|
||||||
|
using ModernKeePassLib.Cryptography.Cipher;
|
||||||
|
using ModernKeePassLib.Cryptography.KeyDerivation;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Infrastructure.KeePass
|
||||||
|
{
|
||||||
|
public class KeePassCryptographyClient: ICryptographyClient
|
||||||
|
{
|
||||||
|
public IEnumerable<BaseEntity> Ciphers
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
for (var inx = 0; inx < CipherPool.GlobalPool.EngineCount; inx++)
|
||||||
|
{
|
||||||
|
var cipher = CipherPool.GlobalPool[inx];
|
||||||
|
yield return new BaseEntity
|
||||||
|
{
|
||||||
|
Id = cipher.CipherUuid.ToHexString(),
|
||||||
|
Name = cipher.DisplayName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<BaseEntity> KeyDerivations => KdfPool.Engines.Select(e => new BaseEntity
|
||||||
|
{
|
||||||
|
Id = e.Uuid.ToHexString(),
|
||||||
|
Name = e.Name
|
||||||
|
});
|
||||||
|
|
||||||
|
public IEnumerable<string> CompressionAlgorithms => Enum.GetNames(typeof(PwCompressionAlgorithm)).Take((int) PwCompressionAlgorithm.Count);
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user