Skip to content

Commit

Permalink
Added more kdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Trotsenko committed Nov 10, 2022
1 parent c15f9f3 commit e143db6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, EntryValue>
) : Map<String, EntryValue> by fields {
Expand Down Expand Up @@ -46,6 +50,10 @@ class EntryFields(
companion object {
fun of(vararg pairs: Pair<String, EntryValue>) = EntryFields(mapOf(*pairs))

/**
* Creates [EntryFields] which is populated with empty [BasicField]
* values as required by KeePass contract.
*/
fun createDefault() = EntryFields(
buildMap {
BasicField
Expand Down

0 comments on commit e143db6

Please sign in to comment.