Add authenticationCodeTypeFragment.

This commit is contained in:
levlam 2022-11-25 18:14:20 +03:00
parent f7897dc2ba
commit 650e2367bc
3 changed files with 9 additions and 3 deletions

View File

@ -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;

View File

@ -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<telegram_api::auth_sentCodeTypeFragmentSms>(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<td_api::AuthenticationCodeType> SendCodeHelper::get_authentic
case AuthenticationCodeInfo::Type::MissedCall:
return td_api::make_object<td_api::authenticationCodeTypeMissedCall>(authentication_code_info.pattern,
authentication_code_info.length);
case AuthenticationCodeInfo::Type::Fragment:
return td_api::make_object<td_api::authenticationCodeTypeFragment>(authentication_code_info.pattern,
authentication_code_info.length);
default:
UNREACHABLE();
return nullptr;

View File

@ -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;