File Information
Library: OSP/Auth/TwoFactor
Package: TwoFactor
Header: Poco/OSP/Auth/TwoFactor/SecretGenerator.h
Description
Member Summary
Member Functions: fromBase32, generate, toBase32, toURI
Constructors
SecretGenerator
SecretGenerator() = default;
Creates a SecretGenerator with the default secret length (128 bits).
SecretGenerator
explicit SecretGenerator(
std::size_t secretLengthBits
);
Creates a SecretGenerator with the given secret length in bits. The length must be a multiple of 8. The secret length should be from 80 to 160 bits. Lengths shorter than 80 will be rejected.
Member Functions
fromBase32
static std::string fromBase32(
const std::string & base32
);
Decodes the base32-encoded secret to a binary string.
generate
std::string generate() const;
Generates a new secret and returns it in a binary string.
toBase32
static std::string toBase32(
const std::string & secret
);
Encodes a secret in Base32.
toURI
static std::string toURI(
const std::string & secret,
const std::string & issuer,
const std::string & account
);
Generates a URI suitable for displaying as a QR code.
See https://github.com/google/google-authenticator/wiki/Key-Uri-Format for more information.