mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 20:22:27 +02:00
Fix secret defines
This commit is contained in:
parent
0bc0c73ef2
commit
0876a781f0
4 changed files with 27 additions and 10 deletions
|
@ -53,9 +53,20 @@ set_target_properties(${this_target} PROPERTIES
|
|||
|
||||
set(MACOSX_BUNDLE_ICON_FILE "interface.icns")
|
||||
|
||||
function(set_from_env _RESULT_NAME _ENV_VAR_NAME _DEFAULT_VALUE)
|
||||
if (NOT DEFINED ${_RESULT_NAME})
|
||||
if ("$ENV{${_ENV_VAR_NAME}}" STREQUAL "")
|
||||
set (${_RESULT_NAME} ${_DEFAULT_VALUE} PARENT_SCOPE)
|
||||
else()
|
||||
set (${_RESULT_NAME} $ENV{${_ENV_VAR_NAME}} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${src_files})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${APP_NAME})
|
||||
|
||||
set_from_env(LAUNCHER_HMAC_SECRET LAUNCHER_HMAC_SECRET "")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE LAUNCHER_HMAC_SECRET="${LAUNCHER_HMAC_SECRET}")
|
||||
|
||||
|
||||
file(GLOB NIB_FILES "nib/*.xib")
|
||||
|
|
|
@ -6,15 +6,12 @@
|
|||
|
||||
static NSString* const organizationURL = @"https://s3.amazonaws.com/hifi-public/huffman/organizations/";
|
||||
|
||||
#define str(s) #s
|
||||
#define LAUNCHER_HMAC_SECRET_STRING str(LAUNCHER_HMAC_SECRET)
|
||||
|
||||
@implementation OrganizationRequest
|
||||
|
||||
- (void) confirmOrganization:(NSString*)aOrganization :(NSString*)aUsername {
|
||||
self.username = aUsername;
|
||||
|
||||
const char *cKey = LAUNCHER_HMAC_SECRET_STRING;
|
||||
const char *cKey = LAUNCHER_HMAC_SECRET;
|
||||
const char *cData = [aOrganization cStringUsingEncoding:NSASCIIStringEncoding];
|
||||
unsigned char cHMAC[CC_SHA256_DIGEST_LENGTH];
|
||||
CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), cData, strlen(cData), cHMAC);
|
||||
|
|
|
@ -39,7 +39,19 @@ add_executable(HQLauncher
|
|||
targetver.h
|
||||
)
|
||||
|
||||
target_compile_definitions(HQLauncher PRIVATE LAUNCHER_HMAC_SECRET=$ENV{LAUNCHER_HMAC_SECRET})
|
||||
function(set_from_env _RESULT_NAME _ENV_VAR_NAME _DEFAULT_VALUE)
|
||||
if (NOT DEFINED ${_RESULT_NAME})
|
||||
if ("$ENV{${_ENV_VAR_NAME}}" STREQUAL "")
|
||||
set (${_RESULT_NAME} ${_DEFAULT_VALUE} PARENT_SCOPE)
|
||||
else()
|
||||
set (${_RESULT_NAME} $ENV{${_ENV_VAR_NAME}} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
set_from_env(LAUNCHER_HMAC_SECRET LAUNCHER_HMAC_SECRET "")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE LAUNCHER_HMAC_SECRET="${LAUNCHER_HMAC_SECRET}")
|
||||
|
||||
|
||||
# Preprocessor definitions
|
||||
target_compile_definitions(HQLauncher PRIVATE
|
||||
|
|
|
@ -170,12 +170,9 @@ void CLauncherDlg::startProcess() {
|
|||
}
|
||||
}
|
||||
|
||||
#define str(s) #s
|
||||
#define LAUNCHER_HMAC_SECRET_STRING str(LAUNCHER_HMAC_SECRET)
|
||||
|
||||
BOOL CLauncherDlg::getHQInfo(const CString& orgname) {
|
||||
CString hash;
|
||||
LauncherUtils::hMac256(orgname, LAUNCHER_HMAC_SECRET_STRING, hash);
|
||||
LauncherUtils::hMac256(orgname, LAUNCHER_HMAC_SECRET, hash);
|
||||
return theApp._manager.readOrganizationJSON(hash) == LauncherUtils::ResponseError::NoError;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue