Implements FileContent::parse() as a single streaming pass over the entry, with the field cap, the display-line cap and the OTP candidate search, plus the cached secret-field-name matcher.
More...
#include "filecontent.h"
#include "totp.h"
#include <QRegularExpression>
#include <QCoreApplication>
#include <QStringTokenizer>
#include <algorithm>
#include <limits>
#include <utility>
Go to the source code of this file.
|
| static auto | isOtpUri (const QString &value) -> bool |
| | Shorthand for the public FileContent::isOtpUriValue.
|
| static auto | bareOtpUriOf (const QString &line) -> QString |
| | The otpauth URI a line is written as: a bare otpauth:// line, or the split otpauth: //... that 1.8 to 2.0-rc2 saved (a template field "otpauth" with the rest of the URI as its value), its blanks dropped.
|
| static auto | isLineHidden (const QString &line) -> bool |
| | Whether a body line must stay out of the parsed display because it carries a TOTP shared secret (FileContent::isOtpLine()). "Display the
file's content as-is" bypasses this filter and shows the entry raw.
|
| static auto | isBase32Seed (const QString &value) -> bool |
| | Whether value is written as a TOTP seed: base32 letters and the digits 2 to 7 only (either case; white space, dashes, dots or underscores between groups and "=" padding allowed), at least 16 of them (80 bits, the shortest seed in common use), that Totp::isValid() takes.
|
| static auto | afterFirstColon (const QString &line) -> QString |
| | What follows a line's first colon; empty without one.
|
| static auto | holdsOtpConfig (const QString &line) -> bool |
| | Whether a first line is written as an OTP configuration that otpConfigOf() can read: a bare otpauth URI (split or not, see bareOtpUriOf()), a field whose value is one, or an OTP:/TOTP: field whose value is written as a base32 seed.
|
| static auto | otpConfigOf (const QString &line) -> QString |
| | The OTP configuration an OTP line holds: the URI for a bare otpauth:// line (bareOtpUriOf()), the value for a field.
|
Implements FileContent::parse() as a single streaming pass over the entry, with the field cap, the display-line cap and the OTP candidate search, plus the cached secret-field-name matcher.
Definition in file filecontent.cpp.
◆ afterFirstColon()
| auto afterFirstColon |
( |
const QString & | line | ) |
-> QString |
|
static |
What follows a line's first colon; empty without one.
- Parameters
-
| line | One line of the entry. |
- Returns
- The text after the first ':', or an empty string.
Definition at line 104 of file filecontent.cpp.
◆ bareOtpUriOf()
| auto bareOtpUriOf |
( |
const QString & | line | ) |
-> QString |
|
static |
The otpauth URI a line is written as: a bare otpauth:// line, or the split otpauth: //... that 1.8 to 2.0-rc2 saved (a template field "otpauth" with the rest of the URI as its value), its blanks dropped.
- Parameters
-
| line | One line of the entry. |
- Returns
- The URI, trimmed, or an empty string when the line is not one.
Definition at line 37 of file filecontent.cpp.
◆ holdsOtpConfig()
| auto holdsOtpConfig |
( |
const QString & | line | ) |
-> bool |
|
static |
Whether a first line is written as an OTP configuration that otpConfigOf() can read: a bare otpauth URI (split or not, see bareOtpUriOf()), a field whose value is one, or an OTP:/TOTP: field whose value is written as a base32 seed.
- Parameters
-
| line | The entry's first line. |
- Returns
- true when the line is read as the OTP configuration.
Definition at line 117 of file filecontent.cpp.
◆ isBase32Seed()
| auto isBase32Seed |
( |
const QString & | value | ) |
-> bool |
|
static |
Whether value is written as a TOTP seed: base32 letters and the digits 2 to 7 only (either case; white space, dashes, dots or underscores between groups and "=" padding allowed), at least 16 of them (80 bits, the shortest seed in common use), that Totp::isValid() takes.
Strict where Totp::parse() is lenient (it drops punctuation and reads 0, 1 and 8 as letters, which almost any password survives): this decides whether a first line is a seed or the password.
- Parameters
-
| value | The value of an OTP:/TOTP: field. |
- Returns
- true when it can only be read as a seed.
Definition at line 79 of file filecontent.cpp.
◆ isLineHidden()
| auto isLineHidden |
( |
const QString & | line | ) |
-> bool |
|
static |
Whether a body line must stay out of the parsed display because it carries a TOTP shared secret (FileContent::isOtpLine()). "Display the
file's content as-is" bypasses this filter and shows the entry raw.
- Parameters
-
| line | One line of the entry body. |
- Returns
- true when the line is kept out of getRemainingDataForDisplay().
Definition at line 63 of file filecontent.cpp.
◆ isOtpUri()
| auto isOtpUri |
( |
const QString & | value | ) |
-> bool |
|
static |
◆ otpConfigOf()
| auto otpConfigOf |
( |
const QString & | line | ) |
-> QString |
|
static |
The OTP configuration an OTP line holds: the URI for a bare otpauth:// line (bareOtpUriOf()), the value for a field.
- Parameters
-
- Returns
- The configuration, trimmed.
Definition at line 139 of file filecontent.cpp.