-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 2024.11.1: Kotlin 2.0.21 + other libraries, gradle 8.11.1 mig…
…rate from openkeepass to KeePassJava2, remove detekt
- Loading branch information
Showing
11 changed files
with
52 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
konfy-keepass/src/main/kotlin/tanvd/konfy/keepass/KeepassClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
package tanvd.konfy.keepass | ||
|
||
import de.slackspace.openkeepass.KeePassDatabase | ||
import de.slackspace.openkeepass.domain.KeePassFile | ||
import org.linguafranca.pwdb.kdbx.KdbxCreds | ||
import org.linguafranca.pwdb.kdbx.dom.DomDatabaseWrapper | ||
import java.io.File | ||
|
||
internal class KeepassClient(databaseFile: File, masterPassword: String) { | ||
private lateinit var database: KeePassFile | ||
private lateinit var database: DomDatabaseWrapper | ||
|
||
init { | ||
if (databaseFile.exists()) database = KeePassDatabase.getInstance(databaseFile).openDatabase(masterPassword) | ||
val credentials = KdbxCreds(masterPassword.toByteArray()) | ||
if (databaseFile.exists()) database = DomDatabaseWrapper.load(credentials, databaseFile.inputStream()) | ||
} | ||
|
||
fun get(title: String): String? { | ||
return database.getEntryByTitle(title)?.password | ||
return database.findEntries { it.title == title }.firstOrNull()?.password | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters