Add authenticationCodeTypeFirebaseAndroid.

This commit is contained in:
levlam 2023-01-19 14:46:33 +03:00
parent a14d749893
commit f0e4a4cdc8
3 changed files with 14 additions and 2 deletions

View File

@ -50,6 +50,11 @@ authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = Authe
//@length Length of the code
authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType;
//@description An authentication code is delivered via Firebase Authentication
//@nonce Nonce to pass to the SafetyNet Attestation API
//@length Length of the code
authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType;
//@description Information about the authentication code that was sent
//@phone_number A phone number that is being authenticated

View File

@ -160,7 +160,11 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_sent_authentication_c
}
case telegram_api::auth_sentCodeTypeFirebaseSms::ID: {
auto code_type = move_tl_object_as<telegram_api::auth_sentCodeTypeFirebaseSms>(sent_code_type_ptr);
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Sms, 0, ""};
if ((code_type->flags_ & telegram_api::auth_sentCodeTypeFirebaseSms::NONCE_MASK) != 0) {
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::FirebaseAndroid, code_type->length_,
code_type->nonce_.as_slice().str()};
}
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Sms, code_type->length_, ""};
}
case telegram_api::auth_sentCodeTypeEmailCode::ID:
case telegram_api::auth_sentCodeTypeSetUpEmailRequired::ID:
@ -189,6 +193,9 @@ td_api::object_ptr<td_api::AuthenticationCodeType> SendCodeHelper::get_authentic
case AuthenticationCodeInfo::Type::Fragment:
return td_api::make_object<td_api::authenticationCodeTypeFragment>(authentication_code_info.pattern,
authentication_code_info.length);
case AuthenticationCodeInfo::Type::FirebaseAndroid:
return td_api::make_object<td_api::authenticationCodeTypeFirebaseAndroid>(authentication_code_info.pattern,
authentication_code_info.length);
default:
UNREACHABLE();
return nullptr;

View File

@ -57,7 +57,7 @@ class SendCodeHelper {
private:
struct AuthenticationCodeInfo {
enum class Type : int32 { None, Message, Sms, Call, FlashCall, MissedCall, Fragment };
enum class Type : int32 { None, Message, Sms, Call, FlashCall, MissedCall, Fragment, FirebaseAndroid };
Type type = Type::None;
int32 length = 0;
string pattern;