Skip to content

Commit

Permalink
Add support for key files
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorGrycuk committed May 14, 2021
1 parent 169eeb9 commit 7a3731c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions StreamDeck-KeePass/StreamDeck-KeePass/KeePassRetrieve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static PluginSettings CreateDefaultSettings()
{
DBPath = string.Empty,
Password = string.Empty,
KeyFilePath = string.Empty,
EntryTitle = string.Empty,
Field = string.Empty
};
Expand All @@ -34,6 +35,9 @@ public static PluginSettings CreateDefaultSettings()
[JsonProperty(PropertyName = "Password")]
public string Password { get; set; }

[JsonProperty(PropertyName = "keyFilePath")]
public string KeyFilePath { get; set; }

[JsonProperty(PropertyName = "entryTitle")]
public string EntryTitle { get; set; }

Expand Down Expand Up @@ -70,6 +74,10 @@ public override void KeyPressed(KeyPayload payload)
var conn = new IOConnectionInfo { Path = settings.DBPath };
var compKey = new CompositeKey();
compKey.AddUserKey(new KcpPassword(settings.Password));
if (!string.IsNullOrEmpty(settings.KeyFilePath))
{
compKey.AddUserKey(new KcpKeyFile(settings.KeyFilePath));
}
var db = new KeePassLib.PwDatabase();
db.Open(conn, compKey, null);
var entryList = from entry in db.RootGroup.GetEntries(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<div class="sdpi-item-label">KeePass db path</div>
<input class="sdpi-item-value sdProperty" placeholder="The filepath to your KeePass .kdbx" value="" id="DBPath">
</div>
<div class="sdpi-item" id="dvPassword">
<div class="sdpi-item-label">(Optional) Key File path</div>
<input class="sdpi-item-value sdProperty" placeholder="The path of the key file for the .kdbx" value="" id="keyFilePath" oninput="setSettings()">
</div>
<div class="sdpi-item" id="dvPassword">
<div class="sdpi-item-label">KeePass db password</div>
<input class="sdpi-item-value sdProperty" placeholder="The password for the .kdbx" value="" id="Password" oninput="setSettings()" type="password">
Expand Down
2 changes: 1 addition & 1 deletion StreamDeck-KeePass/StreamDeck-KeePass/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"Description": "Simple interface to retrieve information from KeePass database. Unofficial.",
"Icon": "Images/pluginIcon",
"URL": "https://github.com/VictorGrycuk/StreamDeck-KeePass",
"Version": "1.3.1",
"Version": "1.4.0",
"CodePath": "streamdeck-keepass",
"Category": "KeePass",
"CategoryIcon": "Images/categoryIcon",
Expand Down

0 comments on commit 7a3731c

Please sign in to comment.