diff --git a/kotpass/src/main/kotlin/app/keemobile/kotpass/constants/BasicField.kt b/kotpass/src/main/kotlin/app/keemobile/kotpass/constants/BasicField.kt index 8f9552e..a51e0d4 100644 --- a/kotpass/src/main/kotlin/app/keemobile/kotpass/constants/BasicField.kt +++ b/kotpass/src/main/kotlin/app/keemobile/kotpass/constants/BasicField.kt @@ -1,5 +1,8 @@ package app.keemobile.kotpass.constants +/** + * Basic fields which should be added to every entry. + */ enum class BasicField(val key: String) { Title("Title"), UserName("UserName"), diff --git a/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomDataValue.kt b/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomDataValue.kt index a559665..d39b7a1 100644 --- a/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomDataValue.kt +++ b/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomDataValue.kt @@ -2,6 +2,9 @@ package app.keemobile.kotpass.models import java.time.Instant +/** + * Arbitrary string data holder for database/group/entry metadata. + */ data class CustomDataValue( val value: String, val lastModified: Instant? = null diff --git a/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomIcon.kt b/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomIcon.kt index 41acc24..8f2d320 100644 --- a/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomIcon.kt +++ b/kotpass/src/main/kotlin/app/keemobile/kotpass/models/CustomIcon.kt @@ -2,6 +2,14 @@ package app.keemobile.kotpass.models import java.time.Instant +/** + * Extra icon added by user to the database. Can be used + * for customizing groups and entries. + * + * @property data contains the icon image data as binary blob. + * @property name optionally given to icon. + * @property lastModified timestamp. + */ data class CustomIcon( val data: ByteArray, val name: String?, diff --git a/kotpass/src/main/kotlin/app/keemobile/kotpass/models/EntryFields.kt b/kotpass/src/main/kotlin/app/keemobile/kotpass/models/EntryFields.kt index a2f58eb..9905e53 100644 --- a/kotpass/src/main/kotlin/app/keemobile/kotpass/models/EntryFields.kt +++ b/kotpass/src/main/kotlin/app/keemobile/kotpass/models/EntryFields.kt @@ -3,6 +3,10 @@ package app.keemobile.kotpass.models import app.keemobile.kotpass.constants.BasicField import app.keemobile.kotpass.cryptography.EncryptedValue +/** + * Wraps [Map] to override [equals] and take into + * account order of items in equality checks. + */ class EntryFields( private val fields: Map ) : Map by fields { @@ -46,6 +50,10 @@ class EntryFields( companion object { fun of(vararg pairs: Pair) = EntryFields(mapOf(*pairs)) + /** + * Creates [EntryFields] which is populated with empty [BasicField] + * values as required by KeePass contract. + */ fun createDefault() = EntryFields( buildMap { BasicField