Allow to request Firebase Authentication in official apps.
This commit is contained in:
parent
1d9f2d6de9
commit
f596ec7793
@ -50,12 +50,12 @@ 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 to the official Android app
|
//@description An authentication code is delivered via Firebase Authentication to the official Android application
|
||||||
//@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
|
//@description An authentication code is delivered via Firebase Authentication to the official iOS application
|
||||||
//@receipt Receipt of successful applikation token validation to compare with receipt from push notification
|
//@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
|
//@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
|
//@length Length of the code
|
||||||
@ -3128,13 +3128,23 @@ callProblemPixelatedVideo = CallProblem;
|
|||||||
call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call;
|
call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call;
|
||||||
|
|
||||||
|
|
||||||
|
//@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications
|
||||||
|
|
||||||
|
//@description Settings for Firebase Authentication in the official Android application
|
||||||
|
firebaseAuthenticationSettingsAndroid = FirebaseAuthenticationSettings;
|
||||||
|
|
||||||
|
//@description Settings for Firebase Authentication in the official iOS application @device_token Device token from Apple Push Notification service @is_app_sandbox True, if App Sandbox is enabled
|
||||||
|
firebaseAuthenticationSettingsIos device_token:string is_app_sandbox:Bool = FirebaseAuthenticationSettings;
|
||||||
|
|
||||||
|
|
||||||
//@description Contains settings for the authentication of the user's phone number
|
//@description Contains settings for the authentication of the user's phone number
|
||||||
//@allow_flash_call Pass true if the authentication code may be sent via a flash call to the specified phone number
|
//@allow_flash_call Pass true if the authentication code may be sent via a flash call to the specified phone number
|
||||||
//@allow_missed_call Pass true if the authentication code may be sent via a missed call to the specified phone number
|
//@allow_missed_call Pass true if the authentication code may be sent via a missed call to the specified phone number
|
||||||
//@is_current_phone_number Pass true if the authenticated phone number is used on the current device
|
//@is_current_phone_number Pass true if the authenticated phone number is used on the current device
|
||||||
//@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details
|
//@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details
|
||||||
|
//@firebase_authentication_settings For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication
|
||||||
//@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions
|
//@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions
|
||||||
phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool authentication_tokens:vector<string> = PhoneNumberAuthenticationSettings;
|
phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector<string> = PhoneNumberAuthenticationSettings;
|
||||||
|
|
||||||
|
|
||||||
//@description Represents a reaction applied to a message @type Type of the reaction @sender_id Identifier of the chat member, applied the reaction
|
//@description Represents a reaction applied to a message @type Type of the reaction @sender_id Identifier of the chat member, applied the reaction
|
||||||
|
@ -44,6 +44,8 @@ Result<telegram_api::auth_resendCode> SendCodeHelper::resend_code() const {
|
|||||||
telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_code_settings(const Settings &settings) {
|
telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_code_settings(const Settings &settings) {
|
||||||
int32 flags = 0;
|
int32 flags = 0;
|
||||||
vector<BufferSlice> logout_tokens;
|
vector<BufferSlice> logout_tokens;
|
||||||
|
string device_token;
|
||||||
|
bool is_app_sandbox = false;
|
||||||
if (settings != nullptr) {
|
if (settings != nullptr) {
|
||||||
if (settings->allow_flash_call_) {
|
if (settings->allow_flash_call_) {
|
||||||
flags |= telegram_api::codeSettings::ALLOW_FLASHCALL_MASK;
|
flags |= telegram_api::codeSettings::ALLOW_FLASHCALL_MASK;
|
||||||
@ -57,6 +59,16 @@ telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_c
|
|||||||
if (settings->allow_sms_retriever_api_) {
|
if (settings->allow_sms_retriever_api_) {
|
||||||
flags |= telegram_api::codeSettings::ALLOW_APP_HASH_MASK;
|
flags |= telegram_api::codeSettings::ALLOW_APP_HASH_MASK;
|
||||||
}
|
}
|
||||||
|
if (settings->firebase_authentication_settings_ != nullptr) {
|
||||||
|
flags |= telegram_api::codeSettings::ALLOW_FIREBASE_MASK;
|
||||||
|
if (settings->firebase_authentication_settings_->get_id() == td_api::firebaseAuthenticationSettingsIos::ID) {
|
||||||
|
flags |= telegram_api::codeSettings::TOKEN_MASK;
|
||||||
|
auto ios_settings = static_cast<const td_api::firebaseAuthenticationSettingsIos *>(
|
||||||
|
settings->firebase_authentication_settings_.get());
|
||||||
|
device_token = ios_settings->device_token_;
|
||||||
|
is_app_sandbox = ios_settings->is_app_sandbox_;
|
||||||
|
}
|
||||||
|
}
|
||||||
constexpr size_t MAX_LOGOUT_TOKENS = 20; // server-side limit
|
constexpr size_t MAX_LOGOUT_TOKENS = 20; // server-side limit
|
||||||
for (const auto &token : settings->authentication_tokens_) {
|
for (const auto &token : settings->authentication_tokens_) {
|
||||||
auto r_logout_token = base64url_decode(token);
|
auto r_logout_token = base64url_decode(token);
|
||||||
@ -73,7 +85,7 @@ telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_c
|
|||||||
}
|
}
|
||||||
return telegram_api::make_object<telegram_api::codeSettings>(flags, false /*ignored*/, false /*ignored*/,
|
return telegram_api::make_object<telegram_api::codeSettings>(flags, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
std::move(logout_tokens), string(), false);
|
std::move(logout_tokens), device_token, is_app_sandbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
telegram_api::auth_sendCode SendCodeHelper::send_code(string phone_number, const Settings &settings, int32 api_id,
|
telegram_api::auth_sendCode SendCodeHelper::send_code(string phone_number, const Settings &settings, int32 api_id,
|
||||||
|
@ -1796,7 +1796,7 @@ class CliClient final : public Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::phoneNumberAuthenticationSettings> as_phone_number_authentication_settings() const {
|
td_api::object_ptr<td_api::phoneNumberAuthenticationSettings> as_phone_number_authentication_settings() const {
|
||||||
return td_api::make_object<td_api::phoneNumberAuthenticationSettings>(false, true, false, false,
|
return td_api::make_object<td_api::phoneNumberAuthenticationSettings>(false, true, false, false, nullptr,
|
||||||
vector<string>(authentication_tokens_));
|
vector<string>(authentication_tokens_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user