StormByte C++ Library: Crypto module 0.0.9999
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
Public Member Functions | List of all members
StormByte::Crypto::Vault Class Reference

Secure container for named passwords. More...

#include <vault.hxx>

Public Member Functions

 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 (Vault &&other) noexcept
 Move constructor.
 
 ~Vault () noexcept
 Destructor. Releases all stored passwords (secure wipe is performed by Password).
 
Vaultoperator= (const Vault &)=delete
 Copy assignment operator (deleted).
 
Vaultoperator= (Vault &&other) noexcept
 Move assignment operator.
 
void Store (std::string name, Password password) noexcept
 Store (or overwrite) a named password.
 
ExpectedPassword Get (const std::string &name) const noexcept
 Retrieve a password by name.
 
bool Contains (const std::string &name) const noexcept
 Check whether a named password exists.
 
void Remove (const std::string &name) noexcept
 Remove a named password.
 
void Clear () noexcept
 Remove all stored passwords.
 
std::size_t Size () const noexcept
 Get the number of stored passwords.
 
bool Empty () const noexcept
 Check whether the vault is empty.
 

Detailed Description

Secure container for named passwords.

Owns a collection of Password objects and automatically releases them (triggering secure wipe) on destruction or when Clear() / Remove() is called. The class is non-copyable and only movable.

Constructor & Destructor Documentation

◆ Vault()

StormByte::Crypto::Vault::Vault ( Vault &&  other)
noexcept

Move constructor.

Parameters
otherThe vault to move from.

Member Function Documentation

◆ Contains()

bool StormByte::Crypto::Vault::Contains ( const std::string &  name) const
noexcept

Check whether a named password exists.

Parameters
nameIdentifier to look for.
Returns
true if the password exists, false otherwise.

◆ Empty()

bool StormByte::Crypto::Vault::Empty ( ) const
noexcept

Check whether the vault is empty.

Returns
true if no passwords are stored, false otherwise.

◆ Get()

ExpectedPassword StormByte::Crypto::Vault::Get ( const std::string &  name) const
noexcept

Retrieve a password by name.

Parameters
nameIdentifier of the password to retrieve.
Returns
Expected containing a Password on success, or an error if the name does not exist.
Note
The returned Password shares ownership of the underlying data (cheap copy).

◆ operator=()

Vault & StormByte::Crypto::Vault::operator= ( Vault &&  other)
noexcept

Move assignment operator.

Parameters
otherThe vault to move from.
Returns
Reference to this vault.

◆ Remove()

void StormByte::Crypto::Vault::Remove ( const std::string &  name)
noexcept

Remove a named password.

Parameters
nameIdentifier of the password to remove.

◆ Size()

std::size_t StormByte::Crypto::Vault::Size ( ) const
noexcept

Get the number of stored passwords.

Returns
The number of passwords currently stored in the vault.

◆ Store()

void StormByte::Crypto::Vault::Store ( std::string  name,
Password  password 
)
noexcept

Store (or overwrite) a named password.

Parameters
nameIdentifier for the password.
passwordThe password to store (copied / shared).

The documentation for this class was generated from the following file: