libnick 2024.12.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. | |
const std::string & | getName () const |
Gets the name of the keyring. | |
bool | isSavingToDisk () const |
Gets whether the keyring is saving data to disk. | |
const std::vector< Credential > & | getCredentials () const |
Gets all credentials in the keyring. | |
std::optional< Credential > | getCredential (const std::string &name) |
Gets the credential matching the provided name. | |
bool | addCredential (const Credential &credential) |
Adds a credential to the keyring. | |
bool | updateCredential (const Credential &credential) |
Updates a credential in the keyring. | |
bool | deleteCredential (const std::string &name) |
Deletes a credential from the keyring. | |
bool | destroy () |
Destroys the keyring. | |
A model of a keyring object for managing credentials.
The keyring is 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, the object will be functional but will not save any data to disk.
name | The name of the keyring |
bool Nickvision::Keyring::Keyring::addCredential | ( | const Credential & | credential | ) |
Adds a credential to the keyring.
credential | The credential to add |
bool Nickvision::Keyring::Keyring::deleteCredential | ( | const std::string & | name | ) |
Deletes a credential from the keyring.
name | The name of the credential to delete |
bool Nickvision::Keyring::Keyring::destroy | ( | ) |
Destroys the keyring.
This will delete all data in the keyring and put the object in a state where no data can be saved to disk.
std::optional< Credential > Nickvision::Keyring::Keyring::getCredential | ( | const std::string & | name | ) |
Gets the credential matching the provided name.
name | The name of the credential |
const std::vector< Credential > & Nickvision::Keyring::Keyring::getCredentials | ( | ) | const |
Gets all credentials in the keyring.
const std::string & Nickvision::Keyring::Keyring::getName | ( | ) | const |
Gets the name of the keyring.
bool Nickvision::Keyring::Keyring::isSavingToDisk | ( | ) | const |
Gets whether the keyring is saving data to disk.
bool Nickvision::Keyring::Keyring::updateCredential | ( | const Credential & | credential | ) |
Updates a credential in the keyring.
credential | The credential to update |