Page MenuHomePhabricator

D13894.id.diff
No OneTemporary

D13894.id.diff

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

Mime Type
text/plain
Expires
Fri, Nov 8, 9:58 AM (12 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2440552
Default Alt Text
D13894.id.diff (1 KB)

Event Timeline