|
libnick 2025.10.0
A cross-platform base for native Nickvision applications.
|
A model of a keyring object for managing credentials. More...
#include <keyring.h>
Public Member Functions | |
| Keyring (const std::string &name) | |
| Constructs a Keyring. | |
| Keyring (const Keyring &)=delete | |
| Keyring (Keyring &&other) noexcept | |
| Constructs a Keyring via move. | |
| const std::string & | getName () const noexcept |
| Gets the name of the keyring. | |
| bool | isSavingToDisk () const noexcept |
| Gets whether the keyring is saving data to disk. | |
| const std::vector< Credential > & | getAll () const noexcept |
| Gets all credentials in the keyring. | |
| std::optional< Credential > | get (const std::string &name) noexcept |
| Gets the credential matching the provided name. | |
| bool | add (const Credential &credential) noexcept |
| Adds a credential to the keyring. | |
| bool | update (const Credential &credential) noexcept |
| Updates a credential in the keyring. | |
| bool | remove (const std::string &name) noexcept |
| Deletes a credential from the keyring. | |
| bool | destroy () noexcept |
| Destroys the keyring. | |
| Keyring & | operator= (const Keyring &)=delete |
| Keyring & | operator= (Keyring &&other) noexcept |
| Assigns a Keyring via move. | |
A model of a keyring object for managing credentials.
The keyring is an sqlite database, encrypted with a password stored in the system's credential manager.
| Nickvision::Keyring::Keyring::Keyring | ( | const std::string & | name | ) |
Constructs a Keyring.
If the system credential manager is not available, an in-memory database will be used (credentials will not be saved to disk).
| name | The name of the keyring |
| std::runtime_error | Thrown if error in database operations |
|
delete |
|
noexcept |
|
noexcept |
Adds a credential to the keyring.
| credential | The credential to add |
|
noexcept |
Destroys the keyring.
This will delete all data in the keyring and remove it from the system.
The object should not be used after as all methods will return false.
|
noexcept |
Gets the credential matching the provided name.
| name | The name of the credential |
|
noexcept |
Gets all credentials in the keyring.
|
noexcept |
Gets the name of the keyring.
|
noexcept |
Gets whether the keyring is saving data to disk.
|
noexcept |
Deletes a credential from the keyring.
| name | The name of the credential to delete |
|
noexcept |
Updates a credential in the keyring.
| credential | The credential to update |