1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

add additional variant of doInDecryptionContextWithPKCS8Key

This commit is contained in:
InsanusMokrassar 2021-01-29 10:44:11 +06:00
parent 040654f131
commit ecc608f51a

View File

@ -13,3 +13,12 @@ inline fun <T> PassportData.doInDecryptionContextWithPKCS8Key(
expectedNonce ?.let { require(expectedNonce == decryptedCredentials.nonce) }
return decryptedCredentials.secureData.run(block)
}
inline fun <T> PassportData.doInDecryptionContextWithPKCS8Key(
pkcs8Key: String,
expectedNonce: String? = null,
crossinline block: SecureData.() -> T
): T {
val decryptedCredentials = credentials.decryptWithPKCS8PrivateKey(pkcs8Key)
expectedNonce ?.let { require(expectedNonce == decryptedCredentials.nonce) }
return decryptedCredentials.secureData.run(block)
}