libnick 2025.9.1
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
passwordgenerator.h
Go to the documentation of this file.
1
22
23#ifndef PASSWORDGENERATOR_H
24#define PASSWORDGENERATOR_H
25
26#include <random>
27#include <string>
28#include "passwordcontent.h"
29
30namespace Nickvision::Keyring
31{
36 {
37 public:
52 void setContentFlags(PasswordContent contentFlags) noexcept;
58 std::string next(size_t length = 16) noexcept;
59
60 private:
61 PasswordContent m_contentFlags;
62 std::random_device m_randomDevice;
63 std::mt19937 m_randomEngine;
64 };
65}
66
67#endif //PASSWORDGENERATOR_H
PasswordGenerator(PasswordContent contentFlags=PasswordContent::Numeric|PasswordContent::Uppercase|PasswordContent::Lowercase|PasswordContent::Special|PasswordContent::Space) noexcept
Constructs a PasswordGenerator.
void setContentFlags(PasswordContent contentFlags) noexcept
Sets the flags of possible characters for the generator to use.
PasswordContent getContentFlags() const noexcept
Gets the flags of possible characters for the generator to use.
std::string next(size_t length=16) noexcept
Generates a new password.
Definition credential.h:29
PasswordContent
Flags to describe the content of a password.
Definition passwordcontent.h:34
@ Uppercase
The password contains uppercase characters.
Definition passwordcontent.h:36
@ Numeric
The password contains numeric characters.
Definition passwordcontent.h:35
@ Special
The password contains special characters.
Definition passwordcontent.h:38
@ Space
The password contains spaces.
Definition passwordcontent.h:39
@ Lowercase
The password contains lowercase characters.
Definition passwordcontent.h:37