Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3169084
D13894.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13894.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
Fri, Nov 8, 9:20 AM (11 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2440552
Default Alt Text
D13894.diff (1 KB)
Attached To
Mode
D13894: [CommCoreModule] make sure `backupID` is URL-safe string
Attached
Detach File
Event Timeline
Log In to Comment