libnick 2024.12.0
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
keyring.h
Go to the documentation of this file.
1
23#ifndef KEYRING_H
24#define KEYRING_H
25
26#include <memory>
27#include <optional>
28#include <string>
29#include <vector>
30#include "credential.h"
32
33namespace Nickvision::Keyring
34{
39 class Keyring
40 {
41 public:
47 Keyring(const std::string& name);
52 const std::string& getName() const;
57 bool isSavingToDisk() const;
62 const std::vector<Credential>& getCredentials() const;
68 std::optional<Credential> getCredential(const std::string& name);
74 bool addCredential(const Credential& credential);
80 bool updateCredential(const Credential& credential);
86 bool deleteCredential(const std::string& name);
92 bool destroy();
93
94 private:
95 std::string m_name;
96 std::shared_ptr<Database::SqlDatabase> m_database;
97 std::vector<Credential> m_credentials;
98 };
99}
100
101#endif //KEYRING_H
A model of a credential stored in a keyring.
Definition credential.h:35
A model of a keyring object for managing credentials.
Definition keyring.h:40
Keyring(const std::string &name)
Constructs a Keyring.
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 isSavingToDisk() const
Gets whether the keyring is saving data to disk.
bool updateCredential(const Credential &credential)
Updates a credential in the keyring.
bool deleteCredential(const std::string &name)
Deletes a credential from the keyring.
bool addCredential(const Credential &credential)
Adds a credential to the keyring.
bool destroy()
Destroys the keyring.
const std::string & getName() const
Gets the name of the keyring.
Definition credential.h:30