Skip to content

Commit

Permalink
Fixed the interactionId for the InteractionInstance to ensure this is…
Browse files Browse the repository at this point in the history
… unique if output is different
  • Loading branch information
xk00lj committed Sep 26, 2024
1 parent 1423620 commit 173e4a1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ abstract class InteractionInstance[F[_]] extends common.InteractionInstance[F] w

def shaBase64: String = {
val nameBytes: Array[Byte] = name.getBytes("UTF-8")
val interfaceBytes: Array[Byte] = input.toArray.map(_.hashCode().toByte)
val sha: Array[Byte] = MessageDigest.getInstance("SHA-256").digest(nameBytes ++ interfaceBytes)
val inputBytes: Array[Byte] = input.toArray.map(_.hashCode().toByte)
val outputBytes: Array[Byte] = output.toArray.map(_.hashCode().toByte)
val sha: Array[Byte] = MessageDigest.getInstance("SHA-256").digest(nameBytes ++ inputBytes ++ outputBytes)
val base64: Array[Byte] = Base64.getEncoder.encode(sha)
new String(base64)
}
Expand Down

0 comments on commit 173e4a1

Please sign in to comment.