1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

add tools for passport files hashes calculation

This commit is contained in:
InsanusMokrassar 2021-01-23 12:21:57 +06:00
parent 1d99e632a4
commit 2f52ad45a4
5 changed files with 15 additions and 2 deletions

View File

@ -6,7 +6,7 @@
* `Common`:
* `Version`:
* `MicroUtils`: `0.4.16` -> `0.4.19`
* `MicroUtils`: `0.4.16` -> `0.4.21`
* `Core`:
* **BREAKING CHANGE** Now `MediaGroupMessage` have a generic type related to `MediaGroupContent`
* Methods and types related to `MediaGroupMessage` have been modified according to their meanings

View File

@ -12,7 +12,7 @@ klock_version=2.0.3
uuid_version=0.2.3
ktor_version=1.5.0
micro_utils_version=0.4.20
micro_utils_version=0.4.21
javax_activation_version=1.1.1

View File

@ -46,6 +46,7 @@ kotlin {
api "com.soywiz.korlibs.klock:klock:$klock_version"
api "com.benasher44:uuid:$uuid_version"
api "dev.inmo:micro_utils.crypto:$micro_utils_version"
api "dev.inmo:micro_utils.coroutines:$micro_utils_version"
api "dev.inmo:micro_utils.serialization.base64:$micro_utils_version"
api "dev.inmo:micro_utils.serialization.encapsulator:$micro_utils_version"

View File

@ -2,6 +2,8 @@
package dev.inmo.tgbotapi.types.passport
import dev.inmo.micro_utils.crypto.MD5
import dev.inmo.micro_utils.crypto.md5
import dev.inmo.micro_utils.serialization.base64.Base64StringSerializer
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.passport.encrypted_data.abstracts.*
@ -13,6 +15,9 @@ import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.*
val ByteArray.passportFileHash: MD5
get() = md5()
@Serializable(PassportElementErrorSerializer::class)
sealed class PassportElementError {
abstract val source: String

View File

@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.types.passport
import dev.inmo.micro_utils.crypto.MD5
import java.io.File
val File.passportFileHash: MD5
get() = readBytes().passportFileHash