StormByte-Crypto 2.0.0
C++26 cryptography module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Crypto::Secure::Vault Class Reference

Named collection of Password objects. More...

#include <StormByte/crypto/secure/vault.hxx>

Public Member Functions

void Store (std::string_view name, Password password) noexcept
 Store or overwrite a named password.
 
ExpectedPassword Get (std::string_view name) const noexcept
 Look up a password.
 
bool Contains (std::string_view name) const noexcept
 Whether a name exists.
 
void Remove (std::string_view name) noexcept
 Drop one password.
 
void Clear () noexcept
 Drop every password.
 
StormByte::Size Size () const noexcept
 Number of stored passwords.
 
bool Empty () const noexcept
 Whether the vault is empty.
 
Construction
 Vault ()=default
 Empty vault.
 
 Vault (const Vault &)=delete
 
 Vault (Vault &&other) noexcept
 Move constructor.
 
 ~Vault () noexcept
 Destructor.
 
Vault & operator= (const Vault &)=delete
 
Vault & operator= (Vault &&other) noexcept
 Move assignment.
 

Detailed Description

Named collection of Password objects.

Move-only. Destroying the vault, or calling Clear()/Remove(), drops the last owner of each password and triggers the wipe.

Constructor & Destructor Documentation

◆ Vault() [1/3]

StormByte::Crypto::Secure::Vault::Vault ( )
default

Empty vault.

◆ Vault() [2/3]

StormByte::Crypto::Secure::Vault::Vault ( const Vault &  )
delete

◆ Vault() [3/3]

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

Move constructor.

Parameters
otherVault to move.

◆ ~Vault()

StormByte::Crypto::Secure::Vault::~Vault ( )
noexcept

Destructor.

Releases every stored password.

Member Function Documentation

◆ Clear()

void StormByte::Crypto::Secure::Vault::Clear ( )
noexcept

Drop every password.

◆ Contains()

bool StormByte::Crypto::Secure::Vault::Contains ( std::string_view  name) const
noexcept

Whether a name exists.

Parameters
nameIdentifier.
Returns
true if present.

◆ Empty()

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

Whether the vault is empty.

Returns
true if Size() is 0.

◆ Get()

ExpectedPassword StormByte::Crypto::Secure::Vault::Get ( std::string_view  name) const
noexcept

Look up a password.

Parameters
nameIdentifier.
Returns
Password, or an error if the name is missing.
Note
The returned Password shares the buffer.

◆ operator=() [1/2]

Vault & StormByte::Crypto::Secure::Vault::operator= ( const Vault &  )
delete

◆ operator=() [2/2]

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

Move assignment.

Parameters
otherVault to move.
Returns
Reference to this vault.

◆ Remove()

void StormByte::Crypto::Secure::Vault::Remove ( std::string_view  name)
noexcept

Drop one password.

Parameters
nameIdentifier.

◆ Size()

StormByte::Size StormByte::Crypto::Secure::Vault::Size ( ) const
noexcept

Number of stored passwords.

Returns
Count.

◆ Store()

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

Store or overwrite a named password.

Parameters
nameIdentifier.
passwordPassword to share.

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