Change Telegram Passport API object and function names.

GitOrigin-RevId: 8e7d3602146dab76f62aa86f7539187559d2ca92
This commit is contained in:
levlam 2018-08-01 16:52:07 +03:00
parent e691803f21
commit 986652a1ae
10 changed files with 349 additions and 347 deletions

View File

@ -109,7 +109,7 @@ authorizationStateClosing = AuthorizationState;
authorizationStateClosed = AuthorizationState;
//@description Represents the current state of 2-step verification @has_password True if a 2-step verification password has been set up @password_hint Hint for the password; can be empty @has_recovery_email_address True if a recovery email has been set up @has_passport_data True if some Telegram Passport data has been saved @unconfirmed_recovery_email_address_pattern Pattern of the email address to which a confirmation email was sent
//@description Represents the current state of 2-step verification @has_password True if a 2-step verification password has been set up @password_hint Hint for the password; can be empty @has_recovery_email_address True if a recovery email has been set up @has_passport_data True if some Telegram Passport elements has been saved @unconfirmed_recovery_email_address_pattern Pattern of the email address to which a confirmation email was sent
passwordState has_password:Bool password_hint:string has_recovery_email_address:Bool has_passport_data:Bool unconfirmed_recovery_email_address_pattern:string = PasswordState;
//@description Contains information about the current recovery email address @recovery_email_address Recovery email address
@ -828,46 +828,46 @@ paymentReceipt date:int32 payments_provider_user_id:int32 invoice:invoice order_
datedFile file:file date:int32 = DatedFile;
//@class PassportDataType @description Contains type of a Telegram Passport data
//@class PassportElementType @description Contains type of a Telegram Passport element
//@description A Telegram Passport data fragment containing the user's personal details
passportDataTypePersonalDetails = PassportDataType;
//@description A Telegram Passport element containing the user's personal details
passportElementTypePersonalDetails = PassportElementType;
//@description A Telegram Passport data fragment containing the user's passport
passportDataTypePassport = PassportDataType;
//@description A Telegram Passport element containing the user's passport
passportElementTypePassport = PassportElementType;
//@description A Telegram Passport data fragment containing the user's driver license
passportDataTypeDriverLicense = PassportDataType;
//@description A Telegram Passport element containing the user's driver license
passportElementTypeDriverLicense = PassportElementType;
//@description A Telegram Passport data fragment containing the user's identity card
passportDataTypeIdentityCard = PassportDataType;
//@description A Telegram Passport element containing the user's identity card
passportElementTypeIdentityCard = PassportElementType;
//@description A Telegram Passport data fragment containing the user's internal passport
passportDataTypeInternalPassport = PassportDataType;
//@description A Telegram Passport element containing the user's internal passport
passportElementTypeInternalPassport = PassportElementType;
//@description A Telegram Passport data fragment containing the user's address
passportDataTypeAddress = PassportDataType;
//@description A Telegram Passport element containing the user's address
passportElementTypeAddress = PassportElementType;
//@description A Telegram Passport data fragment containing the user's utility bill
passportDataTypeUtilityBill = PassportDataType;
//@description A Telegram Passport element containing the user's utility bill
passportElementTypeUtilityBill = PassportElementType;
//@description A Telegram Passport data fragment containing the user's bank statement
passportDataTypeBankStatement = PassportDataType;
//@description A Telegram Passport element containing the user's bank statement
passportElementTypeBankStatement = PassportElementType;
//@description A Telegram Passport data fragment containing the user's rental agreement
passportDataTypeRentalAgreement = PassportDataType;
//@description A Telegram Passport element containing the user's rental agreement
passportElementTypeRentalAgreement = PassportElementType;
//@description A Telegram Passport data fragment containing the user's passport registration
passportDataTypePassportRegistration = PassportDataType;
//@description A Telegram Passport element containing the user's passport registration
passportElementTypePassportRegistration = PassportElementType;
//@description A Telegram Passport data fragment containing the user's temporary registration
passportDataTypeTemporaryRegistration = PassportDataType;
//@description A Telegram Passport element containing the user's temporary registration
passportElementTypeTemporaryRegistration = PassportElementType;
//@description A Telegram Passport data fragment containing a user's phone number
passportDataTypePhoneNumber = PassportDataType;
//@description A Telegram Passport element containing a user's phone number
passportElementTypePhoneNumber = PassportElementType;
//@description A Telegram Passport data fragment containing a user's email address
passportDataTypeEmailAddress = PassportDataType;
//@description A Telegram Passport element containing a user's email address
passportElementTypeEmailAddress = PassportElementType;
//@description Represents a date according to the Gregorian calendar @day Day of the month, 1-31 @month Month, 1-12 @year Year, 1-9999
@ -886,156 +886,156 @@ identityDocument number:string expiry_date:date front_side:datedFile reverse_sid
inputIdentityDocument number:string expiry_date:date front_side:InputFile reverse_side:InputFile selfie:InputFile = InputIdentityDocument;
//@class PassportData @description Contains information about a Telegram Passport data
//@class PassportElement @description Contains information about a Telegram Passport element
//@description A Telegram Passport data fragment containing the user's personal details @personal_details Personal details of the user
passportDataPersonalDetails personal_details:personalDetails = PassportData;
//@description A Telegram Passport element containing the user's personal details @personal_details Personal details of the user
passportElementPersonalDetails personal_details:personalDetails = PassportElement;
//@description A Telegram Passport data fragment containing the user's passport @passport Passport
passportDataPassport passport:identityDocument = PassportData;
//@description A Telegram Passport element containing the user's passport @passport Passport
passportElementPassport passport:identityDocument = PassportElement;
//@description A Telegram Passport data fragment containing the user's driver license @driver_license Driver license
passportDataDriverLicense driver_license:identityDocument = PassportData;
//@description A Telegram Passport element containing the user's driver license @driver_license Driver license
passportElementDriverLicense driver_license:identityDocument = PassportElement;
//@description A Telegram Passport data fragment containing the user's identity card @identity_card Identity card
passportDataIdentityCard identity_card:identityDocument = PassportData;
//@description A Telegram Passport element containing the user's identity card @identity_card Identity card
passportElementIdentityCard identity_card:identityDocument = PassportElement;
//@description A Telegram Passport data fragment containing the user's internal passport @internal_passport Internal passport
passportDataInternalPassport internal_passport:identityDocument = PassportData;
//@description A Telegram Passport element containing the user's internal passport @internal_passport Internal passport
passportElementInternalPassport internal_passport:identityDocument = PassportElement;
//@description A Telegram Passport data fragment containing the user's address @address Address
passportDataAddress address:address = PassportData;
//@description A Telegram Passport element containing the user's address @address Address
passportElementAddress address:address = PassportElement;
//@description A Telegram Passport data fragment containing the user's utility bill @files List of files with the utility bill
passportDataUtilityBill files:vector<datedFile> = PassportData;
//@description A Telegram Passport element containing the user's utility bill @files List of files with the utility bill
passportElementUtilityBill files:vector<datedFile> = PassportElement;
//@description A Telegram Passport data fragment containing the user's bank statement @files List of files with the bank statement
passportDataBankStatement files:vector<datedFile> = PassportData;
//@description A Telegram Passport element containing the user's bank statement @files List of files with the bank statement
passportElementBankStatement files:vector<datedFile> = PassportElement;
//@description A Telegram Passport data fragment containing the user's rental agreement @files List of files with the rental agreement
passportDataRentalAgreement files:vector<datedFile> = PassportData;
//@description A Telegram Passport element containing the user's rental agreement @files List of files with the rental agreement
passportElementRentalAgreement files:vector<datedFile> = PassportElement;
//@description A Telegram Passport data fragment containing the user's passport registration pages @files List of files with the passport registration pages
passportDataPassportRegistration files:vector<datedFile> = PassportData;
//@description A Telegram Passport element containing the user's passport registration pages @files List of files with the passport registration pages
passportElementPassportRegistration files:vector<datedFile> = PassportElement;
//@description A Telegram Passport data fragment containing the user's temporary registration @files List of files with the temporary registration
passportDataTemporaryRegistration files:vector<datedFile> = PassportData;
//@description A Telegram Passport element containing the user's temporary registration @files List of files with the temporary registration
passportElementTemporaryRegistration files:vector<datedFile> = PassportElement;
//@description A Telegram Passport data fragment containing the user's phone number @phone_number Phone number
passportDataPhoneNumber phone_number:string = PassportData;
//@description A Telegram Passport element containing the user's phone number @phone_number Phone number
passportElementPhoneNumber phone_number:string = PassportElement;
//@description A Telegram Passport data fragment containing the user's email address @email_address Email address
passportDataEmailAddress email_address:string = PassportData;
//@description A Telegram Passport element containing the user's email address @email_address Email address
passportElementEmailAddress email_address:string = PassportElement;
//@class InputPassportData @description Contains information about a Telegram Passport data to be saved
//@class InputPassportElement @description Contains information about a Telegram Passport element to be saved
//@description A Telegram Passport fragment to be saved containing the user's personal details @personal_details Personal details of the user
inputPassportDataPersonalDetails personal_details:personalDetails = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's personal details @personal_details Personal details of the user
inputPassportElementPersonalDetails personal_details:personalDetails = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's passport @passport The passport to be saved
inputPassportDataPassport passport:inputIdentityDocument = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's passport @passport The passport to be saved
inputPassportElementPassport passport:inputIdentityDocument = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's driver license @driver_license The driver license to be saved
inputPassportDataDriverLicense driver_license:inputIdentityDocument = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's driver license @driver_license The driver license to be saved
inputPassportElementDriverLicense driver_license:inputIdentityDocument = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's identity card @identity_card The identity card to be saved
inputPassportDataIdentityCard identity_card:inputIdentityDocument = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's identity card @identity_card The identity card to be saved
inputPassportElementIdentityCard identity_card:inputIdentityDocument = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's internal passport @internal_passport The internal passport to be saved
inputPassportDataInternalPassport internal_passport:inputIdentityDocument = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's internal passport @internal_passport The internal passport to be saved
inputPassportElementInternalPassport internal_passport:inputIdentityDocument = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's address @address The address to be saved
inputPassportDataAddress address:address = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's address @address The address to be saved
inputPassportElementAddress address:address = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's utility bill @files List of files with the utility bill
inputPassportDataUtilityBill files:vector<InputFile> = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's utility bill @files List of files with the utility bill
inputPassportElementUtilityBill files:vector<InputFile> = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's bank statement @files List of files with the bank statement
inputPassportDataBankStatement files:vector<InputFile> = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's bank statement @files List of files with the bank statement
inputPassportElementBankStatement files:vector<InputFile> = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's rental agreement @files List of files with the rental agreement
inputPassportDataRentalAgreement files:vector<InputFile> = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's rental agreement @files List of files with the rental agreement
inputPassportElementRentalAgreement files:vector<InputFile> = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's passport registration @files List of files with the passport registration
inputPassportDataPassportRegistration files:vector<InputFile> = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's passport registration @files List of files with the passport registration
inputPassportElementPassportRegistration files:vector<InputFile> = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's temporary registration @files List of files with the temporary registration
inputPassportDataTemporaryRegistration files:vector<InputFile> = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's temporary registration @files List of files with the temporary registration
inputPassportElementTemporaryRegistration files:vector<InputFile> = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's phone number @phone_number The phone number to be saved
inputPassportDataPhoneNumber phone_number:string = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's phone number @phone_number The phone number to be saved
inputPassportElementPhoneNumber phone_number:string = InputPassportElement;
//@description A Telegram Passport fragment to be saved containing the user's email address @email_address The email address to be saved
inputPassportDataEmailAddress email_address:string = InputPassportData;
//@description A Telegram Passport element to be saved containing the user's email address @email_address The email address to be saved
inputPassportElementEmailAddress email_address:string = InputPassportElement;
//@description Contains information about all saved Telegram Passport data @data All saved Telegram Passport data
allPassportData data:vector<PassportData> = AllPassportData;
//@description Contains information about saved Telegram Passport elements @elements Telegram Passport elements
passportElements elements:vector<PassportElement> = PassportElements;
//@class PassportDataErrorSource @description Contains the description of an error in a Telegram Passport data
//@class PassportElementErrorSource @description Contains the description of an error in a Telegram Passport element
//@description One of the data fields contains an error. The error will be considered resolved when the value of the field changes @field_name Field name
passportDataErrorSourceDataField field_name:string = PassportDataErrorSource;
passportElementErrorSourceDataField field_name:string = PassportElementErrorSource;
//@description The front side of the document contains an error. The error will be considered resolved when the file with the front side changes
passportDataErrorSourceFrontSide = PassportDataErrorSource;
passportElementErrorSourceFrontSide = PassportElementErrorSource;
//@description The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes
passportDataErrorSourceReverseSide = PassportDataErrorSource;
passportElementErrorSourceReverseSide = PassportElementErrorSource;
//@description The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes
passportDataErrorSourceSelfie = PassportDataErrorSource;
passportElementErrorSourceSelfie = PassportElementErrorSource;
//@description The file contains an error. The error will be considered resolved when the file changes
passportDataErrorSourceFile = PassportDataErrorSource;
passportElementErrorSourceFile = PassportElementErrorSource;
//@description The list of attached files contains an error. The error will be considered resolved when the list of files changes
passportDataErrorSourceFiles = PassportDataErrorSource;
passportElementErrorSourceFiles = PassportElementErrorSource;
//@description Contains the description of an error in Telegram Passport data @type Type of the Telegram Passport data which has the error @message Error message @source Error source
passportDataError type:PassportDataType message:string source:PassportDataErrorSource = PassportDataError;
//@description Contains the description of an error in a Telegram Passport element @type Type of the Telegram Passport element which has the error @message Error message @source Error source
passportElementError type:PassportElementType message:string source:PassportElementErrorSource = PassportElementError;
//@description Contains information about a Telegram Passport authorization form that was requested @id Unique identifier of the authorization form
//@required_types Data types that need to be provided to complete the form. If the user has more than one identity document or proof of address document, any one of each can be chosen
//@data Already available data @errors Errors in the data that is already available @is_selfie_required True, if a selfie is required with the identity document @privacy_policy_url URL for the privacy policy of the service; can be empty
passportAuthorizationForm id:int32 required_types:vector<PassportDataType> data:vector<PassportData> errors:vector<passportDataError> is_selfie_required:Bool privacy_policy_url:string = PassportAuthorizationForm;
//@required_types Telegram Passport element types that need to be provided to complete the form. If the user has more than one identity document or proof of address document, any one of each can be chosen
//@elements Already available Telegram Passport elements @errors Errors in the elements that is already available @is_selfie_required True, if a selfie is required with the identity document @privacy_policy_url URL for the privacy policy of the service; can be empty
passportAuthorizationForm id:int32 required_types:vector<PassportElementType> elements:vector<PassportElement> errors:vector<passportElementError> is_selfie_required:Bool privacy_policy_url:string = PassportAuthorizationForm;
//@description Contains encrypted Telegram Passport data credentials @data The encrypted credentials @hash The decrypted data hash @secret Secret for data decryption, encrypted with service's public key
encryptedCredentials data:bytes hash:bytes secret:bytes = EncryptedCredentials;
//@description Contains information about encrypted Telegram Passport data; for bots only @type Type of Telegram Passport data @data Encrypted JSON-encoded data about the user @front_side The front side of an identity document @reverse_side The reverse side of an identity document; may be null @selfie Selfie with the document; may be null @files List of attached files @value Unencrypted data, phone number or email address
encryptedPassportData type:PassportDataType data:bytes front_side:datedFile reverse_side:datedFile selfie:datedFile files:vector<datedFile> value:string = EncryptedPassportData;
//@description Contains information about encrypted Telegram Passport element; for bots only @type Type of Telegram Passport element @data Encrypted JSON-encoded data about the user @front_side The front side of an identity document @reverse_side The reverse side of an identity document; may be null @selfie Selfie with the document; may be null @files List of attached files @value Unencrypted data, phone number or email address
encryptedPassportElement type:PassportElementType data:bytes front_side:datedFile reverse_side:datedFile selfie:datedFile files:vector<datedFile> value:string = EncryptedPassportElement;
//@class InputPassportDataErrorSource @description Contains the description of an error in Telegram Passport data; for bots only
//@class InputPassportElementErrorSource @description Contains the description of an error in Telegram Passport element; for bots only
//@description A data field 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;
inputPassportElementErrorSourceDataField field_name:string data_hash:bytes = InputPassportElementErrorSource;
//@description The front side of the document contains an error. The error is considered resolved when the file with the document front side changes @file_hash Current hash of the file containing the front side
inputPassportDataErrorSourceFrontSide file_hash:bytes = InputPassportDataErrorSource;
inputPassportElementErrorSourceFrontSide file_hash:bytes = InputPassportElementErrorSource;
//@description The reverse side of the document contains an error. The error is considered resolved when the file with the document reverse side changes @file_hash Current hash of the file containing the reverse side
inputPassportDataErrorSourceReverseSide file_hash:bytes = InputPassportDataErrorSource;
inputPassportElementErrorSourceReverseSide file_hash:bytes = InputPassportElementErrorSource;
//@description The selfie contains an error. The error is considered resolved when the file with the selfie changes @file_hash Current hash of the file containing the selfie
inputPassportDataErrorSourceSelfie file_hash:bytes = InputPassportDataErrorSource;
inputPassportElementErrorSourceSelfie file_hash:bytes = InputPassportElementErrorSource;
//@description The 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;
inputPassportElementErrorSourceFile file_hash:bytes = InputPassportElementErrorSource;
//@description The list of attached files contains an error. The error is considered resolved when the file list changes @file_hashes Hashes of all files
inputPassportDataErrorSourceFiles file_hashes:vector<bytes> = InputPassportDataErrorSource;
inputPassportElementErrorSourceFiles file_hashes:vector<bytes> = InputPassportElementErrorSource;
//@description Contains the description of an error in Telegram Passport data; for bots only @type Type of Telegram Passport data that has the error @message Error message @source Error source
inputPassportDataError type:PassportDataType message:string source:InputPassportDataErrorSource = InputPassportDataError;
//@description Contains the description of an error in Telegram Passport element; for bots only @type Type of Telegram Passport element that has the error @message Error message @source Error source
inputPassportElementError type:PassportElementType message:string source:InputPassportElementErrorSource = InputPassportElementError;
//@class MessageContent @description Contains the content of a message
@ -1153,11 +1153,11 @@ messageContactRegistered = MessageContent;
//@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website
messageWebsiteConnected domain_name:string = MessageContent;
//@description Telegram Passport data has been sent @types List of data types sent
messagePassportDataSent types:vector<PassportDataType> = MessageContent;
//@description Telegram Passport data has been sent @types List of Telegram Passport element types sent
messagePassportDataSent types:vector<PassportElementType> = MessageContent;
//@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 Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials
messagePassportDataReceived elements:vector<encryptedPassportElement> credentials:encryptedCredentials = MessageContent;
//@description Message content that is not supported by the client
messageUnsupported = MessageContent;
@ -3168,20 +3168,20 @@ addNetworkStatistics entry:NetworkStatisticsEntry = Ok;
resetNetworkStatistics = Ok;
//@description Returns the available Telegram Passport data @type Data type @password Password of the current user
getPassportData type:PassportDataType password:string = PassportData;
//@description Returns the available Telegram Passport element @type Telegram Passport element type @password Password of the current user
getPassportElement type:PassportElementType password:string = PassportElement;
//@description Returns all available Telegram Passport data @password Password of the current user
getAllPassportData password:string = AllPassportData;
//@description Returns all available Telegram Passport elements @password Password of the current user
getAllPassportElements password:string = PassportElements;
//@description Sets Telegram Passport data. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first @data Input Telegram Passport data @password Password of the current user
setPassportData data:InputPassportData password:string = PassportData;
//@description Sets Telegram Passport element. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first @element Input Telegram Passport element @password Password of the current user
setPassportElement element:InputPassportElement password:string = PassportElement;
//@description Deletes Telegram Passport data @type Data type
deletePassportData type:PassportDataType = Ok;
//@description Deletes Telegram Passport element @type Element type
deletePassportElement type:PassportElementType = Ok;
//@description Informs a user that some of the 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<inputPassportDataError> = Ok;
//@description Informs a user that some of the Telegram Passport elements contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed @user_id User identifier @errors The errors
setPassportElementErrors user_id:int32 errors:vector<inputPassportElementError> = Ok;
//@description Sends a code to verify a phone number to be added to a user's Telegram Passport
@ -3205,11 +3205,11 @@ resendEmailAddressVerificationCode = EmailAddressAuthenticationCodeInfo;
checkEmailAddressVerificationCode code:string = Ok;
//@description Returns a Telegram Passport authorization form for sharing data with a service @bot_user_id User identified of the service's bot @scope Telegram Passport data types requested by the service @public_key Service's public_key @payload Authorization form payload provided by the service @password Password of the current user
//@description Returns a Telegram Passport authorization form for sharing data with a service @bot_user_id User identified of the service's bot @scope Telegram Passport element types requested by the service @public_key Service's public_key @payload Authorization form payload provided by the service @password Password of the current user
getPassportAuthorizationForm bot_user_id:int32 scope:string public_key:string payload:string password:string = PassportAuthorizationForm;
//@description Sends a Telegram Passport authorization form, effectively sharing data with the service @autorization_form_id Authorization form identifier @types Types of Telegram Passport data chosen by user to complete the authorization form @password Password of the current user
sendPassportAuthorizationForm autorization_form_id:int32 types:vector<PassportDataType> password:string = Ok;
//@description Sends a Telegram Passport authorization form, effectively sharing data with the service @autorization_form_id Authorization form identifier @types Types of Telegram Passport elements chosen by user to complete the authorization form @password Password of the current user
sendPassportAuthorizationForm autorization_form_id:int32 types:vector<PassportElementType> password:string = Ok;
//@description Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link @hash Value of the "hash" parameter from the link

