mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-10-25 14:07:28 +00:00
replace "WebhookPrivateKeyConfig"
This commit is contained in:
1 parent
25dcd9bc52
commit
f8fbe824b9
3 files changed
+33
-20
No files matched your search
+23
@@ -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()
|
||||
}
|
||||
+9
-20
@@ -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
|
||||
Reference in new issue
Block a user