Keeps your secrets
Import base package and syntax extension:
import cryptic._
import cryptic.syntax._Define your data types:
case class EmailAddress(literal: String)
case class User(id: Long, email: Encrypted[EmailAddress])Encrypt your data using convenient syntax (a crypto and a serializer must be available):
import cryptic.crypto.RSA._
import cryptic.serialization.Fst._
val user = User(123, EmailAddress("[email protected]").encryptedAccess your data in encrypted form (can be done without crypto/serializer):
val bytes: Array[Byte] = user.email.bytesTransform your data (can be done without crypto/serializer):
val lowered = user.email.
map(_.copy(literal = _.literal.toLower))Run your staged transformations (a crypto and a serializer must be available):
import cryptic.crypto.RSA._
import cryptic.serialization.Fst._
val user2 = user.copy(
email = lowered.run())Decrypt your transformed data (a crypto and a serializer must be available):
import cryptic.crypto.RSA._
import cryptic.serialization.Fst._
val emailInLower = user2.email.decrypted