KHealthCertificate

krecoverycertificate.cpp
1 /*
2  * SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
3  * SPDX-License-Identifier: LGPL-2.0-or-later
4  */
5 
6 #include "krecoverycertificate.h"
7 #include "khealthcertificatetypes_p.h"
8 
9 class KRecoveryCertificatePrivate : public QSharedData
10 {
11 public:
12  QString name;
13  QDate dateOfBirth;
14  QDate dateOfPositiveTest;
15  QDate validFrom;
16  QDate validUntil;
17  QString disease;
18  QString certificateIssuer;
19  QString certificateId;
20  QDateTime certificateIssueDate;
21  QDateTime certificateExpiryDate;
22  QByteArray rawData;
24 };
25 
26 KHEALTHCERTIFICATE_MAKE_GADGET(Recovery)
27 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QString, name, setName)
28 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QDate, dateOfBirth, setDateOfBirth)
29 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QDate, dateOfPositiveTest, setDateOfPositiveTest)
30 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QDate, validFrom, setValidFrom)
31 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QDate, validUntil, setValidUntil)
32 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QString, disease, setDisease)
33 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QString, certificateId, setCertificateId)
34 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QString, certificateIssuer, setCertificateIssuer)
35 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QDateTime, certificateIssueDate, setCertificateIssueDate)
36 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QDateTime, certificateExpiryDate, setCertificateExpiryDate)
37 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, QByteArray, rawData, setRawData)
38 KHEALTHCERTIFICATE_MAKE_PROPERTY(Recovery, KHealthCertificate::SignatureValidation, signatureState, setSignatureState)
39 
40 KHealthCertificate::CertificateValidation KRecoveryCertificate::validationState() const
41 {
42  if (d->certificateIssueDate > QDateTime::currentDateTime() || (d->certificateExpiryDate.isValid() && d->certificateExpiryDate < QDateTime::currentDateTime())) {
43  return KHealthCertificate::Invalid;
44  }
45  if (d->signatureState == KHealthCertificate::InvalidSignature) {
46  return KHealthCertificate::Invalid;
47  }
48 
49  if (d->signatureState == KHealthCertificate::UnknownSignature) {
50  return KHealthCertificate::Partial;
51  }
52 
53  return KHealthCertificate::Unknown;
54 }
55 
56 #include "moc_krecoverycertificate.cpp"
Dummy RTTI for QML, which doesn&#39;t support instanceof on Q_GADGETs...
QString name(const QVariant &location)
SignatureValidation
Result of attempting to verify the cryptographic signature of a certificate.
signature verification was attempted but didn&#39;t yield a result, e.g. due to a missing certificate of ...
QDateTime currentDateTime()
A recovery certificate.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 23:21:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.