1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-01 07:25:23 +00:00

Revert "start implement passport"

This reverts commit d76c09ffb2.
This commit is contained in:
InsanusMokrassar 2020-06-25 15:45:35 +06:00
parent d76c09ffb2
commit fb91199f83
7 changed files with 0 additions and 64 deletions

View File

@ -264,10 +264,6 @@ const val permissionsField = "permissions"
const val typeField = "type"
const val valueField = "value"
const val dataField = "data"
const val hashField = "hash"
const val secretField = "secret"
const val pointField = "point"
const val xShiftField = "x_shift"
const val yShiftField = "y_shift"

View File

@ -1,5 +0,0 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.passport.credentials
data class Credentials(
)

View File

@ -1,6 +0,0 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.passport.credentials.common
data class FileCredentials(
val fileHash: String,
val secret: String
)

View File

@ -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
)

View File

@ -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)
}

View File

@ -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)
}
}

View File

@ -1,3 +0,0 @@
package com.github.insanusmokrassar.TelegramBotAPI.utils.crypto
external fun sha512(from: ByteArray): ByteArray