diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae4d701f9..b79c03276e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ some default library ### 0.14.1 * Replace `UpdatesFilter` and `UpdatesPoller` into another package +* Replace `WebhookPrivateKeyConfig` ## 0.13.0 Telegram Polls diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/webhook/WebhookPrivateKeyConfig.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/webhook/WebhookPrivateKeyConfig.kt new file mode 100644 index 0000000000..f6e6a7a1b0 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/webhook/WebhookPrivateKeyConfig.kt @@ -0,0 +1,23 @@ +package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook + +import kotlinx.serialization.Serializable +import kotlinx.serialization.Transient +import java.io.FileInputStream +import java.security.KeyStore + +@Serializable +data class WebhookPrivateKeyConfig( + private val keyStorePath: String, + private val keyStorePassword: String, + val aliasName: String, + private val aliasPassword: String +) { + @Transient + val keyStore = KeyStore.getInstance("JKS").apply { + load(FileInputStream(keyStorePath), keyStorePassword()) + } + + fun keyStorePassword(): CharArray = keyStorePassword.toCharArray() + + fun aliasPassword(): CharArray = aliasPassword.toCharArray() +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/WebhookPrivateKeyConfig.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/WebhookPrivateKeyConfig.kt index bb5f4810c4..9462b67e2b 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/WebhookPrivateKeyConfig.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/WebhookPrivateKeyConfig.kt @@ -1,23 +1,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils.extensions -import kotlinx.serialization.Serializable -import kotlinx.serialization.Transient -import java.io.FileInputStream -import java.security.KeyStore +import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook.WebhookPrivateKeyConfig -@Serializable -data class WebhookPrivateKeyConfig( - private val keyStorePath: String, - private val keyStorePassword: String, - val aliasName: String, - private val aliasPassword: String -) { - @Transient - val keyStore = KeyStore.getInstance("JKS").apply { - load(FileInputStream(keyStorePath), keyStorePassword()) - } - - fun keyStorePassword(): CharArray = keyStorePassword.toCharArray() - - fun aliasPassword(): CharArray = aliasPassword.toCharArray() -} +@Deprecated( + "Replaced in separated package", + ReplaceWith( + "WebhookPrivateKeyConfig", + "com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook.WebhookPrivateKeyConfig" + ) +) +typealias WebhookPrivateKeyConfig = WebhookPrivateKeyConfig