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:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user