mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
parent
d76c09ffb2
commit
fb91199f83
@ -264,10 +264,6 @@ const val permissionsField = "permissions"
|
|||||||
const val typeField = "type"
|
const val typeField = "type"
|
||||||
const val valueField = "value"
|
const val valueField = "value"
|
||||||
|
|
||||||
const val dataField = "data"
|
|
||||||
const val hashField = "hash"
|
|
||||||
const val secretField = "secret"
|
|
||||||
|
|
||||||
const val pointField = "point"
|
const val pointField = "point"
|
||||||
const val xShiftField = "x_shift"
|
const val xShiftField = "x_shift"
|
||||||
const val yShiftField = "y_shift"
|
const val yShiftField = "y_shift"
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.passport.credentials
|
|
||||||
|
|
||||||
data class Credentials(
|
|
||||||
|
|
||||||
)
|
|
@ -1,6 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.passport.credentials.common
|
|
||||||
|
|
||||||
data class FileCredentials(
|
|
||||||
val fileHash: String,
|
|
||||||
val secret: String
|
|
||||||
)
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.passport.raw
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|
||||||
import kotlinx.serialization.SerialName
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class EncryptedCredentials(
|
|
||||||
@SerialName(dataField)
|
|
||||||
val data: String,
|
|
||||||
@SerialName(hashField)
|
|
||||||
val hash: String,
|
|
||||||
@SerialName(secretField)
|
|
||||||
val secret: String
|
|
||||||
)
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils.crypto
|
|
||||||
|
|
||||||
import com.soywiz.krypto.AES
|
|
||||||
import com.soywiz.krypto.Padding
|
|
||||||
|
|
||||||
fun decryptSecret(
|
|
||||||
privateKey: ByteArray,
|
|
||||||
encryptedSecret: ByteArray
|
|
||||||
): ByteArray {
|
|
||||||
AES.decryptAes128Cbc(privateKey, Padding.PKCS7Padding)
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils.crypto
|
|
||||||
|
|
||||||
import com.soywiz.krypto.AES
|
|
||||||
import com.soywiz.krypto.Padding
|
|
||||||
|
|
||||||
typealias Decryptor = (ByteArray) -> ByteArray
|
|
||||||
|
|
||||||
fun createDecryptor(
|
|
||||||
secret: ByteArray,
|
|
||||||
hash: ByteArray
|
|
||||||
): Decryptor {
|
|
||||||
val secretHash = sha512(secret + hash)
|
|
||||||
val key = secretHash.copyOfRange(0, 32)
|
|
||||||
val iv = secretHash.copyOfRange(32, 48)
|
|
||||||
|
|
||||||
return {
|
|
||||||
val decrypted = AES.decryptAesCbc(it, key, iv, Padding.NoPadding)
|
|
||||||
decrypted.copyOfRange(decrypted[0].toInt(), decrypted.size)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils.crypto
|
|
||||||
|
|
||||||
external fun sha512(from: ByteArray): ByteArray
|
|
Loading…
Reference in New Issue
Block a user