Home

Awesome

Kotpass

Build & Test codecov badge

The library offers reading and writing support for KeePass (KDBX) files in Kotlin, including the latest format version 4.1. It is suitable for Mobile, Desktop, and Backend JVM projects. The functional style API makes it convenient for MVI-like architectures.

See it in action

This library is used as backbone of KeeMobile password manager, check it out:

<img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png' width='160'/>

Installation

The latest release is available on Maven Central.

dependencies {
    implementation("app.keemobile:kotpass:0.10.0")
}

Usage

🧬 Api reference

Reading from file:

val credentials = Credentials.from(EncryptedValue.fromString("passphrase"))
val database = File("testfile.kdbx")
    .inputStream()
    .use { inputStream ->
        KeePassDatabase.decode(inputStream, credentials)
    }    

KeePassDatabase is represented as immutable object, in order to alter it use a set of modifier extensions.

Each time new KeePassDatabase object is returned:

val groupUuid = UUID.fromString("c997344c-952b-e02b-06a6-29510ce71a12")
val newDatabase = database
    .modifyMeta {
        copy(generator = "Lorem ipsum")
    }.modifyGroup(groupUuid) {
        copy(name = "Hello kotpass!")
    }