StormByte C++ Library: Crypto module 0.0.9999
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
vault.hxx
1#pragma once
2
3#include <StormByte/crypto/password.hxx>
4#include <StormByte/crypto/typedefs.hxx>
5#include <StormByte/crypto/visibility.h>
6#include <StormByte/exception.hxx>
7
8#include <string>
9#include <unordered_map>
10#include <utility>
11
16namespace StormByte::Crypto {
26 class STORMBYTE_CRYPTO_PUBLIC Vault {
27 public:
32 Vault() = default;
33
38 Vault(const Vault&) = delete;
39
44 Vault(Vault&& other) noexcept;
45
50 ~Vault() noexcept;
51
55 Vault& operator=(const Vault&) = delete;
56
62 Vault& operator=(Vault&& other) noexcept;
63
69 void Store(std::string name, Password password) noexcept;
70
79 ExpectedPassword Get(const std::string& name) const noexcept;
80
86 bool Contains(const std::string& name) const noexcept;
87
92 void Remove(const std::string& name) noexcept;
93
97 void Clear() noexcept;
98
103 std::size_t Size() const noexcept;
104
109 bool Empty() const noexcept;
110
111 private:
112 std::unordered_map<std::string, Password> m_passwords;
113 };
114}
Secure, reference-counted container for passwords and binary key material.
Definition password.hxx:36
Secure container for named passwords.
Definition vault.hxx:26
Vault()=default
Default constructor. Creates an empty vault.
Vault(const Vault &)=delete
Copy constructor (deleted). Copying is disabled to prevent accidental duplication of the vault.
~Vault() noexcept
Destructor. Releases all stored passwords (secure wipe is performed by Password).
Vault(Vault &&other) noexcept
Move constructor.