StormByte C++ Library: Crypto module 1.0.0
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
secret.hxx
1#pragma once
2
3#include <StormByte/crypto/keypair.hxx>
4#include <StormByte/crypto/exception.hxx>
5#include <StormByte/crypto/algorithm.hxx>
6#include <StormByte/expected.hxx>
7
8#include <string>
9
14namespace StormByte::Crypto {
22 class STORMBYTE_CRYPTO_PUBLIC Secret final {
23 public:
33 explicit Secret(const Algorithm::SecretShare& algorithm, const KeyPair& key_pair) noexcept;
34
44 explicit Secret(const Algorithm::SecretShare& algorithm, KeyPair&& key_pair) noexcept;
45
53 Secret(const Secret& secret) = default;
54
62 Secret(Secret&& secret) noexcept = default;
63
69 ~Secret() noexcept = default;
70
79 Secret& operator=(const Secret& secret) = default;
80
89 Secret& operator=(Secret&& secret) noexcept = default;
90
98 void PeerPublicKey(const std::string& peer_public_key) noexcept;
99
108 [[nodiscard]]
109 Expected<std::string, Exception> Content() const noexcept;
110
118 [[nodiscard]]
119 const KeyPair& KeyPair() const noexcept;
120
121 private:
122 Algorithm::SecretShare m_algorithm;
123 class KeyPair m_key_pair;
124 std::string m_peer_public_key;
125 };
126}
A class representing an exception in the crypto module.
Definition exception.hxx:15
A class representing a public/private key pair.
Definition keypair.hxx:23
A class for managing shared secret operations.
Definition secret.hxx:22
Secret(const Secret &secret)=default
Copy constructor for the Secret class.
Secret(Secret &&secret) noexcept=default
Move constructor for the Secret class.
~Secret() noexcept=default
Destructor for the Secret class.
Secret(const Algorithm::SecretShare &algorithm, const KeyPair &key_pair) noexcept
Constructs a Secret instance with an algorithm and a key pair.
Secret(const Algorithm::SecretShare &algorithm, KeyPair &&key_pair) noexcept
Constructs a Secret instance with an algorithm and a key pair (move version).
The namespace containing cryptographic algorithms.