mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
replace "WebhookPrivateKeyConfig"
This commit is contained in:
parent
25dcd9bc52
commit
f8fbe824b9
@ -21,6 +21,7 @@ some default library
|
||||
### 0.14.1
|
||||
|
||||
* Replace `UpdatesFilter` and `UpdatesPoller` into another package
|
||||
* Replace `WebhookPrivateKeyConfig`
|
||||
|
||||
## 0.13.0 Telegram Polls
|
||||
|
||||
|
@ -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()
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user