mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-23 15:00:50 +01:00
23 lines
750 B
C++
23 lines
750 B
C++
|
#include "v2/SignalingEncryption.h"
|
||
|
|
||
|
namespace tgcalls {
|
||
|
|
||
|
SignalingEncryption::SignalingEncryption(EncryptionKey const &encryptionKey) {
|
||
|
_connection.reset(new EncryptedConnection(EncryptedConnection::Type::Signaling, encryptionKey, [](int, int) {
|
||
|
}));
|
||
|
}
|
||
|
|
||
|
SignalingEncryption::~SignalingEncryption() {
|
||
|
|
||
|
}
|
||
|
|
||
|
absl::optional<rtc::CopyOnWriteBuffer> SignalingEncryption::encryptOutgoing(std::vector<uint8_t> const &data) {
|
||
|
return _connection->encryptRawPacket(rtc::CopyOnWriteBuffer(data.data(), data.size()));
|
||
|
}
|
||
|
|
||
|
absl::optional<rtc::CopyOnWriteBuffer> SignalingEncryption::decryptIncoming(std::vector<uint8_t> const &data) {
|
||
|
return _connection->decryptRawPacket(rtc::CopyOnWriteBuffer(data.data(), data.size()));
|
||
|
}
|
||
|
|
||
|
} // namespace tgcalls
|