diff --git a/.github/workflows/plugin-cd.yml b/.github/workflows/plugin-cd.yml index c06a0ed..a1be719 100644 --- a/.github/workflows/plugin-cd.yml +++ b/.github/workflows/plugin-cd.yml @@ -7,7 +7,7 @@ on: - 'v*' env: - VCPKG_COMMIT_HASH: "59852bb5bd0779788e5fc95e50d2048ae6c9399d" + VCPKG_COMMIT_HASH: "a82dd0cef6e9d81e764b3bccdf12bbb90c6f34ee" jobs: build-win64: @@ -28,7 +28,6 @@ jobs: name: Win64 path: | ./build/vcpkg/installed/*/lib/configcat.lib - ./build/vcpkg/installed/*/lib/hash-library.lib build-android: runs-on: windows-latest @@ -48,7 +47,6 @@ jobs: name: Android path: | ./build/vcpkg/installed/*/lib/libconfigcat.a - ./build/vcpkg/installed/*/lib/libhash-library.a build-macos: runs-on: macos-latest @@ -68,7 +66,6 @@ jobs: name: MacOS path: | ./build/vcpkg/installed/*/lib/libconfigcat.a - ./build/vcpkg/installed/*/lib/libhash-library.a build-ios: runs-on: macos-latest @@ -88,7 +85,6 @@ jobs: name: iOS path: | ./build/vcpkg/installed/*/lib/libconfigcat.a - ./build/vcpkg/installed/*/lib/libhash-library.a build-linux: runs-on: ubuntu-latest @@ -113,7 +109,6 @@ jobs: name: Linux path: | ./build/vcpkg/installed/*/lib/libconfigcat.a - ./build/vcpkg/installed/*/lib/libhash-library.a publish-engine-plugin: runs-on: ubuntu-latest diff --git a/.github/workflows/plugin-ci.yml b/.github/workflows/plugin-ci.yml index 959580a..617ac8c 100644 --- a/.github/workflows/plugin-ci.yml +++ b/.github/workflows/plugin-ci.yml @@ -9,7 +9,7 @@ on: - main env: - VCPKG_COMMIT_HASH: "59852bb5bd0779788e5fc95e50d2048ae6c9399d" + VCPKG_COMMIT_HASH: "a82dd0cef6e9d81e764b3bccdf12bbb90c6f34ee" jobs: build-linux: @@ -34,7 +34,6 @@ jobs: run: | mkdir -p ${{ github.workspace }}/Source/ThirdParty/ConfigCatCppSDK/Binaries/Linux/x64-linux-unreal/ cp ${{ github.workspace }}/build/vcpkg/installed/x64-linux-unreal/lib/libconfigcat.a ${{ github.workspace }}/Source/ThirdParty/ConfigCatCppSDK/Binaries/Linux/x64-linux-unreal/libconfigcat.a - cp ${{ github.workspace }}/build/vcpkg/installed/x64-linux-unreal/lib/libhash-library.a ${{ github.workspace }}/Source/ThirdParty/ConfigCatCppSDK/Binaries/Linux/x64-linux-unreal/libhash-library.a rm -r ./build/* diff --git a/ConfigCat.uplugin b/ConfigCat.uplugin index 87543d3..915dc39 100644 --- a/ConfigCat.uplugin +++ b/ConfigCat.uplugin @@ -1,6 +1,6 @@ { "FileVersion": 3, - "VersionName": "2.0.1", + "VersionName": "2.1.0", "EngineVersion": "5.3", "FriendlyName": "ConfigCat", "Description": "ConfigCat is a hosted service for feature flag and configuration management. It lets you decouple feature releases from code deployments.", diff --git a/Extras/licenses/hash-library/LICENSE b/Extras/licenses/hash-library/LICENSE deleted file mode 100644 index e540da6..0000000 --- a/Extras/licenses/hash-library/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -zlib License - -Copyright (c) 2014,2015 Stephan Brumme - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. - If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. diff --git a/README.md b/README.md index 917f779..d594893 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,4 @@ ConfigCat is a feature flag and configuration management service that lets you s ConfigCat is a hosted feature flag service. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs. ## External Libraries -The underlying ConfigCat C++ SDK uses these wonderful libraries: [hash-library](https://create.stephan-brumme.com/hash-library), [nlohmann-json](https://github.com/nlohmann/json), [z4kn4fein-semver](https://github.com/z4kn4fein/cpp-semver). \ No newline at end of file +The underlying ConfigCat C++ SDK uses these wonderful libraries: [nlohmann-json](https://github.com/nlohmann/json), [z4kn4fein-semver](https://github.com/z4kn4fein/cpp-semver). \ No newline at end of file diff --git a/Source/ConfigCat/ConfigCat.Build.cs b/Source/ConfigCat/ConfigCat.Build.cs index 7ebcf59..f72eda0 100644 --- a/Source/ConfigCat/ConfigCat.Build.cs +++ b/Source/ConfigCat/ConfigCat.Build.cs @@ -13,9 +13,12 @@ public ConfigCat(ReadOnlyTargetRules Target) : base(Target) "DeveloperSettings", "Projects", "Engine", - "HTTP" + "HTTP", + "OpenSSL" }); + AddEngineThirdPartyPrivateStaticDependencies(Target, "OpenSSL"); + PrivateDependencyModuleNames.AddRange(new[] { "ConfigCatWrappers", @@ -32,7 +35,7 @@ public ConfigCat(ReadOnlyTargetRules Target) : base(Target) PrivateDefinitions.Add("CONFIGCAT_HTTPTHREAD_WORKAROUND"); } - + bEnableExceptions = true; } } \ No newline at end of file diff --git a/Source/ConfigCat/Private/ConfigCat.cpp b/Source/ConfigCat/Private/ConfigCat.cpp index 3071cf4..897df22 100644 --- a/Source/ConfigCat/Private/ConfigCat.cpp +++ b/Source/ConfigCat/Private/ConfigCat.cpp @@ -4,9 +4,9 @@ #include -IMPLEMENT_MODULE(FConfigCatModule, ConfigCat) - FString FConfigCatModule::GetContentFolder() { return FPaths::ProjectContentDir() + TEXT("ConfigCat"); } + +IMPLEMENT_MODULE(FConfigCatModule, ConfigCat) diff --git a/Source/ConfigCat/Private/ConfigCatSha.cpp b/Source/ConfigCat/Private/ConfigCatSha.cpp new file mode 100644 index 0000000..19b98a5 --- /dev/null +++ b/Source/ConfigCat/Private/ConfigCatSha.cpp @@ -0,0 +1,38 @@ +// Copyright (c) ConfigCat 2024. All Rights Reserved. + +#include "ConfigCatSha.h" + +#include + +std::string configcat::sha1(const std::string& input) +{ + TArray BytesArrayToHash; + BytesArrayToHash.Append(reinterpret_cast(input.data()), input.size()); + + FSHAHash const Hash = FSHA1::HashBuffer(BytesArrayToHash.GetData(), BytesArrayToHash.Num()); + FString FinalString; + for (int i = 0; i < 20; i++) + { + FinalString += FString::Printf(TEXT("%02x"), Hash.Hash[i]); + } + + return TCHAR_TO_UTF8(*FinalString); +} + +std::string configcat::sha256(const std::string& input) +{ + TArray> Digest; + Digest.AddUninitialized(SHA256_DIGEST_LENGTH); + SHA256_CTX sha256; + SHA256_Init(&sha256); + SHA256_Update(&sha256, input.c_str(), input.size()); + SHA256_Final(Digest.GetData(), &sha256); + + FString FinalString; + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) + { + FinalString += FString::Printf(TEXT("%02x"), Digest[i]); + } + + return TCHAR_TO_UTF8(*FinalString); +} \ No newline at end of file diff --git a/Source/ConfigCat/Private/ConfigCatSubsystem.cpp b/Source/ConfigCat/Private/ConfigCatSubsystem.cpp index 71930c4..f1638d7 100644 --- a/Source/ConfigCat/Private/ConfigCatSubsystem.cpp +++ b/Source/ConfigCat/Private/ConfigCatSubsystem.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include #include diff --git a/Source/ConfigCat/Public/ConfigCatSha.h b/Source/ConfigCat/Public/ConfigCatSha.h new file mode 100644 index 0000000..48e08bb --- /dev/null +++ b/Source/ConfigCat/Public/ConfigCatSha.h @@ -0,0 +1,14 @@ +// Copyright (c) ConfigCat 2024. All Rights Reserved. + +#pragma once + +namespace configcat +{ + + /** + * Implementation of the configcat hashing functions for Sha1 & Sha256 + * @note This is done to avoid the extra dependency on hash-node library for the Unreal Engine SDK + */ + std::string sha1(const std::string& input); + std::string sha256(const std::string& input); +} \ No newline at end of file