mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 03:58:48 +00:00
Do most of the proto and database groundwork for the new mediaName.
This commit is contained in:
committed by
Cody Henthorne
parent
e705495638
commit
38c8f852bf
@@ -130,4 +130,24 @@ object Base64 {
|
||||
private fun String.stripPadding(): String {
|
||||
return this.replace("=", "")
|
||||
}
|
||||
|
||||
fun String.decodeBase64OrThrow(): ByteArray {
|
||||
return try {
|
||||
decode(this)
|
||||
} catch (e: IOException) {
|
||||
throw AssertionError("Invalid Base64 string: $this", e)
|
||||
}
|
||||
}
|
||||
|
||||
fun String?.decodeBase64(): ByteArray? {
|
||||
if (this == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
return try {
|
||||
decode(this)
|
||||
} catch (e: IOException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user