summaryrefslogtreecommitdiff
path: root/src/network/verify_user.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2022-07-25 18:31:45 -0400
committerGitHub <noreply@github.com>2022-07-25 18:31:45 -0400
commit1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2 (patch)
tree999411f1ca76390654d1034c6d0bd2c47c3f101c /src/network/verify_user.h
parent1bcde9dd9879fc2677695e9283f2fe1d68c935b2 (diff)
parenta41baaa181f30229d3552caa69135be978c1ddb5 (diff)
Merge pull request #8541 from FearlessTobi/multiplayer-part1
yuzu, network: Add room service and UI configuration
Diffstat (limited to 'src/network/verify_user.h')
-rw-r--r--src/network/verify_user.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/network/verify_user.h b/src/network/verify_user.h
new file mode 100644
index 000000000..6fc64d8a3
--- /dev/null
+++ b/src/network/verify_user.h
@@ -0,0 +1,45 @@
+// SPDX-FileCopyrightText: Copyright 2018 Citra Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <string>
+#include "common/logging/log.h"
+
+namespace Network::VerifyUser {
+
+struct UserData {
+ std::string username;
+ std::string display_name;
+ std::string avatar_url;
+ bool moderator = false; ///< Whether the user is a yuzu Moderator.
+};
+
+/**
+ * A backend used for verifying users and loading user data.
+ */
+class Backend {
+public:
+ virtual ~Backend();
+
+ /**
+ * Verifies the given token and loads the information into a UserData struct.
+ * @param verify_uid A GUID that may be used for verification.
+ * @param token A token that contains user data and verification data. The format and content is
+ * decided by backends.
+ */
+ virtual UserData LoadUserData(const std::string& verify_uid, const std::string& token) = 0;
+};
+
+/**
+ * A null backend where the token is ignored.
+ * No verification is performed here and the function returns an empty UserData.
+ */
+class NullBackend final : public Backend {
+public:
+ ~NullBackend();
+
+ UserData LoadUserData(const std::string& verify_uid, const std::string& token) override;
+};
+
+} // namespace Network::VerifyUser