Add a method to allow checking if a token exists for a particular host

pull/569/head
Michael Zanetti 2021-03-22 20:02:45 +01:00
parent 58592d4094
commit faf1375db6
2 changed files with 8 additions and 0 deletions

View File

@ -156,6 +156,13 @@ void JsonRpcClient::acceptCertificate(const QString &serverUuid, const QByteArra
storePem(serverUuid, pem);
}
bool JsonRpcClient::tokenExists(const QString &serverUuid) const
{
QSettings settings;
settings.beginGroup("jsonTokens");
return settings.contains(QUuid(serverUuid).toString());
}
void JsonRpcClient::getCloudConnectionStatus()
{
JsonRpcReply *reply = createReply("JSONRPC.IsCloudConnected", QVariantMap(), this, "isCloudConnectedReply");

View File

@ -106,6 +106,7 @@ public:
Q_INVOKABLE void connectToHost(NymeaHost *host, Connection *connection = nullptr);
Q_INVOKABLE void disconnectFromHost();
Q_INVOKABLE void acceptCertificate(const QString &serverUuid, const QByteArray &pem);
Q_INVOKABLE bool tokenExists(const QString &serverUuid) const;
Q_INVOKABLE bool ensureServerVersion(const QString &jsonRpcVersion);