Add cloud_project_number to updateApplicationVerificationRequired.
This commit is contained in:
parent
9c4a509b99
commit
db61f74b62
@ -177,7 +177,7 @@ authorizationStateClosed = AuthorizationState;
|
|||||||
//@description Device verification must be performed with the SafetyNet Attestation API @nonce Nonce to pass to the SafetyNet Attestation API
|
//@description Device verification must be performed with the SafetyNet Attestation API @nonce Nonce to pass to the SafetyNet Attestation API
|
||||||
firebaseDeviceVerificationParametersSafetyNet nonce:bytes = FirebaseDeviceVerificationParameters;
|
firebaseDeviceVerificationParametersSafetyNet nonce:bytes = FirebaseDeviceVerificationParameters;
|
||||||
|
|
||||||
//@description Device verification must be performed with the Play Integrity API
|
//@description Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic)
|
||||||
//@nonce Base64url-encoded nonce to pass to the Play Integrity API
|
//@nonce Base64url-encoded nonce to pass to the Play Integrity API
|
||||||
//@cloud_project_number Cloud project number to pass to the Play Integrity API
|
//@cloud_project_number Cloud project number to pass to the Play Integrity API
|
||||||
firebaseDeviceVerificationParametersPlayIntegrity nonce:string cloud_project_number:int64 = FirebaseDeviceVerificationParameters;
|
firebaseDeviceVerificationParametersPlayIntegrity nonce:string cloud_project_number:int64 = FirebaseDeviceVerificationParameters;
|
||||||
@ -7362,9 +7362,10 @@ updateFileRemovedFromDownloads file_id:int32 counts:downloadedFileCounts = Updat
|
|||||||
//@description A request can't be completed unless application verification is performed; for official mobile applications only.
|
//@description A request can't be completed unless application verification is performed; for official mobile applications only.
|
||||||
//-The method setApplicationVerificationToken must be called once the verification is completed or failed
|
//-The method setApplicationVerificationToken must be called once the verification is completed or failed
|
||||||
//@verification_id Unique identifier for the verification process
|
//@verification_id Unique identifier for the verification process
|
||||||
//@nonce Unique nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android,
|
//@nonce Unique base64url-encoded nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android,
|
||||||
//-or a unique string to compare with verify_nonce field from a push notification for iOS
|
//-or a unique string to compare with verify_nonce field from a push notification for iOS
|
||||||
updateApplicationVerificationRequired verification_id:int53 nonce:string = Update;
|
//@cloud_project_number Cloud project number to pass to the Play Integrity API on Android
|
||||||
|
updateApplicationVerificationRequired verification_id:int53 nonce:string cloud_project_number:int64 = Update;
|
||||||
|
|
||||||
//@description New call was created or information about a call was updated @call New data about a call
|
//@description New call was created or information about a call was updated @call New data about a call
|
||||||
updateCall call:call = Update;
|
updateCall call:call = Update;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
#include "td/telegram/telegram_api.h"
|
#include "td/telegram/telegram_api.h"
|
||||||
|
|
||||||
|
#include "td/utils/base64.h"
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/Slice.h"
|
#include "td/utils/Slice.h"
|
||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
@ -24,7 +25,22 @@ void NetQueryVerifier::verify(NetQueryPtr query, string nonce) {
|
|||||||
CHECK(query->is_ready());
|
CHECK(query->is_ready());
|
||||||
CHECK(query->is_error());
|
CHECK(query->is_error());
|
||||||
|
|
||||||
|
int64 cloud_project_number = 0;
|
||||||
|
auto status = [&] {
|
||||||
if (!check_utf8(nonce)) {
|
if (!check_utf8(nonce)) {
|
||||||
|
return Status::Error(400, "Invalid encoding");
|
||||||
|
}
|
||||||
|
#if TD_ANDROID
|
||||||
|
string cloud_project_number_str;
|
||||||
|
std::tie(cloud_project_number_str, nonce) = split(nonce, '_');
|
||||||
|
TRY_RESULT_ASSIGN(cloud_project_number, to_integer_safe<int64>(cloud_project_number_str));
|
||||||
|
TRY_RESULT_ASSIGN(nonce, hex_decode(nonce));
|
||||||
|
nonce = base64url_encode(nonce);
|
||||||
|
#endif
|
||||||
|
return Status::OK();
|
||||||
|
}();
|
||||||
|
if (status.is_error()) {
|
||||||
|
LOG(ERROR) << "Receive " << status;
|
||||||
query->set_error(Status::Error(400, "Invalid verification nonce"));
|
query->set_error(Status::Error(400, "Invalid verification nonce"));
|
||||||
G()->net_query_dispatcher().dispatch(std::move(query));
|
G()->net_query_dispatcher().dispatch(std::move(query));
|
||||||
return;
|
return;
|
||||||
@ -33,8 +49,9 @@ void NetQueryVerifier::verify(NetQueryPtr query, string nonce) {
|
|||||||
auto query_id = next_query_id_++;
|
auto query_id = next_query_id_++;
|
||||||
queries_.emplace(query_id, std::make_pair(std::move(query), nonce));
|
queries_.emplace(query_id, std::make_pair(std::move(query), nonce));
|
||||||
|
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(
|
||||||
td_api::make_object<td_api::updateApplicationVerificationRequired>(query_id, nonce));
|
G()->td(), &Td::send_update,
|
||||||
|
td_api::make_object<td_api::updateApplicationVerificationRequired>(query_id, nonce, cloud_project_number));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetQueryVerifier::set_verification_token(int64 query_id, string &&token, Promise<Unit> &&promise) {
|
void NetQueryVerifier::set_verification_token(int64 query_id, string &&token, Promise<Unit> &&promise) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user