Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33328673
D13894.1768874211.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D13894.1768874211.diff
View Options
diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.h b/native/cpp/CommonCpp/CryptoTools/Tools.h
--- a/native/cpp/CommonCpp/CryptoTools/Tools.h
+++ b/native/cpp/CommonCpp/CryptoTools/Tools.h
@@ -36,6 +36,7 @@
public:
static std::string generateRandomString(size_t size);
static std::string generateRandomHexString(size_t size);
+ static std::string generateRandomURLSafeString(size_t size);
};
} // namespace crypto
diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.cpp b/native/cpp/CommonCpp/CryptoTools/Tools.cpp
--- a/native/cpp/CommonCpp/CryptoTools/Tools.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/Tools.cpp
@@ -29,5 +29,11 @@
return Tools::generateRandomString(size, hexSigns);
}
+std::string Tools::generateRandomURLSafeString(size_t size) {
+ static std::string urlSafeSigns =
+ "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
+ return Tools::generateRandomString(size, urlSafeSigns);
+}
+
} // namespace crypto
} // namespace comm
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -2502,7 +2502,7 @@
std::string backupID;
try {
- backupID = crypto::Tools::generateRandomString(32);
+ backupID = crypto::Tools::generateRandomURLSafeString(32);
} catch (const std::exception &e) {
error = "Failed to generate backupID";
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 1:56 AM (2 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5959051
Default Alt Text
D13894.1768874211.diff (1 KB)
Attached To
Mode
D13894: [CommCoreModule] make sure `backupID` is URL-safe string
Attached
Detach File
Event Timeline
Log In to Comment