aboutsummaryrefslogtreecommitdiff
path: root/notsecrets
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-09-05 18:23:49 +0200
committerPetr Mrázek <peterix@gmail.com>2021-09-05 18:23:49 +0200
commit878c4fb8103bc866e5368fbb7287e94cca190dff (patch)
treefc8c0017d52af80bed159455f28c01f6a0dff648 /notsecrets
parentd644fb2094f623e45bff237ede7d432121f72072 (diff)
downloadPrismLauncher-878c4fb8103bc866e5368fbb7287e94cca190dff.tar.gz
PrismLauncher-878c4fb8103bc866e5368fbb7287e94cca190dff.tar.bz2
PrismLauncher-878c4fb8103bc866e5368fbb7287e94cca190dff.zip
NOISSUE Provide dummy implementation for the secrets library
Diffstat (limited to 'notsecrets')
-rw-r--r--notsecrets/CMakeLists.txt4
-rw-r--r--notsecrets/Secrets.cpp42
-rw-r--r--notsecrets/Secrets.h8
3 files changed, 54 insertions, 0 deletions
diff --git a/notsecrets/CMakeLists.txt b/notsecrets/CMakeLists.txt
new file mode 100644
index 00000000..f27aeb70
--- /dev/null
+++ b/notsecrets/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_library(secrets STATIC Secrets.cpp Secrets.h)
+target_link_libraries(secrets Qt5::Core)
+target_compile_definitions(secrets PUBLIC -DEMBED_SECRETS)
+target_include_directories(secrets PUBLIC .)
diff --git a/notsecrets/Secrets.cpp b/notsecrets/Secrets.cpp
new file mode 100644
index 00000000..88995635
--- /dev/null
+++ b/notsecrets/Secrets.cpp
@@ -0,0 +1,42 @@
+#include "Secrets.h"
+
+#include <array>
+#include <cstdio>
+
+namespace {
+
+/*
+ * This is the MSA client ID. It is confidential and should not be reused.
+ * You can obtain one for yourself by using azure app registration:
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
+ *
+ * The app registration should:
+ * - Be only for personal accounts.
+ * - Not have any redirect URI.
+ * - Not have any platform.
+ * - Have no credentials.
+ * - No certificates.
+ * - No client secrets.
+ * - Enable 'Live SDK support' for access to XBox APIs.
+ * - Enable 'public client flows' for OAuth2 device flow.
+ *
+ * By putting one in here, you accept the terms and conditions for using the MS Identity Plaform and assume all responsibilities associated with it.
+ * See: https://docs.microsoft.com/en-us/legal/microsoft-identity-platform/terms-of-use
+ *
+ * Above all else, do not impersonate other applications! This includes the Mojang Launcher and MultiMC - your builds are *NOT* MultiMC.
+ *
+ * If you intend to base your own launcher on this code, take care and customize this to obfuscate the client ID, so it cannot be trivially found by casual attackers.
+ */
+
+QString MSAClientID = "";
+}
+
+namespace Secrets {
+bool hasMSAClientID() {
+ return !MSAClientID.isEmpty();
+}
+
+QString getMSAClientID(uint8_t separator) {
+ return MSAClientID;
+}
+}
diff --git a/notsecrets/Secrets.h b/notsecrets/Secrets.h
new file mode 100644
index 00000000..6872b68e
--- /dev/null
+++ b/notsecrets/Secrets.h
@@ -0,0 +1,8 @@
+#pragma once
+#include <QString>
+#include <cstdint>
+
+namespace Secrets {
+bool hasMSAClientID();
+QString getMSAClientID(uint8_t separator);
+}