File indexing completed on 2024-05-12 13:54:22
0001 /* 0002 * SPDX-License-Identifier: GPL-3.0-or-later 0003 * SPDX-FileCopyrightText: 2020 Johan Ouwerkerk <jm.ouwerkerk@gmail.com> 0004 */ 0005 #ifndef ACCOUNTS_VALIDATION_H 0006 #define ACCOUNTS_VALIDATION_H 0007 0008 #include "account.h" 0009 0010 #include <QCryptographicHash> 0011 #include <QDateTime> 0012 #include <QString> 0013 #include <QUuid> 0014 0015 #include <functional> 0016 #include <optional> 0017 0018 namespace accounts 0019 { 0020 bool checkId(const QUuid &id); 0021 bool checkSecret(const QString &secret); 0022 bool checkName(const QString &name); 0023 bool checkIssuer(const QString &issuer); 0024 bool checkTokenLength(uint tokenLength); 0025 bool checkTimeStep(uint timeStep); 0026 bool checkEpoch(const QDateTime &epoch, const std::function<qint64(void)> &clock = &QDateTime::currentMSecsSinceEpoch); 0027 bool checkOffset(const std::optional<uint> &offset, QCryptographicHash::Algorithm algorithm); 0028 } 0029 0030 #endif