tgoop.com/e1cf53485f904e2e84034d45149e717c/742
Create:
Last Update:
Last Update:
【紧急通知】
我们发现了一个导致 Telegram Watchdog 在新群成员尝试验证其加入群聊的请求时,报告「无效的 Telegram 登录信息」错误的问题。经过调查,我们确定问题源于 Telegram 平台,因此我们无法单方面解决。
作为临时解决方案,我们建议使用其他替代方法来验证新成员。对此问题给您带来的不便,我们深表歉意。同时,我们正在积极寻找与 Telegram 开发团队联系的途径,以解决此问题。
技术详情:问题似乎与 Telegram 的用户信息 HMAC 签名验证算法发生了潜在的未公开变更有关。我们使用 Python 实现了 HMAC 签名算法进行验证,发现 Python 代码生成的结果与我们内部计算结果一致,但与 Telegram 提供的签名不同,从而证明了此猜想。
import hmac
import hashlib
# Bot token and data
bot_token = "[REDACTED]"
data = {
"query_id": "[REDACTED]",
"user": '{"id":[REDACTED],"first_name":"[REDACTED]","last_name":"[REDACTED]","username":"[REDACTED]","language_code":"zh-hans","allows_write_to_pm":true,"photo_url":"[REDACTED]"}',
"auth_date": 1732146341,
"hash": "[REDACTED]"
}
# Generate the secret key
secret_key = hmac.new(bot_token.encode(), b"WebAppData", hashlib.sha256).digest()
# Create the data-check-string
sorted_keys = sorted(data.keys())
sorted_keys.remove("hash") # Exclude the hash key
check_string = "\n".join(f"{key}={data[key]}" for key in sorted_keys)
# Compute HMAC of the check_string using the secret_key
computed_hmac = hmac.new(secret_key, check_string.encode(), hashlib.sha256).hexdigest()
print(computed_hmac)
BY 布里吉斯
Share with your friend now:
tgoop.com/e1cf53485f904e2e84034d45149e717c/742