From fb91199f83a362b129e62e1313c8b7eb2cb1a34b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 25 Jun 2020 15:45:35 +0600 Subject: [PATCH] Revert "start implement passport" This reverts commit d76c09ffb2e7f67cf47c6bee3f96296aaa118e35. --- .../TelegramBotAPI/types/Common.kt | 4 ---- .../types/passport/credentials/Credentials.kt | 5 ----- .../credentials/common/FileCredentials.kt | 6 ------ .../passport/raw/EncryptedCredentials.kt | 15 -------------- .../utils/crypto/DecryptSecret.kt | 11 ---------- .../TelegramBotAPI/utils/crypto/Decryptor.kt | 20 ------------------- .../TelegramBotAPI/utils/crypto/SHA512.kt | 3 --- 7 files changed, 64 deletions(-) delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/Credentials.kt delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/common/FileCredentials.kt delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/raw/EncryptedCredentials.kt delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/DecryptSecret.kt delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/Decryptor.kt delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/SHA512.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt index 9793a62fe6..2fb043f7bd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -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" diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/Credentials.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/Credentials.kt deleted file mode 100644 index 9eecfdc567..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/Credentials.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.types.passport.credentials - -data class Credentials( - -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/common/FileCredentials.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/common/FileCredentials.kt deleted file mode 100644 index c8ad78354c..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/credentials/common/FileCredentials.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.types.passport.credentials.common - -data class FileCredentials( - val fileHash: String, - val secret: String -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/raw/EncryptedCredentials.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/raw/EncryptedCredentials.kt deleted file mode 100644 index bef806c970..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/passport/raw/EncryptedCredentials.kt +++ /dev/null @@ -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 -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/DecryptSecret.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/DecryptSecret.kt deleted file mode 100644 index 956235fb93..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/DecryptSecret.kt +++ /dev/null @@ -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) -} diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/Decryptor.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/Decryptor.kt deleted file mode 100644 index 4976a736be..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/Decryptor.kt +++ /dev/null @@ -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) - } -} diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/SHA512.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/SHA512.kt deleted file mode 100644 index 89cf99416c..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/crypto/SHA512.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.utils.crypto - -external fun sha512(from: ByteArray): ByteArray