libnick 2025.9.1
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
Nickvision::System::Credentials Namespace Reference

Functions

std::optional< Keyring::Credentialget (const std::string &name) noexcept
 Gets a credential from the system's credential manager.
 
std::optional< Keyring::Credentialcreate (const std::string &name) noexcept
 Creates a new credential with a random password and adds it to the system's credential manager.
 
bool add (const Keyring::Credential &credential) noexcept
 Adds a new credential object to the system's credential manager.
 
bool update (const Keyring::Credential &credential) noexcept
 Updates a credential object in the system's credential manager.
 
bool remove (const std::string &name) noexcept
 Removes a credential object from the system's credential manager.
 

Function Documentation

◆ add()

bool Nickvision::System::Credentials::add ( const Keyring::Credential & credential)
noexcept

Adds a new credential object to the system's credential manager.

On Linux, only the name and password of a credential object will be stored.

On Windows, all fields of a credential object will be stored.

On macOS, all fields of a credential object will be stored.

Parameters
credentialThe new credential object
Returns
True if the credential object was added
False if the credential object was not added

◆ create()

std::optional< Keyring::Credential > Nickvision::System::Credentials::create ( const std::string & name)
noexcept

Creates a new credential with a random password and adds it to the system's credential manager.

Parameters
nameThe name of the credential to create
Returns
The new Credential object
std::nullopt if the credential could not be created

◆ get()

std::optional< Keyring::Credential > Nickvision::System::Credentials::get ( const std::string & name)
noexcept

Gets a credential from the system's credential manager.

Parameters
nameThe name of the credential
Returns
The Credential object
std::nullopt if the credential was not found

◆ remove()

bool Nickvision::System::Credentials::remove ( const std::string & name)
noexcept

Removes a credential object from the system's credential manager.

Parameters
nameThe name of the credential to remove
Returns
True if the credential object was removed
False if the credential object was not removed

◆ update()

bool Nickvision::System::Credentials::update ( const Keyring::Credential & credential)
noexcept

Updates a credential object in the system's credential manager.

On Linux, only the name and password of a credential object will be stored.

On Windows, all fields of a credential object will be stored.

On macOS, all fields of a credential object will be stored.

Parameters
credentialThe updated credential object
Returns
True if the credential object was updated
False if the credential object was not updated