<Android Room TypeConverter to encrypt String colu...
# stackoverflow
u
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...