Binary file not shown.

View File

@ -9557,12 +9557,12 @@ tl_object_ptr<td_api::MessageContent> MessagesManager::get_message_content_objec
}
case MessagePassportDataSent::ID: {
const MessagePassportDataSent *m = static_cast<const MessagePassportDataSent *>(content);
return make_tl_object<td_api::messagePassportDataSent>(get_passport_data_types_object(m->types));
return make_tl_object<td_api::messagePassportDataSent>(get_passport_element_types_object(m->types));
}
case MessagePassportDataReceived::ID: {
const MessagePassportDataReceived *m = static_cast<const MessagePassportDataReceived *>(content);
return make_tl_object<td_api::messagePassportDataReceived>(
get_encrypted_passport_data_object(td_->file_manager_.get(), m->values),
get_encrypted_passport_element_object(td_->file_manager_.get(), m->values),
get_encrypted_credentials_object(m->credentials));
}
default:

View File

@ -49,12 +49,12 @@ class GetSecureValue : public NetQueryCallback {
class GetAllSecureValues : public NetQueryCallback {
public:
GetAllSecureValues(ActorShared<> parent, std::string password, Promise<TdApiAllSecureValues> promise);
GetAllSecureValues(ActorShared<> parent, std::string password, Promise<TdApiSecureValues> promise);
private:
ActorShared<> parent_;
string password_;
Promise<TdApiAllSecureValues> promise_;
Promise<TdApiSecureValues> promise_;
optional<vector<EncryptedSecureValue>> encrypted_secure_values_;
optional<secure_storage::Secret> secret_;
@ -225,8 +225,7 @@ void GetSecureValue::on_result(NetQueryPtr query) {
loop();
}
GetAllSecureValues::GetAllSecureValues(ActorShared<> parent, std::string password,
Promise<TdApiAllSecureValues> promise)
GetAllSecureValues::GetAllSecureValues(ActorShared<> parent, std::string password, Promise<TdApiSecureValues> promise)
: parent_(std::move(parent)), password_(std::move(password)), promise_(std::move(promise)) {
}
@ -262,7 +261,7 @@ void GetAllSecureValues::loop() {
}
auto secure_values = transform(r_secure_values.move_as_ok(),
[](SecureValueWithCredentials &&value) { return std::move(value.value); });
promise_.set_result(get_all_passport_data_object(file_manager, std::move(secure_values)));
promise_.set_result(get_passport_elements_object(file_manager, std::move(secure_values)));
stop();
}
@ -504,7 +503,7 @@ void SetSecureValue::on_result(NetQueryPtr query) {
auto *file_manager = G()->td().get_actor_unsafe()->file_manager_.get();
auto encrypted_secure_value = get_encrypted_secure_value(file_manager, std::move(result));
if (encrypted_secure_value.type == SecureValueType::None) {
return on_error(Status::Error(500, "Receive invalid Telegram Passport data"));
return on_error(Status::Error(500, "Receive invalid Telegram Passport element"));
}
if (secure_value_.files.size() != encrypted_secure_value.files.size()) {
return on_error(Status::Error(500, "Different file count"));
@ -667,22 +666,23 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
break;
}
auto r_passport_data = get_passport_data_object(file_manager, std::move(r_secure_value.move_as_ok().value));
if (r_passport_data.is_error()) {
LOG(ERROR) << "Failed to get passport data object: " << r_passport_data.error();
auto r_passport_element =
get_passport_element_object(file_manager, std::move(r_secure_value.move_as_ok().value));
if (r_passport_element.is_error()) {
LOG(ERROR) << "Failed to get passport element object: " << r_passport_element.error();
break;
}
values.push_back(r_passport_data.move_as_ok());
values.push_back(r_passport_element.move_as_ok());
break;
}
}
vector<td_api::object_ptr<td_api::passportDataError>> errors;
vector<td_api::object_ptr<td_api::passportElementError>> errors;
for (auto &error_ptr : authorization_form_->errors_) {
CHECK(error_ptr != nullptr);
SecureValueType type = SecureValueType::None;
td_api::object_ptr<td_api::PassportDataErrorSource> source;
td_api::object_ptr<td_api::PassportElementErrorSource> source;
string message;
switch (error_ptr->get_id()) {
case telegram_api::secureValueErrorData::ID: {
@ -693,42 +693,42 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
if (field_name.empty()) {
break;
}
source = td_api::make_object<td_api::passportDataErrorSourceDataField>(std::move(field_name));
source = td_api::make_object<td_api::passportElementErrorSourceDataField>(std::move(field_name));
break;
}
case telegram_api::secureValueErrorFile::ID: {
auto error = move_tl_object_as<telegram_api::secureValueErrorFile>(error_ptr);
type = get_secure_value_type(error->type_);
message = std::move(error->text_);
source = td_api::make_object<td_api::passportDataErrorSourceFile>();
source = td_api::make_object<td_api::passportElementErrorSourceFile>();
break;
}
case telegram_api::secureValueErrorFiles::ID: {
auto error = move_tl_object_as<telegram_api::secureValueErrorFiles>(error_ptr);
type = get_secure_value_type(error->type_);
message = std::move(error->text_);
source = td_api::make_object<td_api::passportDataErrorSourceFiles>();
source = td_api::make_object<td_api::passportElementErrorSourceFiles>();
break;
}
case telegram_api::secureValueErrorFrontSide::ID: {
auto error = move_tl_object_as<telegram_api::secureValueErrorFrontSide>(error_ptr);
type = get_secure_value_type(error->type_);
message = std::move(error->text_);
source = td_api::make_object<td_api::passportDataErrorSourceFrontSide>();
source = td_api::make_object<td_api::passportElementErrorSourceFrontSide>();
break;
}
case telegram_api::secureValueErrorReverseSide::ID: {
auto error = move_tl_object_as<telegram_api::secureValueErrorReverseSide>(error_ptr);
type = get_secure_value_type(error->type_);
message = std::move(error->text_);
source = td_api::make_object<td_api::passportDataErrorSourceReverseSide>();
source = td_api::make_object<td_api::passportElementErrorSourceReverseSide>();
break;
}
case telegram_api::secureValueErrorSelfie::ID: {
auto error = move_tl_object_as<telegram_api::secureValueErrorSelfie>(error_ptr);
type = get_secure_value_type(error->type_);
message = std::move(error->text_);
source = td_api::make_object<td_api::passportDataErrorSourceSelfie>();
source = td_api::make_object<td_api::passportElementErrorSourceSelfie>();
break;
}
default:
@ -738,12 +738,12 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
continue;
}
errors.push_back(td_api::make_object<td_api::passportDataError>(get_passport_data_type_object(type), message,
std::move(source)));
errors.push_back(td_api::make_object<td_api::passportElementError>(get_passport_element_type_object(type),
message, std::move(source)));
}
promise_.set_value(make_tl_object<td_api::passportAuthorizationForm>(
authorization_form_id_, get_passport_data_types_object(types), std::move(values), std::move(errors),
authorization_form_id_, get_passport_element_types_object(types), std::move(values), std::move(errors),
is_selfie_required, authorization_form_->privacy_policy_url_));
stop();
}
@ -759,12 +759,12 @@ void SecureManager::get_secure_value(std::string password, SecureValueType type,
return promise.set_error(r_secure_value.move_as_error());
}
auto *file_manager = G()->td().get_actor_unsafe()->file_manager_.get();
auto r_passport_data = get_passport_data_object(file_manager, r_secure_value.move_as_ok().value);
if (r_passport_data.is_error()) {
LOG(ERROR) << "Failed to get passport data object: " << r_passport_data.error();
auto r_passport_element = get_passport_element_object(file_manager, r_secure_value.move_as_ok().value);
if (r_passport_element.is_error()) {
LOG(ERROR) << "Failed to get passport element object: " << r_passport_element.error();
return promise.set_value(nullptr);
}
promise.set_value(r_passport_data.move_as_ok());
promise.set_value(r_passport_element.move_as_ok());
});
do_get_secure_value(std::move(password), type, std::move(new_promise));
}
@ -776,7 +776,7 @@ void SecureManager::do_get_secure_value(std::string password, SecureValueType ty
.release();
}
void SecureManager::get_all_secure_values(std::string password, Promise<TdApiAllSecureValues> promise) {
void SecureManager::get_all_secure_values(std::string password, Promise<TdApiSecureValues> promise) {
refcnt_++;
create_actor<GetAllSecureValues>("GetAllSecureValues", actor_shared(), std::move(password), std::move(promise))
.release();
@ -791,12 +791,12 @@ void SecureManager::set_secure_value(string password, SecureValue secure_value,
return promise.set_error(r_secure_value.move_as_error());
}
auto *file_manager = G()->td().get_actor_unsafe()->file_manager_.get();
auto r_passport_data = get_passport_data_object(file_manager, r_secure_value.move_as_ok().value);
if (r_passport_data.is_error()) {
LOG(ERROR) << "Failed to get passport data object: " << r_passport_data.error();
return promise.set_error(Status::Error(500, "Failed to get passport data object"));
auto r_passport_element = get_passport_element_object(file_manager, r_secure_value.move_as_ok().value);
if (r_passport_element.is_error()) {
LOG(ERROR) << "Failed to get passport element object: " << r_passport_element.error();
return promise.set_error(Status::Error(500, "Failed to get passport element object"));
}
promise.set_value(r_passport_data.move_as_ok());
promise.set_value(r_passport_element.move_as_ok());
});
set_secure_value_queries_[type] = create_actor<SetSecureValue>("SetSecureValue", actor_shared(), std::move(password),
std::move(secure_value), std::move(new_promise));
@ -820,7 +820,7 @@ void SecureManager::on_delete_secure_value(SecureValueType type, Promise<Unit> p
}
void SecureManager::set_secure_value_errors(Td *td, tl_object_ptr<telegram_api::InputUser> input_user,
vector<tl_object_ptr<td_api::inputPassportDataError>> errors,
vector<tl_object_ptr<td_api::inputPassportElementError>> errors,
Promise<Unit> promise) {
CHECK(td != nullptr);
CHECK(input_user != nullptr);
@ -841,8 +841,8 @@ void SecureManager::set_secure_value_errors(Td *td, tl_object_ptr<telegram_api::
auto type = get_input_secure_value_type(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_);
case td_api::inputPassportElementErrorSourceDataField::ID: {
auto source = td_api::move_object_as<td_api::inputPassportElementErrorSourceDataField>(error->source_);
if (!clean_input_string(source->field_name_)) {
return promise.set_error(Status::Error(400, "Field name must be encoded in UTF-8"));
}
@ -851,32 +851,32 @@ void SecureManager::set_secure_value_errors(Td *td, tl_object_ptr<telegram_api::
std::move(type), BufferSlice(source->data_hash_), source->field_name_, error->message_));
break;
}
case td_api::inputPassportDataErrorSourceFrontSide::ID: {
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceFrontSide>(error->source_);
case td_api::inputPassportElementErrorSourceFrontSide::ID: {
auto source = td_api::move_object_as<td_api::inputPassportElementErrorSourceFrontSide>(error->source_);
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorFrontSide>(
std::move(type), BufferSlice(source->file_hash_), error->message_));
break;
}
case td_api::inputPassportDataErrorSourceReverseSide::ID: {
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceReverseSide>(error->source_);
case td_api::inputPassportElementErrorSourceReverseSide::ID: {
auto source = td_api::move_object_as<td_api::inputPassportElementErrorSourceReverseSide>(error->source_);
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorReverseSide>(
std::move(type), BufferSlice(source->file_hash_), error->message_));
break;
}
case td_api::inputPassportDataErrorSourceSelfie::ID: {
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceSelfie>(error->source_);
case td_api::inputPassportElementErrorSourceSelfie::ID: {
auto source = td_api::move_object_as<td_api::inputPassportElementErrorSourceSelfie>(error->source_);
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorSelfie>(
std::move(type), BufferSlice(source->file_hash_), error->message_));
break;
}
case td_api::inputPassportDataErrorSourceFile::ID: {
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceFile>(error->source_);
case td_api::inputPassportElementErrorSourceFile::ID: {
auto source = td_api::move_object_as<td_api::inputPassportElementErrorSourceFile>(error->source_);
input_errors.push_back(make_tl_object<telegram_api::secureValueErrorFile>(
std::move(type), BufferSlice(source->file_hash_), error->message_));
break;
}
case td_api::inputPassportDataErrorSourceFiles::ID: {
auto source = td_api::move_object_as<td_api::inputPassportDataErrorSourceFiles>(error->source_);
case td_api::inputPassportElementErrorSourceFiles::ID: {
auto source = td_api::move_object_as<td_api::inputPassportElementErrorSourceFiles>(error->source_);
if (source->file_hashes_.empty()) {
return promise.set_error(Status::Error(400, "Error hashes must be non-empty"));
}

View File

@ -26,8 +26,8 @@ namespace td {
class Td;
using TdApiSecureValue = td_api::object_ptr<td_api::PassportData>;
using TdApiAllSecureValues = td_api::object_ptr<td_api::allPassportData>;
using TdApiSecureValue = td_api::object_ptr<td_api::PassportElement>;
using TdApiSecureValues = td_api::object_ptr<td_api::passportElements>;
using TdApiAuthorizationForm = td_api::object_ptr<td_api::passportAuthorizationForm>;
class SecureManager : public NetQueryCallback {
@ -35,11 +35,11 @@ class SecureManager : public NetQueryCallback {
explicit SecureManager(ActorShared<> parent);
void get_secure_value(std::string password, SecureValueType type, Promise<TdApiSecureValue> promise);
void get_all_secure_values(std::string password, Promise<TdApiAllSecureValues> promise);
void get_all_secure_values(std::string password, Promise<TdApiSecureValues> promise);
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::inputPassportDataError>> errors, Promise<Unit> promise);
vector<tl_object_ptr<td_api::inputPassportElementError>> 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);

View File

@ -101,34 +101,34 @@ SecureValueType get_secure_value_type(const tl_object_ptr<telegram_api::SecureVa
}
}
SecureValueType get_secure_value_type_td_api(const tl_object_ptr<td_api::PassportDataType> &passport_data_type) {
CHECK(passport_data_type != nullptr);
switch (passport_data_type->get_id()) {
case td_api::passportDataTypePersonalDetails::ID:
SecureValueType get_secure_value_type_td_api(const tl_object_ptr<td_api::PassportElementType> &passport_element_type) {
CHECK(passport_element_type != nullptr);
switch (passport_element_type->get_id()) {
case td_api::passportElementTypePersonalDetails::ID:
return SecureValueType::PersonalDetails;
case td_api::passportDataTypePassport::ID:
case td_api::passportElementTypePassport::ID:
return SecureValueType::Passport;
case td_api::passportDataTypeDriverLicense::ID:
case td_api::passportElementTypeDriverLicense::ID:
return SecureValueType::DriverLicense;
case td_api::passportDataTypeIdentityCard::ID:
case td_api::passportElementTypeIdentityCard::ID:
return SecureValueType::IdentityCard;
case td_api::passportDataTypeInternalPassport::ID:
case td_api::passportElementTypeInternalPassport::ID:
return SecureValueType::InternalPassport;
case td_api::passportDataTypeAddress::ID:
case td_api::passportElementTypeAddress::ID:
return SecureValueType::Address;
case td_api::passportDataTypeUtilityBill::ID:
case td_api::passportElementTypeUtilityBill::ID:
return SecureValueType::UtilityBill;
case td_api::passportDataTypeBankStatement::ID:
case td_api::passportElementTypeBankStatement::ID:
return SecureValueType::BankStatement;
case td_api::passportDataTypeRentalAgreement::ID:
case td_api::passportElementTypeRentalAgreement::ID:
return SecureValueType::RentalAgreement;
case td_api::passportDataTypePassportRegistration::ID:
case td_api::passportElementTypePassportRegistration::ID:
return SecureValueType::PassportRegistration;
case td_api::passportDataTypeTemporaryRegistration::ID:
case td_api::passportElementTypeTemporaryRegistration::ID:
return SecureValueType::TemporaryRegistration;
case td_api::passportDataTypePhoneNumber::ID:
case td_api::passportElementTypePhoneNumber::ID:
return SecureValueType::PhoneNumber;
case td_api::passportDataTypeEmailAddress::ID:
case td_api::passportElementTypeEmailAddress::ID:
return SecureValueType::EmailAddress;
default:
UNREACHABLE();
@ -141,7 +141,7 @@ static vector<SecureValueType> unique_types(vector<SecureValueType> types) {
for (size_t i = 0; i < size; i++) {
for (size_t j = 0; j < i; j++) {
if (types[i] == types[j]) {
LOG(ERROR) << "Have duplicate Passport Data type " << types[i] << " at positions " << i << " and " << j;
LOG(ERROR) << "Have duplicate passport element type " << types[i] << " at positions " << i << " and " << j;
types[i--] = types[--size];
break;
}
@ -157,38 +157,38 @@ vector<SecureValueType> get_secure_value_types(
}
vector<SecureValueType> get_secure_value_types_td_api(
const vector<tl_object_ptr<td_api::PassportDataType>> &secure_value_types) {
const vector<tl_object_ptr<td_api::PassportElementType>> &secure_value_types) {
return unique_types(transform(secure_value_types, get_secure_value_type_td_api));
}
td_api::object_ptr<td_api::PassportDataType> get_passport_data_type_object(SecureValueType type) {
td_api::object_ptr<td_api::PassportElementType> get_passport_element_type_object(SecureValueType type) {
switch (type) {
case SecureValueType::PersonalDetails:
return td_api::make_object<td_api::passportDataTypePersonalDetails>();
return td_api::make_object<td_api::passportElementTypePersonalDetails>();
case SecureValueType::Passport:
return td_api::make_object<td_api::passportDataTypePassport>();
return td_api::make_object<td_api::passportElementTypePassport>();
case SecureValueType::DriverLicense:
return td_api::make_object<td_api::passportDataTypeDriverLicense>();
return td_api::make_object<td_api::passportElementTypeDriverLicense>();
case SecureValueType::IdentityCard:
return td_api::make_object<td_api::passportDataTypeIdentityCard>();
return td_api::make_object<td_api::passportElementTypeIdentityCard>();
case SecureValueType::InternalPassport:
return td_api::make_object<td_api::passportDataTypeInternalPassport>();
return td_api::make_object<td_api::passportElementTypeInternalPassport>();
case SecureValueType::Address:
return td_api::make_object<td_api::passportDataTypeAddress>();
return td_api::make_object<td_api::passportElementTypeAddress>();
case SecureValueType::UtilityBill:
return td_api::make_object<td_api::passportDataTypeUtilityBill>();
return td_api::make_object<td_api::passportElementTypeUtilityBill>();
case SecureValueType::BankStatement:
return td_api::make_object<td_api::passportDataTypeBankStatement>();
return td_api::make_object<td_api::passportElementTypeBankStatement>();
case SecureValueType::RentalAgreement:
return td_api::make_object<td_api::passportDataTypeRentalAgreement>();
return td_api::make_object<td_api::passportElementTypeRentalAgreement>();
case SecureValueType::PassportRegistration:
return td_api::make_object<td_api::passportDataTypePassportRegistration>();
return td_api::make_object<td_api::passportElementTypePassportRegistration>();
case SecureValueType::TemporaryRegistration:
return td_api::make_object<td_api::passportDataTypeTemporaryRegistration>();
return td_api::make_object<td_api::passportElementTypeTemporaryRegistration>();
case SecureValueType::PhoneNumber:
return td_api::make_object<td_api::passportDataTypePhoneNumber>();
return td_api::make_object<td_api::passportElementTypePhoneNumber>();
case SecureValueType::EmailAddress:
return td_api::make_object<td_api::passportDataTypeEmailAddress>();
return td_api::make_object<td_api::passportElementTypeEmailAddress>();
case SecureValueType::None:
default:
UNREACHABLE();
@ -231,9 +231,9 @@ td_api::object_ptr<telegram_api::SecureValueType> get_input_secure_value_type(Se
}
}
vector<td_api::object_ptr<td_api::PassportDataType>> get_passport_data_types_object(
vector<td_api::object_ptr<td_api::PassportElementType>> get_passport_element_types_object(
const vector<SecureValueType> &types) {
return transform(types, get_passport_data_type_object);
return transform(types, get_passport_element_type_object);
}
string get_secure_value_data_field_name(SecureValueType type, string field_name) {
@ -528,11 +528,11 @@ vector<EncryptedSecureValue> get_encrypted_secure_values(
return results;
}
td_api::object_ptr<td_api::encryptedPassportData> get_encrypted_passport_data_object(
td_api::object_ptr<td_api::encryptedPassportElement> get_encrypted_passport_element_object(
FileManager *file_manager, const EncryptedSecureValue &value) {
bool is_plain = value.data.hash.empty();
return td_api::make_object<td_api::encryptedPassportData>(
get_passport_data_type_object(value.type), is_plain ? string() : value.data.data,
return td_api::make_object<td_api::encryptedPassportElement>(
get_passport_element_type_object(value.type), is_plain ? string() : value.data.data,
value.front_side.file.file_id.is_valid() ? get_dated_file_object(file_manager, value.front_side) : nullptr,
value.reverse_side.file.file_id.is_valid() ? get_dated_file_object(file_manager, value.reverse_side) : nullptr,
value.selfie.file.file_id.is_valid() ? get_dated_file_object(file_manager, value.selfie) : nullptr,
@ -581,10 +581,10 @@ telegram_api::object_ptr<telegram_api::inputSecureValue> get_input_secure_value_
get_input_secure_files_object(file_manager, value.files, input_files), std::move(plain_data));
}
vector<td_api::object_ptr<td_api::encryptedPassportData>> get_encrypted_passport_data_object(
vector<td_api::object_ptr<td_api::encryptedPassportElement>> get_encrypted_passport_element_object(
FileManager *file_manager, const vector<EncryptedSecureValue> &values) {
return transform(values, [file_manager](const EncryptedSecureValue &value) {
return get_encrypted_passport_data_object(file_manager, value);
return get_encrypted_passport_element_object(file_manager, value);
});
}
@ -907,89 +907,89 @@ static Status check_email_address(string &email_address) {
}
Result<SecureValue> get_secure_value(FileManager *file_manager,
td_api::object_ptr<td_api::InputPassportData> &&input_passport_data) {
if (input_passport_data == nullptr) {
return Status::Error(400, "InputPassportData must not be empty");
td_api::object_ptr<td_api::InputPassportElement> &&input_passport_element) {
if (input_passport_element == nullptr) {
return Status::Error(400, "InputPassportElement must not be empty");
}
SecureValue res;
switch (input_passport_data->get_id()) {
case td_api::inputPassportDataPersonalDetails::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataPersonalDetails>(input_passport_data);
switch (input_passport_element->get_id()) {
case td_api::inputPassportElementPersonalDetails::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementPersonalDetails>(input_passport_element);
res.type = SecureValueType::PersonalDetails;
TRY_RESULT(personal_details, get_personal_details(std::move(input->personal_details_)));
res.data = std::move(personal_details);
break;
}
case td_api::inputPassportDataPassport::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataPassport>(input_passport_data);
case td_api::inputPassportElementPassport::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementPassport>(input_passport_element);
return get_identity_document(SecureValueType::Passport, file_manager, std::move(input->passport_), false);
}
case td_api::inputPassportDataDriverLicense::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataDriverLicense>(input_passport_data);
case td_api::inputPassportElementDriverLicense::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementDriverLicense>(input_passport_element);
return get_identity_document(SecureValueType::DriverLicense, file_manager, std::move(input->driver_license_),
true);
}
case td_api::inputPassportDataIdentityCard::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataIdentityCard>(input_passport_data);
case td_api::inputPassportElementIdentityCard::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementIdentityCard>(input_passport_element);
return get_identity_document(SecureValueType::IdentityCard, file_manager, std::move(input->identity_card_), true);
}
case td_api::inputPassportDataInternalPassport::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataInternalPassport>(input_passport_data);
case td_api::inputPassportElementInternalPassport::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementInternalPassport>(input_passport_element);
return get_identity_document(SecureValueType::InternalPassport, file_manager,
std::move(input->internal_passport_), false);
}
case td_api::inputPassportDataAddress::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataAddress>(input_passport_data);
case td_api::inputPassportElementAddress::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementAddress>(input_passport_element);
res.type = SecureValueType::Address;
TRY_RESULT(address, get_address(std::move(input->address_)));
res.data = address_to_json(address);
break;
}
case td_api::inputPassportDataUtilityBill::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataUtilityBill>(input_passport_data);
case td_api::inputPassportElementUtilityBill::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementUtilityBill>(input_passport_element);
res.type = SecureValueType::UtilityBill;
TRY_RESULT(files, get_secure_files(file_manager, std::move(input->files_)));
res.files = std::move(files);
break;
}
case td_api::inputPassportDataBankStatement::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataBankStatement>(input_passport_data);
case td_api::inputPassportElementBankStatement::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementBankStatement>(input_passport_element);
res.type = SecureValueType::BankStatement;
TRY_RESULT(files, get_secure_files(file_manager, std::move(input->files_)));
res.files = std::move(files);
break;
}
case td_api::inputPassportDataRentalAgreement::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataRentalAgreement>(input_passport_data);
case td_api::inputPassportElementRentalAgreement::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementRentalAgreement>(input_passport_element);
res.type = SecureValueType::RentalAgreement;
TRY_RESULT(files, get_secure_files(file_manager, std::move(input->files_)));
res.files = std::move(files);
break;
}
case td_api::inputPassportDataPassportRegistration::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataPassportRegistration>(input_passport_data);
case td_api::inputPassportElementPassportRegistration::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementPassportRegistration>(input_passport_element);
res.type = SecureValueType::PassportRegistration;
TRY_RESULT(files, get_secure_files(file_manager, std::move(input->files_)));
res.files = std::move(files);
break;
}
case td_api::inputPassportDataTemporaryRegistration::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataTemporaryRegistration>(input_passport_data);
case td_api::inputPassportElementTemporaryRegistration::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementTemporaryRegistration>(input_passport_element);
res.type = SecureValueType::TemporaryRegistration;
TRY_RESULT(files, get_secure_files(file_manager, std::move(input->files_)));
res.files = std::move(files);
break;
}
case td_api::inputPassportDataPhoneNumber::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataPhoneNumber>(input_passport_data);
case td_api::inputPassportElementPhoneNumber::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementPhoneNumber>(input_passport_element);
res.type = SecureValueType::PhoneNumber;
TRY_STATUS(check_phone_number(input->phone_number_));
res.data = std::move(input->phone_number_);
break;
}
case td_api::inputPassportDataEmailAddress::ID: {
auto input = td_api::move_object_as<td_api::inputPassportDataEmailAddress>(input_passport_data);
case td_api::inputPassportElementEmailAddress::ID: {
auto input = td_api::move_object_as<td_api::inputPassportElementEmailAddress>(input_passport_element);
res.type = SecureValueType::EmailAddress;
TRY_STATUS(check_email_address(input->email_address_));
res.data = std::move(input->email_address_);
@ -1001,32 +1001,32 @@ Result<SecureValue> get_secure_value(FileManager *file_manager,
return res;
}
Result<td_api::object_ptr<td_api::PassportData>> get_passport_data_object(FileManager *file_manager,
Result<td_api::object_ptr<td_api::PassportElement>> get_passport_element_object(FileManager *file_manager,
const SecureValue &value) {
switch (value.type) {
case SecureValueType::PersonalDetails: {
TRY_RESULT(personal_details, get_personal_details_object(value.data));
return td_api::make_object<td_api::passportDataPersonalDetails>(std::move(personal_details));
return td_api::make_object<td_api::passportElementPersonalDetails>(std::move(personal_details));
}
case SecureValueType::Passport: {
TRY_RESULT(passport, get_identity_document_object(file_manager, value));
return td_api::make_object<td_api::passportDataPassport>(std::move(passport));
return td_api::make_object<td_api::passportElementPassport>(std::move(passport));
}
case SecureValueType::DriverLicense: {
TRY_RESULT(driver_license, get_identity_document_object(file_manager, value));
return td_api::make_object<td_api::passportDataDriverLicense>(std::move(driver_license));
return td_api::make_object<td_api::passportElementDriverLicense>(std::move(driver_license));
}
case SecureValueType::IdentityCard: {
TRY_RESULT(identity_card, get_identity_document_object(file_manager, value));
return td_api::make_object<td_api::passportDataIdentityCard>(std::move(identity_card));
return td_api::make_object<td_api::passportElementIdentityCard>(std::move(identity_card));
}
case SecureValueType::InternalPassport: {
TRY_RESULT(internal_passport, get_identity_document_object(file_manager, value));
return td_api::make_object<td_api::passportDataInternalPassport>(std::move(internal_passport));
return td_api::make_object<td_api::passportElementInternalPassport>(std::move(internal_passport));
}
case SecureValueType::Address: {
TRY_RESULT(address, address_from_json(value.data));
return td_api::make_object<td_api::passportDataAddress>(get_address_object(address));
return td_api::make_object<td_api::passportElementAddress>(get_address_object(address));
}
case SecureValueType::UtilityBill:
case SecureValueType::BankStatement:
@ -1036,27 +1036,27 @@ Result<td_api::object_ptr<td_api::PassportData>> get_passport_data_object(FileMa
auto files = transform(
value.files, [file_manager](const DatedFile &file) { return get_dated_file_object(file_manager, file); });
if (value.type == SecureValueType::UtilityBill) {
return td_api::make_object<td_api::passportDataUtilityBill>(std::move(files));
return td_api::make_object<td_api::passportElementUtilityBill>(std::move(files));
}
if (value.type == SecureValueType::BankStatement) {
return td_api::make_object<td_api::passportDataBankStatement>(std::move(files));
return td_api::make_object<td_api::passportElementBankStatement>(std::move(files));
}
if (value.type == SecureValueType::RentalAgreement) {
return td_api::make_object<td_api::passportDataRentalAgreement>(std::move(files));
return td_api::make_object<td_api::passportElementRentalAgreement>(std::move(files));
}
if (value.type == SecureValueType::PassportRegistration) {
return td_api::make_object<td_api::passportDataPassportRegistration>(std::move(files));
return td_api::make_object<td_api::passportElementPassportRegistration>(std::move(files));
}
if (value.type == SecureValueType::TemporaryRegistration) {
return td_api::make_object<td_api::passportDataTemporaryRegistration>(std::move(files));
return td_api::make_object<td_api::passportElementTemporaryRegistration>(std::move(files));
}
UNREACHABLE();
break;
}
case SecureValueType::PhoneNumber:
return td_api::make_object<td_api::passportDataPhoneNumber>(value.data);
return td_api::make_object<td_api::passportElementPhoneNumber>(value.data);
case SecureValueType::EmailAddress:
return td_api::make_object<td_api::passportDataEmailAddress>(value.data);
return td_api::make_object<td_api::passportElementEmailAddress>(value.data);
case SecureValueType::None:
default:
UNREACHABLE();
@ -1064,21 +1064,21 @@ Result<td_api::object_ptr<td_api::PassportData>> get_passport_data_object(FileMa
}
}
td_api::object_ptr<td_api::allPassportData> get_all_passport_data_object(FileManager *file_manager,
td_api::object_ptr<td_api::passportElements> get_passport_elements_object(FileManager *file_manager,
const vector<SecureValue> &values) {
vector<td_api::object_ptr<td_api::PassportData>> result;
vector<td_api::object_ptr<td_api::PassportElement>> result;
result.reserve(values.size());
for (auto &value : values) {
auto r_obj = get_passport_data_object(file_manager, value);
auto r_obj = get_passport_element_object(file_manager, value);
if (r_obj.is_error()) {
LOG(ERROR) << "Can't get passport data object: " << r_obj.error();
LOG(ERROR) << "Can't get passport element object: " << r_obj.error();
continue;
}
result.push_back(r_obj.move_as_ok());
}
return td_api::make_object<td_api::allPassportData>(std::move(result));
return td_api::make_object<td_api::passportElements>(std::move(result));
}
static Result<std::pair<DatedFile, SecureFileCredentials>> decrypt_secure_file(
@ -1128,7 +1128,7 @@ Result<SecureValueWithCredentials> decrypt_secure_value(FileManager *file_manage
res_credentials.hash = encrypted_secure_value.hash;
switch (encrypted_secure_value.type) {
case SecureValueType::None:
return Status::Error("Receive invalid Telegram Passport data");
return Status::Error("Receive invalid Telegram Passport element");
case SecureValueType::EmailAddress:
case SecureValueType::PhoneNumber:
res.data = encrypted_secure_value.data.data;

View File

@ -44,17 +44,17 @@ enum class SecureValueType : int32 {
StringBuilder &operator<<(StringBuilder &string_builder, const SecureValueType &type);
SecureValueType get_secure_value_type(const tl_object_ptr<telegram_api::SecureValueType> &secure_value_type);
SecureValueType get_secure_value_type_td_api(const tl_object_ptr<td_api::PassportDataType> &passport_data_type);
SecureValueType get_secure_value_type_td_api(const tl_object_ptr<td_api::PassportElementType> &passport_element_type);
vector<SecureValueType> get_secure_value_types(
const vector<tl_object_ptr<telegram_api::SecureValueType>> &secure_value_types);
vector<SecureValueType> get_secure_value_types_td_api(
const vector<tl_object_ptr<td_api::PassportDataType>> &secure_value_types);
const vector<tl_object_ptr<td_api::PassportElementType>> &secure_value_types);
td_api::object_ptr<td_api::PassportDataType> get_passport_data_type_object(SecureValueType type);
td_api::object_ptr<td_api::PassportElementType> get_passport_element_type_object(SecureValueType type);
td_api::object_ptr<telegram_api::SecureValueType> get_input_secure_value_type(SecureValueType type);
vector<td_api::object_ptr<td_api::PassportDataType>> get_passport_data_types_object(
vector<td_api::object_ptr<td_api::PassportElementType>> get_passport_element_types_object(
const vector<SecureValueType> &types);
string get_secure_value_data_field_name(SecureValueType type, string field_name);
@ -125,13 +125,13 @@ EncryptedSecureValue get_encrypted_secure_value(FileManager *file_manager,
vector<EncryptedSecureValue> get_encrypted_secure_values(
FileManager *file_manager, vector<tl_object_ptr<telegram_api::secureValue>> &&secure_values);
td_api::object_ptr<td_api::encryptedPassportData> get_encrypted_passport_data_object(FileManager *file_manager,
const EncryptedSecureValue &value);
td_api::object_ptr<td_api::encryptedPassportElement> get_encrypted_passport_element_object(
FileManager *file_manager, const EncryptedSecureValue &value);
telegram_api::object_ptr<telegram_api::inputSecureValue> get_input_secure_value_object(
FileManager *file_manager, const EncryptedSecureValue &value, vector<SecureInputFile> &input_files,
optional<SecureInputFile> &front_side, optional<SecureInputFile> &reverse_side, optional<SecureInputFile> &selfie);
vector<td_api::object_ptr<td_api::encryptedPassportData>> get_encrypted_passport_data_object(
vector<td_api::object_ptr<td_api::encryptedPassportElement>> get_encrypted_passport_element_object(
FileManager *file_manager, const vector<EncryptedSecureValue> &values);
struct EncryptedSecureCredentials {
@ -189,12 +189,12 @@ struct SecureValueWithCredentials {
};
Result<SecureValue> get_secure_value(FileManager *file_manager,
td_api::object_ptr<td_api::InputPassportData> &&input_passport_data);
td_api::object_ptr<td_api::InputPassportElement> &&input_passport_element);
Result<td_api::object_ptr<td_api::PassportData>> get_passport_data_object(FileManager *file_manager,
Result<td_api::object_ptr<td_api::PassportElement>> get_passport_element_object(FileManager *file_manager,
const SecureValue &value);
td_api::object_ptr<td_api::allPassportData> get_all_passport_data_object(FileManager *file_manager,
td_api::object_ptr<td_api::passportElements> get_passport_elements_object(FileManager *file_manager,
const vector<SecureValue> &values);
Result<SecureValueWithCredentials> decrypt_secure_value(FileManager *file_manager, const secure_storage::Secret &secret,

View File

@ -6304,7 +6304,7 @@ void Td::on_request(uint64 id, const td_api::deleteSavedCredentials &request) {
delete_saved_credentials(std::move(promise));
}
void Td::on_request(uint64 id, td_api::getPassportData &request) {
void Td::on_request(uint64 id, td_api::getPassportElement &request) {
CHECK_IS_USER();
CLEAN_INPUT_STRING(request.password_);
if (request.type_ == nullptr) {
@ -6315,7 +6315,7 @@ void Td::on_request(uint64 id, td_api::getPassportData &request) {
get_secure_value_type_td_api(request.type_), std::move(promise));
}
void Td::on_request(uint64 id, td_api::getAllPassportData &request) {
void Td::on_request(uint64 id, td_api::getAllPassportElements &request) {
CHECK_IS_USER();
CLEAN_INPUT_STRING(request.password_);
CREATE_REQUEST_PROMISE();
@ -6323,11 +6323,11 @@ void Td::on_request(uint64 id, td_api::getAllPassportData &request) {
std::move(promise));
}
void Td::on_request(uint64 id, td_api::setPassportData &request) {
void Td::on_request(uint64 id, td_api::setPassportElement &request) {
CHECK_IS_USER();
CLEAN_INPUT_STRING(request.password_);
CREATE_REQUEST_PROMISE();
auto r_secure_value = get_secure_value(file_manager_.get(), std::move(request.data_));
auto r_secure_value = get_secure_value(file_manager_.get(), std::move(request.element_));
if (r_secure_value.is_error()) {
return promise.set_error(r_secure_value.move_as_error());
}
@ -6335,7 +6335,7 @@ void Td::on_request(uint64 id, td_api::setPassportData &request) {
r_secure_value.move_as_ok(), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::deletePassportData &request) {
void Td::on_request(uint64 id, const td_api::deletePassportElement &request) {
CHECK_IS_USER();
if (request.type_ == nullptr) {
return send_error_raw(id, 400, "Type must not be empty");
@ -6345,7 +6345,7 @@ void Td::on_request(uint64 id, const td_api::deletePassportData &request) {
std::move(promise));
}
void Td::on_request(uint64 id, td_api::setPassportDataErrors &request) {
void Td::on_request(uint64 id, td_api::setPassportElementErrors &request) {
CHECK_IS_BOT();
UserId user_id(request.user_id_);
auto input_user = contacts_manager_->get_input_user(user_id);

View File

@ -789,15 +789,15 @@ class Td final : public NetQueryCallback {
void on_request(uint64 id, const td_api::deleteSavedCredentials &request);
void on_request(uint64 id, td_api::getPassportData &request);
void on_request(uint64 id, td_api::getPassportElement &request);
void on_request(uint64 id, td_api::getAllPassportData &request);
void on_request(uint64 id, td_api::getAllPassportElements &request);
void on_request(uint64 id, td_api::setPassportData &request);
void on_request(uint64 id, td_api::setPassportElement &request);
void on_request(uint64 id, const td_api::deletePassportData &request);
void on_request(uint64 id, const td_api::deletePassportElement &request);
void on_request(uint64 id, td_api::setPassportDataErrors &request);
void on_request(uint64 id, td_api::setPassportElementErrors &request);
void on_request(uint64 id, td_api::sendPhoneNumberVerificationCode &request);

View File

@ -1031,45 +1031,45 @@ class CliClient final : public Actor {
return nullptr;
}
static tl_object_ptr<td_api::PassportDataType> as_passport_data_type(Slice passport_data_type) {
if (passport_data_type == "address" || passport_data_type == "a") {
return make_tl_object<td_api::passportDataTypeAddress>();
static tl_object_ptr<td_api::PassportElementType> as_passport_element_type(Slice passport_element_type) {
if (passport_element_type == "address" || passport_element_type == "a") {
return make_tl_object<td_api::passportElementTypeAddress>();
}
if (passport_data_type == "email" || passport_data_type == "e") {
return make_tl_object<td_api::passportDataTypeEmailAddress>();
if (passport_element_type == "email" || passport_element_type == "e") {
return make_tl_object<td_api::passportElementTypeEmailAddress>();
}
if (passport_data_type == "phone" || passport_data_type == "p") {
return make_tl_object<td_api::passportDataTypePhoneNumber>();
if (passport_element_type == "phone" || passport_element_type == "p") {
return make_tl_object<td_api::passportElementTypePhoneNumber>();
}
if (passport_data_type == "pd") {
return make_tl_object<td_api::passportDataTypePersonalDetails>();
if (passport_element_type == "pd") {
return make_tl_object<td_api::passportElementTypePersonalDetails>();
}
if (passport_data_type == "dl") {
return make_tl_object<td_api::passportDataTypeDriverLicense>();
if (passport_element_type == "dl") {
return make_tl_object<td_api::passportElementTypeDriverLicense>();
}
if (passport_data_type == "ip") {
return make_tl_object<td_api::passportDataTypeInternalPassport>();
if (passport_element_type == "ip") {
return make_tl_object<td_api::passportElementTypeInternalPassport>();
}
if (passport_data_type == "ic") {
return make_tl_object<td_api::passportDataTypeIdentityCard>();
if (passport_element_type == "ic") {
return make_tl_object<td_api::passportElementTypeIdentityCard>();
}
if (passport_data_type == "ra") {
return make_tl_object<td_api::passportDataTypeRentalAgreement>();
if (passport_element_type == "ra") {
return make_tl_object<td_api::passportElementTypeRentalAgreement>();
}
if (passport_data_type == "pr") {
return make_tl_object<td_api::passportDataTypePassportRegistration>();
if (passport_element_type == "pr") {
return make_tl_object<td_api::passportElementTypePassportRegistration>();
}
if (passport_data_type == "tr") {
return make_tl_object<td_api::passportDataTypeTemporaryRegistration>();
if (passport_element_type == "tr") {
return make_tl_object<td_api::passportElementTypeTemporaryRegistration>();
}
return make_tl_object<td_api::passportDataTypePassport>();
return make_tl_object<td_api::passportElementTypePassport>();
}
static auto as_passport_data_types(Slice types, char delimiter = ',') {
return transform(full_split(types, delimiter), [](Slice str) { return as_passport_data_type(str); });
static auto as_passport_element_types(Slice types, char delimiter = ',') {
return transform(full_split(types, delimiter), [](Slice str) { return as_passport_element_type(str); });
}
static tl_object_ptr<td_api::InputPassportData> as_input_passport_data(string passport_data_type, string arg,
static tl_object_ptr<td_api::InputPassportElement> as_input_passport_element(string passport_element_type, string arg,
bool with_selfie) {
vector<td_api::object_ptr<td_api::InputFile>> input_files;
td_api::object_ptr<td_api::InputFile> selfie;
@ -1084,37 +1084,38 @@ class CliClient final : public Actor {
input_files.push_back(as_input_file(file));
}
}
if (passport_data_type == "address" || passport_data_type == "a") {
return make_tl_object<td_api::inputPassportDataAddress>(
if (passport_element_type == "address" || passport_element_type == "a") {
return make_tl_object<td_api::inputPassportElementAddress>(
make_tl_object<td_api::address>("US", "CA", "Los Angeles", "Washington", "", "90001"));
} else if (passport_data_type == "email" || passport_data_type == "e") {
return make_tl_object<td_api::inputPassportDataEmailAddress>(arg);
} else if (passport_data_type == "phone" || passport_data_type == "p") {
return make_tl_object<td_api::inputPassportDataPhoneNumber>(arg);
} else if (passport_data_type == "pd") {
return make_tl_object<td_api::inputPassportDataPersonalDetails>(make_tl_object<td_api::personalDetails>(
} else if (passport_element_type == "email" || passport_element_type == "e") {
return make_tl_object<td_api::inputPassportElementEmailAddress>(arg);
} else if (passport_element_type == "phone" || passport_element_type == "p") {
return make_tl_object<td_api::inputPassportElementPhoneNumber>(arg);
} else if (passport_element_type == "pd") {
return make_tl_object<td_api::inputPassportElementPersonalDetails>(make_tl_object<td_api::personalDetails>(
"Mike", "Towers", make_tl_object<td_api::date>(29, 2, 2000), "male", "US", "GB"));
} else if (passport_data_type == "driver_license" || passport_data_type == "dl") {
} else if (passport_element_type == "driver_license" || passport_element_type == "dl") {
if (input_files.size() == 2) {
return make_tl_object<td_api::inputPassportDataDriverLicense>(make_tl_object<td_api::inputIdentityDocument>(
return make_tl_object<td_api::inputPassportElementDriverLicense>(make_tl_object<td_api::inputIdentityDocument>(
"1234567890", make_tl_object<td_api::date>(1, 3, 2029), std::move(input_files[0]),
std::move(input_files[1]), std::move(selfie)));
}
} else if (passport_data_type == "identity_card" || passport_data_type == "ic") {
} else if (passport_element_type == "identity_card" || passport_element_type == "ic") {
if (input_files.size() == 2) {
return make_tl_object<td_api::inputPassportDataIdentityCard>(make_tl_object<td_api::inputIdentityDocument>(
return make_tl_object<td_api::inputPassportElementIdentityCard>(make_tl_object<td_api::inputIdentityDocument>(
"1234567890", nullptr, std::move(input_files[0]), std::move(input_files[1]), std::move(selfie)));
}
} else if (passport_data_type == "internal_passport" || passport_data_type == "ip") {
} else if (passport_element_type == "internal_passport" || passport_element_type == "ip") {
if (input_files.size() == 1) {
return make_tl_object<td_api::inputPassportDataInternalPassport>(make_tl_object<td_api::inputIdentityDocument>(
"1234567890", nullptr, std::move(input_files[0]), nullptr, std::move(selfie)));
return make_tl_object<td_api::inputPassportElementInternalPassport>(
make_tl_object<td_api::inputIdentityDocument>("1234567890", nullptr, std::move(input_files[0]), nullptr,
std::move(selfie)));
}
} else if (passport_data_type == "rental_aggrement" || passport_data_type == "ra") {
return make_tl_object<td_api::inputPassportDataRentalAgreement>(std::move(input_files));
} else if (passport_element_type == "rental_aggrement" || passport_element_type == "ra") {
return make_tl_object<td_api::inputPassportElementRentalAgreement>(std::move(input_files));
}
LOG(ERROR) << "Unsupported passport data type " << passport_data_type;
LOG(ERROR) << "Unsupported passport element type " << passport_element_type;
return nullptr;
}
@ -1272,7 +1273,7 @@ class CliClient final : public Actor {
std::tie(password, args) = split(args);
std::tie(id, types) = split(args);
send_request(make_tl_object<td_api::sendPassportAuthorizationForm>(to_integer<int32>(id),
as_passport_data_types(types), password));
as_passport_element_types(types), password));
} else if (op == "spnvc" || op == "SendPhoneNumberVerificationCode") {
send_request(make_tl_object<td_api::sendPhoneNumberVerificationCode>(args, false, false));
} else if (op == "cpnvc" || op == "CheckPhoneNumberVerificationCode") {
@ -1306,25 +1307,26 @@ class CliClient final : public Actor {
send_request(make_tl_object<td_api::getTemporaryPasswordState>());
} else if (op == "ctp" || op == "CreateTemporaryPassword") {
send_request(make_tl_object<td_api::createTemporaryPassword>(args, 60 * 6));
} else if (op == "gpd") {
} else if (op == "gpe") {
string password;
string passport_data_type;
std::tie(password, passport_data_type) = split(args);
send_request(make_tl_object<td_api::getPassportData>(as_passport_data_type(passport_data_type), password));
} else if (op == "gapd") {
string passport_element_type;
std::tie(password, passport_element_type) = split(args);
send_request(
make_tl_object<td_api::getPassportElement>(as_passport_element_type(passport_element_type), password));
} else if (op == "gape") {
string password = args;
send_request(make_tl_object<td_api::getAllPassportData>(password));
} else if (op == "spd" || op == "spds") {
send_request(make_tl_object<td_api::getAllPassportElements>(password));
} else if (op == "spe" || op == "spes") {
string password;
string passport_data_type;
string passport_element_type;
string arg;
std::tie(password, args) = split(args);
std::tie(passport_data_type, arg) = split(args);
send_request(make_tl_object<td_api::setPassportData>(
as_input_passport_data(passport_data_type, arg, op == "spds"), password));
} else if (op == "dpd") {
string passport_data_type = args;
send_request(make_tl_object<td_api::deletePassportData>(as_passport_data_type(passport_data_type)));
std::tie(passport_element_type, arg) = split(args);
send_request(make_tl_object<td_api::setPassportElement>(
as_input_passport_element(passport_element_type, arg, op == "spds"), password));
} else if (op == "dpe") {
string passport_element_type = args;
send_request(make_tl_object<td_api::deletePassportElement>(as_passport_element_type(passport_element_type)));
} else if (op == "pdu" || op == "processDcUpdate") {
string dc_id;
string ip_port;