Satyam Agarwal
05/27/2022, 9:05 AMimport arrow.core.computations.ResultEffect.bind
@Test
fun `encrypt produces new encryption for given text and should be decrypted back `() {
val text = "Some sensitive data :partying_face: 2020-06-27T19:11:44.095Z @#$%^&*(&^%$#@! åååå πø˜˜¶∞¢"
val textByteArray: ByteArray = text.toByteArray()
val firstEncryption: ByteArray = Crypto.encrypt(securityKey, textByteArray).bind()
val secondEncryption: ByteArray = Crypto.encrypt(securityKey, textByteArray).bind()
firstEncryption shouldNotBe secondEncryption
val firstDecryption: ByteArray = Crypto.decrypt(securityKey, firstEncryption).bind()
val secondDecryption: ByteArray = Crypto.decrypt(securityKey, secondEncryption).bind()
firstDecryption shouldBe textByteArray
secondDecryption shouldBe textByteArray
String(firstDecryption) shouldBe text
String(secondDecryption) shouldBe text
}
Is there some alternative, or am I forced to migrate my hundreds of tests 😅simon.vergauwen
05/27/2022, 9:11 AMgetOrThrow
so you can safely refactor to getOrThrow
or add the proper arrow.core.continuations.result { }
wrapper around your tests to achieve the bind
syntax.simon.vergauwen
05/27/2022, 9:12 AMarrow.core.computations.ResultEffect.bind
was importable but unsafe outside of result { }
.
So we fixed the "unsafe" partSatyam Agarwal
05/27/2022, 9:32 AMsimon.vergauwen
05/27/2022, 9:34 AMsimon.vergauwen
05/27/2022, 9:34 AMSatyam Agarwal
05/27/2022, 9:34 AMSatyam Agarwal
05/27/2022, 9:35 AMSatyam Agarwal
05/27/2022, 9:35 AMsimon.vergauwen
05/27/2022, 9:35 AMSatyam Agarwal
05/27/2022, 9:36 AMsimon.vergauwen
05/27/2022, 9:36 AM