mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Improve creating channels in adnl (#1108)
* Improve creating channels in adnl * Improve handling of cryptographic keys
This commit is contained in:
parent
0cff1c88f7
commit
77a816e461
9 changed files with 109 additions and 80 deletions
|
@ -110,6 +110,7 @@ class Ed25519 {
|
|||
tl_object_ptr<ton_api::pub_ed25519> tl() const {
|
||||
return create_tl_object<ton_api::pub_ed25519>(data_);
|
||||
}
|
||||
td::Result<std::unique_ptr<Encryptor>> create_encryptor() const;
|
||||
bool operator==(const Ed25519 &with) const {
|
||||
return data_ == with.data_;
|
||||
}
|
||||
|
@ -141,6 +142,7 @@ class AES {
|
|||
tl_object_ptr<ton_api::pub_aes> tl() const {
|
||||
return create_tl_object<ton_api::pub_aes>(data_);
|
||||
}
|
||||
td::Result<std::unique_ptr<Encryptor>> create_encryptor() const;
|
||||
bool operator==(const AES &with) const {
|
||||
return data_ == with.data_;
|
||||
}
|
||||
|
@ -172,6 +174,7 @@ class Unenc {
|
|||
tl_object_ptr<ton_api::pub_unenc> tl() const {
|
||||
return create_tl_object<ton_api::pub_unenc>(data_.clone_as_buffer_slice());
|
||||
}
|
||||
td::Result<std::unique_ptr<Encryptor>> create_encryptor() const;
|
||||
bool operator==(const Unenc &with) const {
|
||||
return data_.as_slice() == with.data_.as_slice();
|
||||
}
|
||||
|
@ -203,6 +206,7 @@ class Overlay {
|
|||
tl_object_ptr<ton_api::pub_overlay> tl() const {
|
||||
return create_tl_object<ton_api::pub_overlay>(data_.clone_as_buffer_slice());
|
||||
}
|
||||
td::Result<std::unique_ptr<Encryptor>> create_encryptor() const;
|
||||
bool operator==(const Overlay &with) const {
|
||||
return data_.as_slice() == with.data_.as_slice();
|
||||
}
|
||||
|
@ -223,6 +227,9 @@ class PublicKey {
|
|||
td::uint32 serialized_size() const {
|
||||
UNREACHABLE();
|
||||
}
|
||||
td::Result<std::unique_ptr<Encryptor>> create_encryptor() const {
|
||||
UNREACHABLE();
|
||||
}
|
||||
bool operator==(const Empty &with) const {
|
||||
return false;
|
||||
}
|
||||
|
@ -316,6 +323,7 @@ class Ed25519 {
|
|||
}
|
||||
tl_object_ptr<ton_api::PublicKey> pub_tl() const;
|
||||
pubkeys::Ed25519 pub() const;
|
||||
td::Result<std::unique_ptr<Decryptor>> create_decryptor() const;
|
||||
static Ed25519 random();
|
||||
};
|
||||
|
||||
|
@ -359,6 +367,7 @@ class AES {
|
|||
pubkeys::AES pub() const {
|
||||
return pubkeys::AES{data_};
|
||||
}
|
||||
td::Result<std::unique_ptr<Decryptor>> create_decryptor() const;
|
||||
};
|
||||
|
||||
class Unenc {
|
||||
|
@ -393,6 +402,7 @@ class Unenc {
|
|||
pubkeys::Unenc pub() const {
|
||||
return pubkeys::Unenc{data_.clone()};
|
||||
}
|
||||
td::Result<std::unique_ptr<Decryptor>> create_decryptor() const;
|
||||
};
|
||||
|
||||
class Overlay {
|
||||
|
@ -427,6 +437,7 @@ class Overlay {
|
|||
pubkeys::Overlay pub() const {
|
||||
return pubkeys::Overlay{data_.clone()};
|
||||
}
|
||||
td::Result<std::unique_ptr<Decryptor>> create_decryptor() const;
|
||||
};
|
||||
|
||||
} // namespace privkeys
|
||||
|
@ -450,6 +461,9 @@ class PrivateKey {
|
|||
PublicKey pub() const {
|
||||
UNREACHABLE();
|
||||
}
|
||||
td::Result<std::unique_ptr<Decryptor>> create_decryptor() const {
|
||||
UNREACHABLE();
|
||||
}
|
||||
};
|
||||
td::Variant<Empty, privkeys::Ed25519, privkeys::AES, privkeys::Unenc, privkeys::Overlay> priv_key_{Empty{}};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue