Add td_api::authenticationCodeTypeSmsWord and td_api::authenticationCodeTypeSmsPhrase.
This commit is contained in:
parent
5ffc05a3cf
commit
4706fb3081
@ -24,15 +24,23 @@ ok = Ok;
|
||||
|
||||
//@class AuthenticationCodeType @description Provides information about the method by which an authentication code is delivered to the user
|
||||
|
||||
//@description An authentication code is delivered via a private Telegram message, which can be viewed from another active session
|
||||
//@description A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session
|
||||
//@length Length of the code
|
||||
authenticationCodeTypeTelegramMessage length:int32 = AuthenticationCodeType;
|
||||
|
||||
//@description An authentication code is delivered via an SMS message to the specified phone number; applications may not receive this type of code
|
||||
//@description A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
//@length Length of the code
|
||||
authenticationCodeTypeSms length:int32 = AuthenticationCodeType;
|
||||
|
||||
//@description An authentication code is delivered via a phone call to the specified phone number
|
||||
//@description An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
//@first_letter The first letters of the word if known
|
||||
authenticationCodeTypeSmsWord first_letter:string = AuthenticationCodeType;
|
||||
|
||||
//@description An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
//@first_word The first word of the phrase if known
|
||||
authenticationCodeTypeSmsPhrase first_word:string = AuthenticationCodeType;
|
||||
|
||||
//@description A digit-only authentication code is delivered via a phone call to the specified phone number
|
||||
//@length Length of the code
|
||||
authenticationCodeTypeCall length:int32 = AuthenticationCodeType;
|
||||
|
||||
@ -45,17 +53,17 @@ authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType;
|
||||
//@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
|
||||
//@description A digit-only 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 An authentication code is delivered via Firebase Authentication to the official Android application
|
||||
//@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application
|
||||
//@nonce Nonce to pass to the SafetyNet Attestation API
|
||||
//@length Length of the code
|
||||
authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType;
|
||||
|
||||
//@description An authentication code is delivered via Firebase Authentication to the official iOS application
|
||||
//@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application
|
||||
//@receipt Receipt of successful application token validation to compare with receipt from push notification
|
||||
//@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds
|
||||
//@length Length of the code
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "td/utils/base64.h"
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/Time.h"
|
||||
#include "td/utils/utf8.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
@ -206,10 +207,18 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_sent_authentication_c
|
||||
}
|
||||
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Sms, code_type->length_, ""};
|
||||
}
|
||||
case telegram_api::auth_sentCodeTypeSmsWord::ID:
|
||||
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Sms, 0, ""};
|
||||
case telegram_api::auth_sentCodeTypeSmsPhrase::ID:
|
||||
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Sms, 0, ""};
|
||||
case telegram_api::auth_sentCodeTypeSmsWord::ID: {
|
||||
auto code_type = move_tl_object_as<telegram_api::auth_sentCodeTypeSmsWord>(sent_code_type_ptr);
|
||||
if (utf8_length(code_type->beginning_) > 1u) {
|
||||
LOG(ERROR) << "Receive \"" << code_type->beginning_ << "\" as word first letter";
|
||||
code_type->beginning_ = string();
|
||||
}
|
||||
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::SmsWord, 0, code_type->beginning_};
|
||||
}
|
||||
case telegram_api::auth_sentCodeTypeSmsPhrase::ID: {
|
||||
auto code_type = move_tl_object_as<telegram_api::auth_sentCodeTypeSmsPhrase>(sent_code_type_ptr);
|
||||
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::SmsPhrase, 0, code_type->beginning_};
|
||||
}
|
||||
case telegram_api::auth_sentCodeTypeEmailCode::ID:
|
||||
case telegram_api::auth_sentCodeTypeSetUpEmailRequired::ID:
|
||||
default:
|
||||
@ -243,6 +252,10 @@ td_api::object_ptr<td_api::AuthenticationCodeType> SendCodeHelper::get_authentic
|
||||
case AuthenticationCodeInfo::Type::FirebaseIos:
|
||||
return td_api::make_object<td_api::authenticationCodeTypeFirebaseIos>(
|
||||
authentication_code_info.pattern, authentication_code_info.push_timeout, authentication_code_info.length);
|
||||
case AuthenticationCodeInfo::Type::SmsWord:
|
||||
return td_api::make_object<td_api::authenticationCodeTypeSmsWord>(authentication_code_info.pattern);
|
||||
case AuthenticationCodeInfo::Type::SmsPhrase:
|
||||
return td_api::make_object<td_api::authenticationCodeTypeSmsPhrase>(authentication_code_info.pattern);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
|
@ -59,7 +59,19 @@ class SendCodeHelper {
|
||||
|
||||
private:
|
||||
struct AuthenticationCodeInfo {
|
||||
enum class Type : int32 { None, Message, Sms, Call, FlashCall, MissedCall, Fragment, FirebaseAndroid, FirebaseIos };
|
||||
enum class Type : int32 {
|
||||
None,
|
||||
Message,
|
||||
Sms,
|
||||
Call,
|
||||
FlashCall,
|
||||
MissedCall,
|
||||
Fragment,
|
||||
FirebaseAndroid,
|
||||
FirebaseIos,
|
||||
SmsWord,
|
||||
SmsPhrase
|
||||
};
|
||||
Type type = Type::None;
|
||||
int32 length = 0;
|
||||
int32 push_timeout = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user