mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Support for Firebase SMS
This commit is contained in:
parent
f86291117f
commit
bf7207fa7d
|
|
@ -1074,6 +1074,21 @@ namespace WTelegram
|
||||||
else if (sentCodeBase is Auth_SentCode sentCode)
|
else if (sentCodeBase is Auth_SentCode sentCode)
|
||||||
{
|
{
|
||||||
phone_code_hash = sentCode.phone_code_hash;
|
phone_code_hash = sentCode.phone_code_hash;
|
||||||
|
if (sentCode.type is Auth_SentCodeTypeFirebaseSms firebaseSms)
|
||||||
|
{
|
||||||
|
var token = await ConfigAsync("firebase:" + Convert.ToHexString(firebaseSms.nonce));
|
||||||
|
int index = token?.IndexOf(':') ?? -1;
|
||||||
|
if (!(index > 0 && token[..index] switch
|
||||||
|
{
|
||||||
|
"safety_net_token" => await this.Auth_RequestFirebaseSms(phone_number, phone_code_hash, safety_net_token: token[(index + 1)..]),
|
||||||
|
"ios_push_secret" => await this.Auth_RequestFirebaseSms(phone_number, phone_code_hash, ios_push_secret: token[(index + 1)..]),
|
||||||
|
_ => false
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash);
|
||||||
|
goto resent;
|
||||||
|
}
|
||||||
|
}
|
||||||
var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout);
|
var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout);
|
||||||
Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}");
|
Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}");
|
||||||
RaiseUpdate(sentCode);
|
RaiseUpdate(sentCode);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue