diff --git a/CHANGELOG.md b/CHANGELOG.md index 49f696735e..0bbbc0ccb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/gradle.properties b/gradle.properties index 2f911f8bab..5017be276e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/tgbotapi.core/build.gradle b/tgbotapi.core/build.gradle index d38ff75ff5..dbb55557e9 100644 --- a/tgbotapi.core/build.gradle +++ b/tgbotapi.core/build.gradle @@ -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" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt index 5fa154736a..a3cf28594a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt @@ -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 diff --git a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/types/passport/FileHashes.kt b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/types/passport/FileHashes.kt new file mode 100644 index 0000000000..0249909252 --- /dev/null +++ b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/types/passport/FileHashes.kt @@ -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