From 650e2367bc35625c38e66f27e5ee2094db5fa80b Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 25 Nov 2022 18:14:20 +0300 Subject: [PATCH] Add authenticationCodeTypeFragment. --- td/generate/scheme/td_api.tl | 3 +++ td/telegram/SendCodeHelper.cpp | 7 +++++-- td/telegram/SendCodeHelper.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index dbf650b6b..8644644d6 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -39,6 +39,9 @@ authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType; //@description An authentication code is delivered by an immediately canceled call to the specified phone number. The last digits of the phone number that calls are the code that must be entered manually by the user @phone_number_prefix Prefix of the phone number from which the call will be made @length Number of digits in the code, excluding the prefix authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = AuthenticationCodeType; +//@description An authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT @url URL to open to receive the code @length Length of the code +authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType; + //@description Information about the authentication code that was sent @phone_number A phone number that is being authenticated @type The way the code was sent to the user @next_type The way the next code will be sent to the user; may be null @timeout Timeout before the code can be re-sent, in seconds authenticationCodeInfo phone_number:string type:AuthenticationCodeType next_type:AuthenticationCodeType timeout:int32 = AuthenticationCodeInfo; diff --git a/td/telegram/SendCodeHelper.cpp b/td/telegram/SendCodeHelper.cpp index 020f6287f..1442b2008 100644 --- a/td/telegram/SendCodeHelper.cpp +++ b/td/telegram/SendCodeHelper.cpp @@ -121,7 +121,7 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_authentication_code_i case telegram_api::auth_codeTypeMissedCall::ID: return {AuthenticationCodeInfo::Type::MissedCall, 0, string()}; case telegram_api::auth_codeTypeFragmentSms::ID: - return {AuthenticationCodeInfo::Type::MissedCall, 0, string()}; + return {AuthenticationCodeInfo::Type::Fragment, 0, string()}; default: UNREACHABLE(); return AuthenticationCodeInfo(); @@ -155,7 +155,7 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_sent_authentication_c } case telegram_api::auth_sentCodeTypeFragmentSms::ID: { auto code_type = move_tl_object_as(sent_code_type_ptr); - return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::MissedCall, code_type->length_, + return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Fragment, code_type->length_, std::move(code_type->url_)}; } case telegram_api::auth_sentCodeTypeEmailCode::ID: @@ -182,6 +182,9 @@ td_api::object_ptr SendCodeHelper::get_authentic case AuthenticationCodeInfo::Type::MissedCall: return td_api::make_object(authentication_code_info.pattern, authentication_code_info.length); + case AuthenticationCodeInfo::Type::Fragment: + return td_api::make_object(authentication_code_info.pattern, + authentication_code_info.length); default: UNREACHABLE(); return nullptr; diff --git a/td/telegram/SendCodeHelper.h b/td/telegram/SendCodeHelper.h index 017e81454..5b8ebb94b 100644 --- a/td/telegram/SendCodeHelper.h +++ b/td/telegram/SendCodeHelper.h @@ -61,7 +61,7 @@ class SendCodeHelper { static constexpr int32 SENT_CODE_FLAG_HAS_TIMEOUT = 1 << 2; struct AuthenticationCodeInfo { - enum class Type : int32 { None, Message, Sms, Call, FlashCall, MissedCall }; + enum class Type : int32 { None, Message, Sms, Call, FlashCall, MissedCall, Fragment }; Type type = Type::None; int32 length = 0; string pattern;