NOISSUE Provide dummy implementation for the secrets library

This commit is contained in:
Petr Mrázek
2021-09-05 18:23:49 +02:00
parent d644fb2094
commit 878c4fb810
7 changed files with 69 additions and 13 deletions

View File

@ -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 .)

42
notsecrets/Secrets.cpp Normal file
View File

@ -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;
}
}

8
notsecrets/Secrets.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include <QString>
#include <cstdint>
namespace Secrets {
bool hasMSAClientID();
QString getMSAClientID(uint8_t separator);
}