Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor Android kotlin implementation to work with new Item based structure (#1404)
Leendert de Borst5d9b9476a421
diff --git a/apps/mobile-app/android/.editorconfig b/apps/mobile-app/android/.editorconfigindex af1b8d059..43e55bcf9 100644--- a/apps/mobile-app/android/.editorconfig+++ b/apps/mobile-app/android/.editorconfig@@ -17,5 +17,9 @@ ktlint_standard_comment-wrapping = truektlint_standard_annotation = truektlint_standard_public-method-documentation = true+[**/uniffi/**/*.kt]+ktlint_standard_filename = disabled+ktlint_standard_package-name = disabled+# Detekt rulesdetekt.style.PublicFunctionDocumentation = enableddiff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.ktindex 49b610779..f325badd0 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/nativevaultmanager/NativeVaultManager.kt@@ -1145,7 +1145,7 @@ class NativeVaultManager(reactContext: ReactApplicationContext) :* @param promise The promise to resolve with VaultSyncResult.*/@ReactMethod- fun syncVaultWithServer(promise: Promise) {+ override fun syncVaultWithServer(promise: Promise) {CoroutineScope(Dispatchers.IO).launch {try {val result = vaultStore.syncVaultWithServer(webApiService)@@ -1371,7 +1371,7 @@ class NativeVaultManager(reactContext: ReactApplicationContext) :* @param promise The promise to resolve.*/@ReactMethod- fun getSyncState(promise: Promise) {+ override fun getSyncState(promise: Promise) {try {val syncState = vaultStore.getSyncState()val result = Arguments.createMap()@@ -1395,7 +1395,7 @@ class NativeVaultManager(reactContext: ReactApplicationContext) :* @param promise The promise to resolve with boolean indicating if dirty flag was cleared.*/@ReactMethod- fun markVaultClean(mutationSeqAtStart: Double, newServerRevision: Double, promise: Promise) {+ override fun markVaultClean(mutationSeqAtStart: Double, newServerRevision: Double, promise: Promise) {try {val cleared = vaultStore.markVaultClean(mutationSeqAtStart = mutationSeqAtStart.toInt(),diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/rustcore/VaultMergeService.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/rustcore/VaultMergeService.ktindex 9001234f3..b137608f9 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/rustcore/VaultMergeService.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/rustcore/VaultMergeService.kt@@ -20,10 +20,28 @@ object VaultMergeService {Log.d(TAG, "Rust core library loaded")}+ /**+ * Base exception for vault merge operations.+ */sealed class VaultMergeException(message: String) : Exception(message) {+ /**+ * Exception thrown when JSON parsing or serialization fails.+ */class JsonError(message: String) : VaultMergeException("JSON error: $message")++ /**+ * Exception thrown when Rust core operations fail.+ */class RustError(message: String) : VaultMergeException("Rust error: $message")++ /**+ * Exception thrown when database operations fail.+ */class DatabaseError(message: String) : VaultMergeException("Database error: $message")++ /**+ * Exception thrown when input validation fails.+ */class InvalidInput(message: String) : VaultMergeException("Invalid input: $message")}@@ -37,6 +55,7 @@ object VaultMergeService {/*** Merge local and server vaults using LWW strategy.*/+ @Suppress("SwallowedException") // Exceptions are logged and re-thrown with context@Throws(VaultMergeException::class)fun mergeVaults(localVaultBase64: String,@@ -48,12 +67,14 @@ object VaultMergeService {val localDecrypted = try {VaultCrypto.decrypt(Base64.decode(localVaultBase64, Base64.DEFAULT), encryptionKey)} catch (e: Exception) {+ Log.e(TAG, "Failed to decrypt local vault", e)throw VaultMergeException.InvalidInput("Failed to decrypt local vault: ${e.message}")}val serverDecrypted = try {VaultCrypto.decrypt(Base64.decode(serverVaultBase64, Base64.DEFAULT), encryptionKey)} catch (e: Exception) {+ Log.e(TAG, "Failed to decrypt server vault", e)throw VaultMergeException.InvalidInput("Failed to decrypt server vault: ${e.message}")}@@ -129,6 +150,7 @@ object VaultMergeService {/*** Prune expired items from trash.*/+ @Suppress("SwallowedException") // Exceptions are logged and re-thrown with context@Throws(VaultMergeException::class)fun pruneVault(vaultBase64: String,@@ -139,6 +161,7 @@ object VaultMergeService {val decrypted = try {VaultCrypto.decrypt(Base64.decode(vaultBase64, Base64.DEFAULT), encryptionKey)} catch (e: Exception) {+ Log.e(TAG, "Failed to decrypt vault for pruning", e)throw VaultMergeException.InvalidInput("Failed to decrypt vault: ${e.message}")}diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/ItemTypeIcon.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/ItemTypeIcon.ktindex 2fcffe23d..a72e98dbc 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/ItemTypeIcon.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/ItemTypeIcon.kt@@ -10,23 +10,30 @@ import android.graphics.RectFimport android.graphics.Typeface/**- * Item type icon helper - provides bitmap-based icons for different item types- * Matches the design from browser extension and iOS implementations+ * Item type icon helper - provides bitmap-based icons for different item types.+ * Matches the design from browser extension and iOS implementations.*/object ItemTypeIcon {/**- * Item type enumeration matching the database model+ * Item type enumeration matching the database model.*/object ItemType {+ /** Login item type constant. */const val LOGIN = "Login"++ /** Alias item type constant. */const val ALIAS = "Alias"++ /** Credit card item type constant. */const val CREDIT_CARD = "CreditCard"++ /** Note item type constant. */const val NOTE = "Note"}/**- * Credit card brand type+ * Credit card brand type.*/enum class CardBrand {VISA,@@ -38,9 +45,10 @@ object ItemTypeIcon {companion object {/**- * Detect credit card brand from card number using industry-standard prefixes- * @param cardNumber The card number to detect brand from- * @return The detected card brand+ * Detect credit card brand from card number using industry-standard prefixes.+ *+ * @param cardNumber The card number to detect brand from.+ * @return The detected card brand.*/fun detect(cardNumber: String?): CardBrand {if (cardNumber.isNullOrEmpty()) {@@ -87,13 +95,15 @@ object ItemTypeIcon {private const val COLOR_LIGHTER = "#fbcb74"/**- * Get the appropriate icon bitmap for an item type- * @param context Android context- * @param itemType The item type (Login, Alias, CreditCard, Note)- * @param cardNumber Optional card number for credit card brand detection- * @param size Icon size in pixels (default 96)- * @return Bitmap icon+ * Get the appropriate icon bitmap for an item type.+ *+ * @param context Android context.+ * @param itemType The item type (Login, Alias, CreditCard, Note).+ * @param cardNumber Optional card number for credit card brand detection.+ * @param size Icon size in pixels (default 96).+ * @return Bitmap icon.*/+ @Suppress("UNUSED_PARAMETER") // Context reserved for future use (loading drawable resources)fun getIcon(context: Context,itemType: String,@@ -112,7 +122,11 @@ object ItemTypeIcon {}/**- * Get the appropriate icon for a credit card brand+ * Get the appropriate icon for a credit card brand.+ *+ * @param brand The credit card brand.+ * @param size Icon size in pixels (default 96).+ * @return Bitmap icon.*/fun getCardIcon(brand: CardBrand, size: Int = 96): Bitmap {return when (brand) {@@ -125,7 +139,10 @@ object ItemTypeIcon {}/**- * Create generic credit card icon+ * Create generic credit card icon.+ *+ * @param size Icon size in pixels.+ * @return Bitmap icon.*/private fun createCreditCardIcon(size: Int): Bitmap {val bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)@@ -169,7 +186,10 @@ object ItemTypeIcon {}/**- * Create Visa icon+ * Create Visa icon.+ *+ * @param size Icon size in pixels.+ * @return Bitmap icon.*/private fun createVisaIcon(size: Int): Bitmap {val bitmap = createCreditCardIcon(size)@@ -185,7 +205,10 @@ object ItemTypeIcon {}/**- * Create Mastercard icon+ * Create Mastercard icon.+ *+ * @param size Icon size in pixels.+ * @return Bitmap icon.*/private fun createMastercardIcon(size: Int): Bitmap {val bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)@@ -221,7 +244,10 @@ object ItemTypeIcon {}/**- * Create Amex icon+ * Create Amex icon.+ *+ * @param size Icon size in pixels.+ * @return Bitmap icon.*/private fun createAmexIcon(size: Int): Bitmap {val bitmap = createCreditCardIcon(size)@@ -238,7 +264,10 @@ object ItemTypeIcon {}/**- * Create Discover icon+ * Create Discover icon.+ *+ * @param size Icon size in pixels.+ * @return Bitmap icon.*/private fun createDiscoverIcon(size: Int): Bitmap {val bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)@@ -269,7 +298,10 @@ object ItemTypeIcon {}/**- * Create note/document icon+ * Create note/document icon.+ *+ * @param size Icon size in pixels.+ * @return Bitmap icon.*/private fun createNoteIcon(size: Int): Bitmap {val bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)@@ -323,7 +355,10 @@ object ItemTypeIcon {}/**- * Create placeholder key icon for Login/Alias+ * Create placeholder key icon for Login/Alias.+ *+ * @param size Icon size in pixels.+ * @return Bitmap icon.*/private fun createPlaceholderIcon(size: Int): Bitmap {val bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.ktindex f20ce0bdc..6e4370c3f 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.kt@@ -26,6 +26,52 @@ class VaultCrypto(companion object {private const val TAG = "VaultCrypto"private const val BIOMETRICS_AUTH_METHOD = "faceid"++ /**+ * Raw AES-GCM encryption (for VaultMergeService).+ * Encrypts data using AES-256-GCM with a provided key.+ */+ fun encrypt(data: ByteArray, key: ByteArray): ByteArray {+ require(key.size == 32) { "Encryption key must be 32 bytes (256 bits)" }++ // Generate a random 12-byte nonce (IV)+ val nonce = ByteArray(12)+ SecureRandom().nextBytes(nonce)++ // Create cipher+ val cipher = Cipher.getInstance("AES/GCM/NoPadding")+ val secretKey = SecretKeySpec(key, "AES")+ val gcmSpec = GCMParameterSpec(128, nonce) // 128-bit auth tag++ // Encrypt+ cipher.init(Cipher.ENCRYPT_MODE, secretKey, gcmSpec)+ val ciphertext = cipher.doFinal(data)++ // Return: nonce + ciphertext + tag (tag is included in ciphertext by GCM)+ return nonce + ciphertext+ }++ /**+ * Raw AES-GCM decryption (for VaultMergeService).+ * Decrypts data using AES-256-GCM with a provided key.+ */+ fun decrypt(encryptedData: ByteArray, key: ByteArray): ByteArray {+ require(key.size == 32) { "Decryption key must be 32 bytes (256 bits)" }+ require(encryptedData.size >= 12) { "Encrypted data too short" }++ // Extract nonce (first 12 bytes) and ciphertext (rest)+ val nonce = encryptedData.sliceArray(0 until 12)+ val ciphertext = encryptedData.sliceArray(12 until encryptedData.size)++ // Create cipher+ val cipher = Cipher.getInstance("AES/GCM/NoPadding")+ val secretKey = SecretKeySpec(key, "AES")+ val gcmSpec = GCMParameterSpec(128, nonce)++ // Decrypt+ cipher.init(Cipher.DECRYPT_MODE, secretKey, gcmSpec)+ return cipher.doFinal(ciphertext)+ }}/**diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultData.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultData.ktindex a47e72d2b..a04dd4b04 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultData.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultData.kt@@ -2,6 +2,19 @@ package net.aliasvault.app.vaultstore/*** Vault data from API.+ *+ * @property username The username associated with the vault.+ * @property blob The encrypted vault blob.+ * @property version The vault version.+ * @property currentRevisionNumber The current revision number of the vault.+ * @property encryptionPublicKey The public key used for encryption.+ * @property credentialsCount The number of credentials in the vault.+ * @property emailAddressList The list of email addresses.+ * @property privateEmailDomainList The list of private email domains.+ * @property hiddenPrivateEmailDomainList The list of hidden private email domains.+ * @property publicEmailDomainList The list of public email domains.+ * @property createdAt The timestamp when the vault was created.+ * @property updatedAt The timestamp when the vault was last updated.*/data class VaultData(val username: String,@@ -20,6 +33,9 @@ data class VaultData(/*** Vault response from Vault GET endpoint.+ *+ * @property status The HTTP status code of the response.+ * @property vault The vault data returned from the server.*/data class VaultResponse(val status: Int,@@ -28,6 +44,11 @@ data class VaultResponse(/*** Result of checking for new vault version.+ *+ * @property isNewVersionAvailable Whether a new version is available on the server.+ * @property newRevision The new revision number if available.+ * @property serverRevision The current revision number on the server.+ * @property syncState The current sync state of the vault.*/data class VaultVersionCheckResult(val isNewVersionAvailable: Boolean,@@ -38,6 +59,12 @@ data class VaultVersionCheckResult(/*** Result of vault upload.+ *+ * @property success Whether the upload was successful.+ * @property status The HTTP status code of the upload response.+ * @property newRevisionNumber The new revision number after upload.+ * @property mutationSeqAtStart The mutation sequence number at the start of upload.+ * @property error The error message if upload failed.*/data class VaultUploadResult(val success: Boolean,@@ -49,6 +76,8 @@ data class VaultUploadResult(/*** Action taken during sync.+ *+ * @property value The string value of the sync action.*/enum class SyncAction(val value: String) {UPLOADED("uploaded"),@@ -60,6 +89,12 @@ enum class SyncAction(val value: String) {/*** Result of syncVaultWithServer operation.+ *+ * @property success Whether the sync was successful.+ * @property action The action taken during sync.+ * @property newRevision The new revision number after sync.+ * @property wasOffline Whether the sync occurred while offline.+ * @property error The error message if sync failed.*/data class VaultSyncResult(val success: Boolean,diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultMetadataManager.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultMetadataManager.ktindex dddd3c0a8..4dd41caa3 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultMetadataManager.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultMetadataManager.kt@@ -1,6 +1,7 @@package net.aliasvault.app.vaultstoreimport android.util.Log+import net.aliasvault.app.vaultstore.models.SyncStateimport net.aliasvault.app.vaultstore.models.VaultMetadataimport net.aliasvault.app.vaultstore.storageprovider.StorageProviderimport net.aliasvault.app.vaultstore.utils.VersionComparisondiff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.ktindex 18faa9501..0597a1c8f 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.kt@@ -164,7 +164,11 @@ class VaultPasskey(val itemName = if (!it.isNull(12)) it.getString(12) else nullval itemCreatedAt = DateHelpers.parseDateString(it.getString(13)) ?: MIN_DATEval itemUpdatedAt = DateHelpers.parseDateString(it.getString(14)) ?: MIN_DATE++ @Suppress("UNUSED_VARIABLE") // Username field loaded for potential future useval username = if (!it.isNull(15)) it.getString(15) else null++ @Suppress("UNUSED_VARIABLE") // Email field loaded for potential future useval email = if (!it.isNull(16)) it.getString(16) else null// Create a minimal Item object with the data we have@@ -338,23 +342,25 @@ class VaultPasskey(/*** Data class to hold passkey with item info.+ *+ * @property passkey The passkey.+ * @property serviceName The service name from the item.+ * @property username The username from the item.*/data class PasskeyWithCredentialInfo(- /** The passkey. */val passkey: Passkey,- /** The service name from the item. */val serviceName: String?,- /** The username from the item. */val username: String?,)/*** Data class to hold passkey with its associated item.+ *+ * @property passkey The passkey.+ * @property item The item this passkey belongs to.*/data class PasskeyWithItem(- /** The passkey. */val passkey: Passkey,- /** The item this passkey belongs to. */val item: Item,)diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultQuery.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultQuery.ktindex 9925eadd2..46196026e 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultQuery.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultQuery.kt@@ -327,7 +327,8 @@ class VaultQuery(/*** Resolve field metadata for system fields and custom fields.*/- @Suppress("CyclomaticComplexMethod")+ @Suppress("CyclomaticComplexMethod", "LongParameterList")+ // LongParameterList suppressed: All parameters are needed to determine field metadataprivate fun resolveFieldMetadata(fieldKey: String,customLabel: String?,@@ -350,7 +351,7 @@ class VaultQuery(FieldKey.LOGIN_USERNAME -> FieldMetadata("Username", FieldType.TEXT, false, false)FieldKey.LOGIN_PASSWORD -> FieldMetadata("Password", FieldType.PASSWORD, true, true)FieldKey.LOGIN_EMAIL -> FieldMetadata("Email", FieldType.EMAIL, false, false)- FieldKey.LOGIN_URL -> FieldMetadata("URL", FieldType.URL, false, false)+ FieldKey.LOGIN_URL -> FieldMetadata("URL", FieldType.U_R_L, false, false)FieldKey.CARD_NUMBER -> FieldMetadata("Card Number", FieldType.TEXT, true, false)FieldKey.CARD_CARDHOLDER_NAME -> FieldMetadata("Cardholder Name", FieldType.TEXT, false, false)FieldKey.CARD_EXPIRY_MONTH -> FieldMetadata("Expiry Month", FieldType.TEXT, false, false)diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.ktindex 85161adfe..2105bc08f 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt@@ -10,6 +10,7 @@ import net.aliasvault.app.vaultstore.interfaces.CryptoOperationCallbackimport net.aliasvault.app.vaultstore.keystoreprovider.BiometricAuthCallbackimport net.aliasvault.app.vaultstore.keystoreprovider.KeystoreProviderimport net.aliasvault.app.vaultstore.models.Credential+import net.aliasvault.app.vaultstore.models.StoreVaultResultimport net.aliasvault.app.vaultstore.storageprovider.StorageProviderimport kotlin.coroutines.resume@@ -27,9 +28,10 @@ import kotlin.coroutines.resume* - VaultMutate: Handles vault mutation (uploading changes)* - VaultCache: Handles cache and storage clearing*- * @param storageProvider The storage provider- * @param keystoreProvider The keystore provider+ * @param storageProvider The storage provider.+ * @param keystoreProvider The keystore provider.*/+@Suppress("TooManyFunctions") // This is a facade class that delegates to specialized componentsclass VaultStore(private val storageProvider: StorageProvider,private val keystoreProvider: KeystoreProvider,diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSync.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSync.ktindex 7380189a3..a7d54007a 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSync.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSync.kt@@ -616,19 +616,6 @@ class VaultSync(}}- /**- * Store vault metadata as JSON string.- */- private fun storeVaultMetadata(vaultMetadata: net.aliasvault.app.vaultstore.models.VaultMetadata) {- val json = JSONObject().apply {- put("publicEmailDomains", org.json.JSONArray(vaultMetadata.publicEmailDomains))- put("privateEmailDomains", org.json.JSONArray(vaultMetadata.privateEmailDomains))- put("hiddenPrivateEmailDomains", org.json.JSONArray(vaultMetadata.hiddenPrivateEmailDomains))- put("vaultRevisionNumber", vaultMetadata.vaultRevisionNumber)- }- metadata.storeMetadata(json.toString())- }-private fun parseVaultResponse(body: String): InternalVaultResponse {return try {val json = JSONObject(body)diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/Item.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/Item.ktindex 745487fcf..42c7b1574 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/Item.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/Item.kt@@ -5,6 +5,19 @@ import java.util.UUID/*** Item model representing vault entries in the new field-based data model.+ *+ * @property id The unique identifier of the item.+ * @property name The display name of the item.+ * @property itemType The type of item (Login, Alias, CreditCard, Note).+ * @property logo The logo image data in bytes.+ * @property folderId The ID of the folder containing this item.+ * @property folderPath The path to the folder containing this item.+ * @property fields The list of field values for this item.+ * @property hasPasskey Whether this item has an associated passkey.+ * @property hasAttachment Whether this item has attachments.+ * @property hasTotp Whether this item has TOTP codes.+ * @property createdAt The timestamp when this item was created.+ * @property updatedAt The timestamp when this item was last updated.*/data class Item(val id: UUID,@@ -77,6 +90,15 @@ data class Item(/*** Field value within an item.+ *+ * @property fieldKey The key identifying this field.+ * @property label The display label for this field.+ * @property fieldType The type of field (text, password, email, etc).+ * @property value The field value.+ * @property isHidden Whether this field should be hidden by default.+ * @property displayOrder The order in which this field should be displayed.+ * @property isCustomField Whether this is a custom user-defined field.+ * @property enableHistory Whether to track history for this field.*/data class ItemField(val fieldKey: String,diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/ItemRepository.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/ItemRepository.ktindex 306855ced..94208976e 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/ItemRepository.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/ItemRepository.kt@@ -11,6 +11,7 @@ import java.util.TimeZone* Repository for Item CRUD operations.* Handles fetching, creating, updating, and deleting items with their related data.*/+@Suppress("UnusedPrivateProperty") // TAG and MIN_DATE reserved for future useclass ItemRepository(database: VaultDatabase) : BaseRepository(database) {companion object {private const val TAG = "ItemRepository"@@ -30,7 +31,8 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Fetch all active items (not deleted, not in trash) with their fields.- * @return List of Item objects+ *+ * @return List of Item objects.*/fun getAll(): List<Item> {// Implementation delegated to VaultQuery.getAllItems() for now@@ -40,16 +42,19 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Fetch a single item by ID with its fields.- * @param itemId The ID of the item to fetch- * @return Item object or null if not found+ *+ * @param itemId The ID of the item to fetch.+ * @return Item object or null if not found.*/+ @Suppress("UNUSED_PARAMETER") // Method under construction, will be implementedfun getById(itemId: String): Item? {error("Use VaultQuery.getItemById() directly - repository pattern under construction")}/*** Fetch all unique email addresses from field values.- * @return List of email addresses+ *+ * @return List of email addresses.*/fun getAllEmailAddresses(): List<String> {val results = executeQuery(@@ -69,7 +74,8 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Get recently deleted items (in trash).- * @return List of items+ *+ * @return List of items.*/fun getRecentlyDeleted(): List<Item> {error("Use VaultQuery.getRecentlyDeletedItems() directly - repository pattern under construction")@@ -77,7 +83,8 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Get count of items in trash.- * @return Number of items in trash+ *+ * @return Number of items in trash.*/fun getRecentlyDeletedCount(): Int {val results = executeQuery(@@ -95,8 +102,9 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Move an item to trash (set DeletedAt timestamp).- * @param itemId The ID of the item to trash- * @return Number of rows affected+ *+ * @param itemId The ID of the item to trash.+ * @return Number of rows affected.*/fun trash(itemId: String): Int {return withTransaction {@@ -110,8 +118,9 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Restore an item from trash (clear DeletedAt).- * @param itemId The ID of the item to restore- * @return Number of rows affected+ *+ * @param itemId The ID of the item to restore.+ * @return Number of rows affected.*/fun restore(itemId: String): Int {return withTransaction {@@ -126,8 +135,9 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Permanently delete an item (tombstone).* Converts item to tombstone and soft deletes all related data.- * @param itemId The ID of the item to permanently delete- * @return Number of rows affected+ *+ * @param itemId The ID of the item to permanently delete.+ * @return Number of rows affected.*/fun permanentlyDelete(itemId: String): Int {return withTransaction {@@ -168,18 +178,22 @@ class ItemRepository(database: VaultDatabase) : BaseRepository(database) {/*** Create a new item with its fields.- * @param item The item to create- * @return The ID of the created item+ *+ * @param item The item to create.+ * @return The ID of the created item.*/+ @Suppress("UNUSED_PARAMETER") // Method under construction, will be implementedfun create(item: Item): String {error("Create operations should use VaultMutate - repository pattern under construction")}/*** Update an existing item with its fields.- * @param item The item to update- * @return Number of rows affected+ *+ * @param item The item to update.+ * @return Number of rows affected.*/+ @Suppress("UNUSED_PARAMETER") // Method under construction, will be implementedfun update(item: Item): Int {error("Update operations should use VaultMutate - repository pattern under construction")}diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/PasskeyRepository.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/PasskeyRepository.ktindex 2f8752245..7ee9e83db 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/PasskeyRepository.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/repositories/PasskeyRepository.kt@@ -277,11 +277,13 @@ class PasskeyRepository(database: VaultDatabase) : BaseRepository(database) {/*** Replace an existing passkey with a new one.- * @param oldPasskeyId The UUID of the passkey to replace- * @param newPasskey The new passkey- * @param displayName The updated display name- * @param logo The updated logo bytes (optional)+ *+ * @param oldPasskeyId The UUID of the passkey to replace.+ * @param newPasskey The new passkey.+ * @param displayName The updated display name.+ * @param logo The updated logo bytes (optional).*/+ @Suppress("UNUSED_PARAMETER") // Logo update not yet implementedfun replace(oldPasskeyId: UUID,newPasskey: Passkey,@@ -327,6 +329,7 @@ class PasskeyRepository(database: VaultDatabase) : BaseRepository(database) {/*** Parse a passkey row from database query results.*/+ @Suppress("ReturnCount") // Early returns improve readability for parsing logicprivate fun parsePasskeyRow(row: Map<String, Any?>): Passkey? {return try {val idString = row["Id"] as? String ?: return null