Skip to content

odd/cryptic

 
 

Repository files navigation

Cryptic

Keeps your secrets

Usage

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]").encrypted

Access your data in encrypted form (can be done without crypto/serializer):

val bytes: Array[Byte] = user.email.bytes

Transform 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

About

Keeps your secrets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%