com.wavesenterprise.utils.Base64.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of we-utils Show documentation
Show all versions of we-utils Show documentation
Library for Waves Enterprise blockchain platform
package com.wavesenterprise.utils
import scala.util.Try
object Base64 {
def encode(input: Array[Byte]): String = new String(java.util.Base64.getEncoder.encode(input))
def decode(input: String): Try[Array[Byte]] = Try {
val str = if (input.startsWith("base64:")) input.substring(7) else input
java.util.Base64.getDecoder.decode(str)
}
}