1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-24 15:16:16 +00:00

temporal state (currently tools for files decryption in JS do work

This commit is contained in:
2021-01-23 18:49:34 +06:00
parent 2f52ad45a4
commit d34deade0d
8 changed files with 237 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
package dev.inmo.tgbotapi.utils.passport
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.DownloadFile
import dev.inmo.tgbotapi.requests.get.GetFile
import dev.inmo.tgbotapi.types.passport.encrypted_data.PassportFile
expect class DecryptionContext(
key: String
) {
fun ByteArray.decrypt(): ByteArray
}
suspend fun DecryptionContext.decrypt(
file: PassportFile,
bot: TelegramBot
): ByteArray {
return bot.execute(
DownloadFile(
bot.execute(
GetFile(file.fileId)
).filePath
)
).decrypt()
}