Add FirebaseDeviceVerificationParameters.

This commit is contained in:
levlam 2024-06-27 19:16:43 +03:00
parent c77d6957c5
commit aa6c964692
2 changed files with 18 additions and 7 deletions

View File

@ -59,10 +59,9 @@ authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = Authe
authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType;
//@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application
//@use_play_integrity True, if Play Integrity API must be used for device verification. Otherwise, SafetyNet Attestation API must be used
//@nonce Nonce to pass to the Play Integrity API or the SafetyNet Attestation API
//@device_verification_parameters Parameters to be used for device verification
//@length Length of the code
authenticationCodeTypeFirebaseAndroid use_play_integrity:Bool nonce:bytes length:int32 = AuthenticationCodeType;
authenticationCodeTypeFirebaseAndroid device_verification_parameters:FirebaseDeviceVerificationParameters length:int32 = AuthenticationCodeType;
//@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
@ -173,6 +172,15 @@ authorizationStateClosing = AuthorizationState;
authorizationStateClosed = AuthorizationState;
//@class FirebaseDeviceVerificationParameters @description Describes parameters to be used for device verification
//@description Device verification must be performed with the SafetyNet Attestation API @nonce Nonce to pass to the SafetyNet Attestation API
firebaseDeviceVerificationParametersSafetyNet nonce:bytes = FirebaseDeviceVerificationParameters;
//@description Device verification must be performed with the Play Integrity API @nonce Base64url-encoded nonce to pass to the Play Integrity API
firebaseDeviceVerificationParametersPlayIntegrity nonce:string = FirebaseDeviceVerificationParameters;
//@description Represents the current state of 2-step verification
//@has_password True, if a 2-step verification password is set
//@password_hint Hint for the password; may be empty

View File

@ -279,11 +279,14 @@ td_api::object_ptr<td_api::AuthenticationCodeType> SendCodeHelper::get_authentic
return td_api::make_object<td_api::authenticationCodeTypeFragment>(authentication_code_info.pattern,
authentication_code_info.length);
case AuthenticationCodeInfo::Type::FirebaseAndroidSafetyNet:
return td_api::make_object<td_api::authenticationCodeTypeFirebaseAndroid>(false, authentication_code_info.pattern,
authentication_code_info.length);
return td_api::make_object<td_api::authenticationCodeTypeFirebaseAndroid>(
td_api::make_object<td_api::firebaseDeviceVerificationParametersSafetyNet>(authentication_code_info.pattern),
authentication_code_info.length);
case AuthenticationCodeInfo::Type::FirebaseAndroidPlayIntegrity:
return td_api::make_object<td_api::authenticationCodeTypeFirebaseAndroid>(true, authentication_code_info.pattern,
authentication_code_info.length);
return td_api::make_object<td_api::authenticationCodeTypeFirebaseAndroid>(
td_api::make_object<td_api::firebaseDeviceVerificationParametersPlayIntegrity>(
base64url_encode(authentication_code_info.pattern)),
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);