inputPassportDateError.
GitOrigin-RevId: 1a3da4ea394244b6def4af6a08e855e13e048866
This commit is contained in:
parent
b4b9d19768
commit
89c54af478
@ -930,19 +930,23 @@ encryptedCredentials data:bytes hash:bytes secret:bytes = EncryptedCredentials;
|
||||
encryptedPassportData type:PassportDataType data:bytes files:vector<file> value:string selfie:file = EncryptedPassportData;
|
||||
|
||||
|
||||
//@class PassportDataError @description Contains description of an error in a Telegram Passport data; for bots only
|
||||
//@class InputPassportDataErrorSource @description Contains description of an error in a Telegram Passport data; for bots only
|
||||
|
||||
//@description A field of data contains an error. The error is considered resolved when the field's value changes @type Telegram Passport data type @field_name Field name @data_hash Current data hash @message Error message
|
||||
passportDataErrorDataField type:PassportDataType field_name:string data_hash:bytes message:string = PassportDataError;
|
||||
//@description A field of data contains an error. The error is considered resolved when the field's value changes @field_name Field name @data_hash Current data hash
|
||||
inputPassportDataErrorSourceDataField field_name:string data_hash:bytes = InputPassportDataErrorSource;
|
||||
|
||||
//@description A file contains an error. The error is considered resolved when the file changes @type Telegram Passport data type @file_hash Hash of the file with an error @message Error message
|
||||
passportDataErrorFile type:PassportDataType file_hash:bytes message:string = PassportDataError;
|
||||
//@description A file contains an error. The error is considered resolved when the file changes @file_hash Hash of the file with an error
|
||||
inputPassportDataErrorSourceFile file_hash:bytes = InputPassportDataErrorSource;
|
||||
|
||||
//@description A list of attached files contains an error. The error is considered resolved when the file list changes @type Telegram Passport data type @file_hashes Hashes of all files @message Error message
|
||||
passportDataErrorFiles type:PassportDataType file_hashes:vector<bytes> message:string = PassportDataError;
|
||||
//@description A list of attached files contains an error. The error is considered resolved when the file list changes @type Telegram Passport data type @file_hashes Hashes of all files
|
||||
inputPassportDataErrorSourceFiles file_hashes:vector<bytes> = InputPassportDataErrorSource;
|
||||
|
||||
//@description A selfie contains an error. The error is considered resolved when the file with the selfie changes @type Telegram Passport data type @file_hash Current file with the selfie hash @message Error message
|
||||
passportDataErrorSelfie type:PassportDataType file_hash:bytes message:string = PassportDataError;
|
||||
//@description A selfie contains an error. The error is considered resolved when the file with the selfie changes @file_hash Current file with the selfie hash
|
||||
inputPassportDataErrorSourceSelfie file_hash:bytes = InputPassportDataErrorSource;
|
||||
|
||||
|
||||
//@description Contains description of an error in a Telegram Passport data; for bots only @type Telegram Passport data type with the error @message Error message @source Error source
|
||||
inputPassportDataError type:PassportDataType message:string source:InputPassportDataErrorSource = InputPassportDataError;
|
||||
|
||||
|
||||
//@class MessageContent @description Contains the content of a message
|
||||
@ -1063,7 +1067,7 @@ messageWebsiteConnected domain_name:string = MessageContent;
|
||||
//@description Telegram Passport data has been sent @types List of types of sent data
|
||||
messagePassportDataSent types:vector<PassportDataType> = MessageContent;
|
||||
|
||||
//@description Telegram Passport data has been received; for bots only @data List of received Telegram Passport data @credentials Encrypted Secure storage data credentials
|
||||
//@description Telegram Passport data has been received; for bots only @data List of received Telegram Passport data @credentials Encrypted data credentials
|
||||
messagePassportDataReceived data:vector<encryptedPassportData> credentials:encryptedCredentials = MessageContent;
|
||||
|
||||
//@description Message content that is not supported by the client
|
||||
@ -2996,7 +3000,7 @@ setPassportData data:InputPassportData password:string = PassportData;
|
||||
deletePassportData type:PassportDataType = Ok;
|
||||
|
||||
//@description Informs a user that some Telegram Passport data contains errors; for bots only. The user will not be able to resend data, until the errors are fixed @user_id User identifier @errors The errors
|
||||
setPassportDataErrors user_id:int32 errors:vector<PassportDataError> = Ok;
|
||||
setPassportDataErrors user_id:int32 errors:vector<inputPassportDataError> = Ok;
|
||||
|
||||
|
||||
//@description Sends phone number verification code for Telegram Passport
|
||||
|
Binary file not shown.
@ -514,77 +514,57 @@ void SecureManager::delete_secure_value(SecureValueType type, Promise<Unit> prom
|
||||
}
|
||||
|
||||
void SecureManager::set_secure_value_errors(Td *td, tl_object_ptr<telegram_api::InputUser> input_user,
|
||||
vector<tl_object_ptr<td_api::PassportDataError>> errors,
|
||||
vector<tl_object_ptr<td_api::inputPassportDataError>> errors,
|
||||
Promise<Unit> promise) {
|
||||
CHECK(td != nullptr);
|
||||
CHECK(input_user != nullptr);
|
||||
vector<tl_object_ptr<telegram_api::SecureValueError>> input_errors;
|
||||
for (auto &error_ptr : errors) {
|
||||
if (error_ptr == nullptr) {
|
||||
for (auto &error : errors) {
|
||||
if (error == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Error must be non-empty"));
|
||||
}
|
||||
switch (error_ptr->get_id()) {
|
||||
case td_api::passportDataErrorDataField::ID: {
|
||||
auto error = td_api::move_object_as<td_api::passportDataErrorDataField>(error_ptr);
|
||||
if (error->type_ == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Type must be non-empty"));
|
||||
}
|
||||
if (!clean_input_string(error->message_)) {
|
||||
return promise.set_error(Status::Error(400, "Error message must be encoded in UTF-8"));
|
||||
}
|
||||
if (!clean_input_string(error->field_name_)) {
|
||||
if (error->type_ == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Type must be non-empty"));
|
||||
}
|
||||
if (!clean_input_string(error->message_)) {
|
||||
return promise.set_error(Status::Error(400, "Error message must be encoded in UTF-8"));
|
||||
}
|
||||
if (error->source_ == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Error source must be non-empty"));
|
||||
}
|
||||
|
||||
auto type = get_secure_value_type_object(get_secure_value_type_td_api(error->type_));
|
||||
switch (error->source_->get_id()) {
|
||||
case td_api::inputPassportDataErrorSourceDataField::ID: {
|
||||
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceDataField>(error->source_);
|
||||
if (!clean_input_string(source->field_name_)) {
|
||||
return promise.set_error(Status::Error(400, "Field name must be encoded in UTF-8"));
|
||||
}
|
||||
|
||||
auto type = get_secure_value_type_object(get_secure_value_type_td_api(error->type_));
|
||||
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorData>(
|
||||
std::move(type), BufferSlice(error->data_hash_), error->field_name_, error->message_));
|
||||
std::move(type), BufferSlice(source->data_hash_), source->field_name_, error->message_));
|
||||
break;
|
||||
}
|
||||
case td_api::passportDataErrorFile::ID: {
|
||||
auto error = td_api::move_object_as<td_api::passportDataErrorFile>(error_ptr);
|
||||
if (error->type_ == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Type must be non-empty"));
|
||||
}
|
||||
if (!clean_input_string(error->message_)) {
|
||||
return promise.set_error(Status::Error(400, "Error message must be encoded in UTF-8"));
|
||||
}
|
||||
|
||||
auto type = get_secure_value_type_object(get_secure_value_type_td_api(error->type_));
|
||||
case td_api::inputPassportDataErrorSourceFile::ID: {
|
||||
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceFile>(error->source_);
|
||||
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorFile>(
|
||||
std::move(type), BufferSlice(error->file_hash_), error->message_));
|
||||
std::move(type), BufferSlice(source->file_hash_), error->message_));
|
||||
break;
|
||||
}
|
||||
case td_api::passportDataErrorFiles::ID: {
|
||||
auto error = td_api::move_object_as<td_api::passportDataErrorFiles>(error_ptr);
|
||||
if (error->type_ == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Type must be non-empty"));
|
||||
}
|
||||
if (!clean_input_string(error->message_)) {
|
||||
return promise.set_error(Status::Error(400, "Error message must be encoded in UTF-8"));
|
||||
}
|
||||
if (error->file_hashes_.empty()) {
|
||||
case td_api::inputPassportDataErrorSourceFiles::ID: {
|
||||
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceFiles>(error->source_);
|
||||
if (source->file_hashes_.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Error hashes must be non-empty"));
|
||||
}
|
||||
|
||||
auto type = get_secure_value_type_object(get_secure_value_type_td_api(error->type_));
|
||||
auto file_hashes = transform(error->file_hashes_, [](Slice hash) { return BufferSlice(hash); });
|
||||
auto file_hashes = transform(source->file_hashes_, [](Slice hash) { return BufferSlice(hash); });
|
||||
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorFiles>(
|
||||
std::move(type), std::move(file_hashes), error->message_));
|
||||
break;
|
||||
}
|
||||
case td_api::passportDataErrorSelfie::ID: {
|
||||
auto error = td_api::move_object_as<td_api::passportDataErrorSelfie>(error_ptr);
|
||||
if (error->type_ == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Type must be non-empty"));
|
||||
}
|
||||
if (!clean_input_string(error->message_)) {
|
||||
return promise.set_error(Status::Error(400, "Error message must be encoded in UTF-8"));
|
||||
}
|
||||
|
||||
auto type = get_secure_value_type_object(get_secure_value_type_td_api(error->type_));
|
||||
case td_api::inputPassportDataErrorSourceSelfie::ID: {
|
||||
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceSelfie>(error->source_);
|
||||
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorSelfie>(
|
||||
std::move(type), BufferSlice(error->file_hash_), error->message_));
|
||||
std::move(type), BufferSlice(source->file_hash_), error->message_));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -131,7 +131,7 @@ class SecureManager : public NetQueryCallback {
|
||||
void set_secure_value(string password, SecureValue secure_value, Promise<TdApiSecureValue> promise);
|
||||
void delete_secure_value(SecureValueType type, Promise<Unit> promise);
|
||||
void set_secure_value_errors(Td *td, tl_object_ptr<telegram_api::InputUser> input_user,
|
||||
vector<tl_object_ptr<td_api::PassportDataError>> errors, Promise<Unit> promise);
|
||||
vector<tl_object_ptr<td_api::inputPassportDataError>> errors, Promise<Unit> promise);
|
||||
|
||||
void get_passport_authorization_form(string password, UserId bot_user_id, string scope, string public_key,
|
||||
string payload, Promise<TdApiAuthorizationForm> promise);
|
||||
|
Reference in New Issue
Block a user