1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

replace "WebhookPrivateKeyConfig"

This commit is contained in:
InsanusMokrassar 2019-05-10 11:30:26 +08:00
parent 25dcd9bc52
commit f8fbe824b9
3 changed files with 33 additions and 20 deletions

View File

@ -21,6 +21,7 @@ some default library
### 0.14.1
* Replace `UpdatesFilter` and `UpdatesPoller` into another package
* Replace `WebhookPrivateKeyConfig`
## 0.13.0 Telegram Polls

View File

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

View File

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