Parse e2e participant keys.
This commit is contained in:
@@ -7,16 +7,25 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "tde2e/tde2e_api.h"
|
||||
|
||||
#include "base/algorithm.h"
|
||||
#include "base/assertion.h"
|
||||
|
||||
#include <tde2e/td/e2e/e2e_api.h>
|
||||
|
||||
namespace TdE2E {
|
||||
|
||||
QByteArray GeneratePrivateKey() {
|
||||
const auto result = tde2e_api::key_generate_temporary_private_key();
|
||||
CallState CreateCallState() {
|
||||
const auto id = tde2e_api::key_generate_temporary_private_key();
|
||||
Assert(id.is_ok());
|
||||
const auto key = tde2e_api::key_to_public_key(id.value());
|
||||
Assert(key.is_ok());
|
||||
|
||||
return {};
|
||||
auto result = CallState{
|
||||
.myKeyId = PrivateKeyId{ .v = uint64(id.value()) },
|
||||
};
|
||||
Assert(key.value().size() == sizeof(result.myKey));
|
||||
memcpy(&result.myKey, key.value().data(), 32);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace TdE2E
|
||||
|
||||
@@ -7,3 +7,31 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/basic_types.h"
|
||||
|
||||
namespace TdE2E {
|
||||
|
||||
struct PrivateKeyId {
|
||||
uint64 v = 0;
|
||||
};
|
||||
|
||||
struct PublicKey {
|
||||
uint64 a = 0;
|
||||
uint64 b = 0;
|
||||
uint64 c = 0;
|
||||
uint64 d = 0;
|
||||
};
|
||||
|
||||
struct ParticipantState {
|
||||
uint64 id = 0;
|
||||
PublicKey key;
|
||||
};
|
||||
|
||||
struct CallState {
|
||||
PrivateKeyId myKeyId;
|
||||
PublicKey myKey;
|
||||
};
|
||||
|
||||
[[nodiscard]] CallState CreateCallState();
|
||||
|
||||
} // namespace TdE2E
|
||||
|
||||
Reference in New Issue
Block a user