https://kotlinlang.org logo
Title
u

user

07/20/2022, 7:21 PM
Android Room TypeConverter to encrypt String column optionally based on other column value Given the Entity: @Entity(tableName = "otp_tokens") data class DBEntity ( @PrimaryKey(autoGenerate = true) val id: Long, val data: String, val encryptionType: EncryptionType ) EncryptionType: enum class EncryptionType { PLAIN_TEXT, ENCRYPTED } I want to use a @TypeConverter to encrypt/decrypt the data String field when accessing the database, based on the value of the encryptionType field value. So for example if encryptionType == PLAIN_TEXT the TypeConverter should...