Skip to content

Instantly share code, notes, and snippets.

@guizmaii
guizmaii / AES.scala
Last active October 9, 2023 14:19
Pure and modern AES encryption/decryption in Scala (with PBT tests)
package com.guizmaii.utils
import java.nio.charset.{Charset, StandardCharsets}
import java.security.{Key, SecureRandom}
import cats.effect.Sync
import doobie.{Put, Read}
import eu.timepit.refined.types.all.NonEmptyString
import io.estatico.newtype.macros.newtype
import javax.crypto.{Cipher, SecretKey, SecretKeyFactory}