3#include <StormByte/crypto/keypair/generic.hxx>
9namespace StormByte::Crypto::Secret {
23 class STORMBYTE_CRYPTO_PUBLIC
Generic:
public StormByte::Clonable<Generic> {
68 enum Type
Type() const noexcept {
77 inline std::optional<std::string>
Share(
const std::string& peerPublicKey)
const noexcept {
78 return DoShare(peerPublicKey);
89 inline Generic(
enum Type type, KeyPair::Generic::PointerType keypair):
90 m_type(type), m_keypair(keypair) {}
97 m_type(type), m_keypair(keypair.Clone()) {}
104 m_type(type), m_keypair(keypair.Move()) {}
112 virtual std::optional<std::string> DoShare(
const std::string& peerPublicKey)
const noexcept = 0;
121 STORMBYTE_CRYPTO_PUBLIC Generic::PointerType Create(
enum Type type, KeyPair::Generic::PointerType keypair)
noexcept;
A generic class.
Definition generic.hxx:34
A generic secret class.
Definition generic.hxx:23
enum Type m_type
The type of secret generator.
Definition generic.hxx:82
Generic(Generic &&other) noexcept=default
Move constructor.
std::optional< std::string > Share(const std::string &peerPublicKey) const noexcept
Shares the secret with a peer using their public key.
Definition generic.hxx:77
Generic(enum Type type, KeyPair::Generic &&keypair)
Constructor.
Definition generic.hxx:103
virtual ~Generic() noexcept=default
Virtual destructor.
enum Type Type() const noexcept
Gets the type of the secret share generator used for secret sharing.
Definition generic.hxx:68
Generic(enum Type type, KeyPair::Generic::PointerType keypair)
Constructor.
Definition generic.hxx:89
Generic(enum Type type, const KeyPair::Generic &keypair)
Constructor.
Definition generic.hxx:96
Generic(const Generic &other)=default
Copy constructor.
KeyPair::Generic::PointerType m_keypair
The keypair used for secret sharing.
Definition generic.hxx:83
The namespace containing all the keypair-related classes.