feat: implement device verification flow with new UI components and protocol handling
This commit is contained in:
@@ -511,6 +511,23 @@ object MessageCrypto {
|
||||
encryptedKey: String,
|
||||
myPrivateKey: String
|
||||
): String = decryptIncomingFull(ciphertext, encryptedKey, myPrivateKey).plaintext
|
||||
|
||||
fun decryptIncomingFullWithPlainKey(
|
||||
ciphertext: String,
|
||||
plainKeyAndNonce: ByteArray
|
||||
): DecryptedIncoming {
|
||||
require(plainKeyAndNonce.size >= 56) { "Invalid plainKeyAndNonce size: ${plainKeyAndNonce.size}" }
|
||||
|
||||
val key = plainKeyAndNonce.copyOfRange(0, 32)
|
||||
val nonce = plainKeyAndNonce.copyOfRange(32, 56)
|
||||
val plaintext = decryptMessage(ciphertext, key.toHex(), nonce.toHex())
|
||||
return DecryptedIncoming(plaintext, plainKeyAndNonce)
|
||||
}
|
||||
|
||||
fun decryptIncomingWithPlainKey(
|
||||
ciphertext: String,
|
||||
plainKeyAndNonce: ByteArray
|
||||
): String = decryptIncomingFullWithPlainKey(ciphertext, plainKeyAndNonce).plaintext
|
||||
|
||||
/**
|
||||
* Расшифровка MESSAGES attachment blob
|
||||
|
||||
Reference in New Issue
Block a user