Add authenticationCodeTypeFirebaseIos.
This commit is contained in:
parent
f0e4a4cdc8
commit
1d9f2d6de9
|
@ -50,11 +50,17 @@ authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = Authe
|
||||||
//@length Length of the code
|
//@length Length of the code
|
||||||
authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType;
|
authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType;
|
||||||
|
|
||||||
//@description An authentication code is delivered via Firebase Authentication
|
//@description An authentication code is delivered via Firebase Authentication to the official Android app
|
||||||
//@nonce Nonce to pass to the SafetyNet Attestation API
|
//@nonce Nonce to pass to the SafetyNet Attestation API
|
||||||
//@length Length of the code
|
//@length Length of the code
|
||||||
authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType;
|
authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType;
|
||||||
|
|
||||||
|
//@description An authentication code is delivered via Firebase Authentication to the official iOS app
|
||||||
|
//@receipt Receipt of successful applikation 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
|
||||||
|
authenticationCodeTypeFirebaseIos receipt:string push_timeout:int32 length:int32 = AuthenticationCodeType;
|
||||||
|
|
||||||
|
|
||||||
//@description Information about the authentication code that was sent
|
//@description Information about the authentication code that was sent
|
||||||
//@phone_number A phone number that is being authenticated
|
//@phone_number A phone number that is being authenticated
|
||||||
|
|
|
@ -164,6 +164,10 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_sent_authentication_c
|
||||||
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::FirebaseAndroid, code_type->length_,
|
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::FirebaseAndroid, code_type->length_,
|
||||||
code_type->nonce_.as_slice().str()};
|
code_type->nonce_.as_slice().str()};
|
||||||
}
|
}
|
||||||
|
if ((code_type->flags_ & telegram_api::auth_sentCodeTypeFirebaseSms::RECEIPT_MASK) != 0) {
|
||||||
|
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::FirebaseIos, code_type->length_,
|
||||||
|
std::move(code_type->receipt_), code_type->push_timeout_};
|
||||||
|
}
|
||||||
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Sms, code_type->length_, ""};
|
return AuthenticationCodeInfo{AuthenticationCodeInfo::Type::Sms, code_type->length_, ""};
|
||||||
}
|
}
|
||||||
case telegram_api::auth_sentCodeTypeEmailCode::ID:
|
case telegram_api::auth_sentCodeTypeEmailCode::ID:
|
||||||
|
@ -196,6 +200,9 @@ td_api::object_ptr<td_api::AuthenticationCodeType> SendCodeHelper::get_authentic
|
||||||
case AuthenticationCodeInfo::Type::FirebaseAndroid:
|
case AuthenticationCodeInfo::Type::FirebaseAndroid:
|
||||||
return td_api::make_object<td_api::authenticationCodeTypeFirebaseAndroid>(authentication_code_info.pattern,
|
return td_api::make_object<td_api::authenticationCodeTypeFirebaseAndroid>(authentication_code_info.pattern,
|
||||||
authentication_code_info.length);
|
authentication_code_info.length);
|
||||||
|
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);
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -57,14 +57,15 @@ class SendCodeHelper {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct AuthenticationCodeInfo {
|
struct AuthenticationCodeInfo {
|
||||||
enum class Type : int32 { None, Message, Sms, Call, FlashCall, MissedCall, Fragment, FirebaseAndroid };
|
enum class Type : int32 { None, Message, Sms, Call, FlashCall, MissedCall, Fragment, FirebaseAndroid, FirebaseIos };
|
||||||
Type type = Type::None;
|
Type type = Type::None;
|
||||||
int32 length = 0;
|
int32 length = 0;
|
||||||
|
int32 push_timeout = 0;
|
||||||
string pattern;
|
string pattern;
|
||||||
|
|
||||||
AuthenticationCodeInfo() = default;
|
AuthenticationCodeInfo() = default;
|
||||||
AuthenticationCodeInfo(Type type, int length, string pattern)
|
AuthenticationCodeInfo(Type type, int32 length, string pattern, int32 push_timeout = 0)
|
||||||
: type(type), length(length), pattern(std::move(pattern)) {
|
: type(type), length(length), push_timeout(push_timeout), pattern(std::move(pattern)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
|
|
|
@ -18,6 +18,7 @@ void SendCodeHelper::AuthenticationCodeInfo::store(StorerT &storer) const {
|
||||||
using td::store;
|
using td::store;
|
||||||
store(type, storer);
|
store(type, storer);
|
||||||
store(length, storer);
|
store(length, storer);
|
||||||
|
store(push_timeout, storer);
|
||||||
store(pattern, storer);
|
store(pattern, storer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ void SendCodeHelper::AuthenticationCodeInfo::parse(ParserT &parser) {
|
||||||
using td::parse;
|
using td::parse;
|
||||||
parse(type, parser);
|
parse(type, parser);
|
||||||
parse(length, parser);
|
parse(length, parser);
|
||||||
|
parse(push_timeout, parser);
|
||||||
parse(pattern, parser);
|
parse(pattern, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user