42 #ifndef _DWMAUTHPUBLICKEYSFILE_HH_ 43 #define _DWMAUTHPUBLICKEYSFILE_HH_ 61 typedef std::map<std::string,Ed25519::PublicKey> Map;
77 bool Load(
const std::string & fileName);
84 bool AddKey(
const std::string & name,
const Ed25519::PublicKey & key);
89 bool AddKey(
const std::string & name,
const std::string & base64str);
103 bool Save(
const std::string & fileName,
int perms = 0644)
const;
109 bool Find(
const std::string & name,
110 Ed25519::PublicKey & key)
const;
115 const Map &
Keys()
const;
118 std::map<std::string,Ed25519::PublicKey> _keys;
125 #endif // _DWMAUTHPUBLICKEYSFILE_HH_ const Map & Keys() const
Returns a const reference to the contained public keys.
PublicKeysFile()
Constructor.
bool RemoveKey(const std::string &name)
Removes the key with the given name from the contained map of keys.
bool Save(const std::string &fileName, int perms=0644) const
Saves the contained map of keys to the file with the given fileName with permissions @perms.
bool AddKey(const std::string &name, const Ed25519::PublicKey &key)
Adds a key with the given name to the contained map of keys.
Encapsulates a file containing public keys in a format similar to (but not the same as) an ssh author...
Definition: DwmAuthPublicKeysFile.hh:58
bool Find(const std::string &name, Ed25519::PublicKey &key) const
Searches the keys for the one with the given name.
bool Load(const std::string &fileName)
Loads the public keys from the file at the given path fileName.