SteamTools icon indicating copy to clipboard operation
SteamTools copied to clipboard

🐛[BUG] 本地令牌有时间较大误差

Open Rovniced opened this issue 1 year ago • 9 comments

🐛 Description

按照教程导入steam令牌,同时转换成通用totp令牌导入了其他验证器

📷 Steps to Reproduce

  1. 同时看几个验证码以及steam手机客户端显示的验证码

  2. 会发现steam++显示的验证码剩余时间慢了10s。(其他验证器和steam手机端显示的有1s误差)

  3. 同步系统时间后测试一样。

  4. 在steam++内导入其他通用令牌,倒计时显示和其他验证码相同

  5. 应该只有steam的令牌显示是慢了10s

  6. 导入了2个号的令牌测试,都是一样的有误差

📄 Log Information

🖼 Screenshots

image

Rovniced avatar Nov 14 '24 13:11 Rovniced

尝试刷新令牌,会重新同步时钟

rmbadmin avatar Nov 14 '24 13:11 rmbadmin

尝试刷新令牌,会重新同步时钟

点击刷新后也是一样,重启应用和删除重新添加也不行

Rovniced avatar Nov 14 '24 13:11 Rovniced

2025-10-16 14:23:04,现在试了下好和官方的app没有时间差了,3.0.0-rc.16

update1,似乎是 bitwarden 的问题,不是 steam++ 问题

eric-gitta-moore avatar Oct 16 '25 06:10 eric-gitta-moore

2025-10-16 14:23:04,现在试了下好和官方的app没有时间差了,3.0.0-rc.16

update1,似乎是 bitwarden 的问题,不是 steam++ 问题

我测试的结果依然是bw和 steam移动端 的倒计时一致,steam++的慢10s

手机和pc的系统时间是一致的

Rovniced avatar Oct 16 '25 07:10 Rovniced

Image

steam++ / steam app / bitwarden

Rovniced avatar Oct 16 '25 07:10 Rovniced

@Rovniced 那挺奇怪的。你那儿是怎么添加的。 我这个是,账号之前没有加过 steam 令牌,然后再 steam++ 里面点了「Steam App令牌共存导入」,其中第二步「确认Steam App令牌验证码」要求去 steam app 里面手动添加一个令牌再回到 steam++ 里面验证,第三步「完成」

Image

steam++ 导出来的 maFile json 里面显示 "uri": "otpauth://totp/Steam:我的steam账号?secret=我的密钥&issuer=Steam"

然后 bitwarden 填写的是 steam://我的密钥

eric-gitta-moore avatar Oct 16 '25 08:10 eric-gitta-moore

然后 bitwarden 填写的是 steam://我的密钥

我是root权限提取的app私有数据,然后导入到steam++和bw内的

导出来的 maFile json 里面的 uri是空字段

Rovniced avatar Oct 16 '25 08:10 Rovniced

参照的 https://github.com/BeyondDimension/SteamTools/issues/2598 这个里面的xp模块提供数据

Rovniced avatar Oct 16 '25 08:10 Rovniced

@rmbadmin 我试了下,只要不是通过 steam++ 中「steam 登录」方式导入的,就会有这个问题

我把我这里通过 「steam App 令牌共存 导入」的令牌导出 maFile 之后,再通过 「Steam 令牌导入」或者「maFile 导入」,就可以复现这个问题了

就是只有这俩可以,其他方式都会有时间差 Image

「steam 登录」方式里面会从 steam api 拿服务器时间戳,其他导入方式似乎没有同步 steam 时间

具体来说,「steam 登录」在这里会同步 steam 服务器时间, https://github.com/BeyondDimension/SteamTools/blob/ece1768b2a9388aeef3474421fe16a7ebcf6880b/src/BD.WTTS.Client.Plugins.Authenticator/UI/ViewModels/JoinSteamAuthenticatorPageViewModel.cs#L348-L353

「手动导入文件」最后写入 db 的时候没有刷新 ServerTimeDiff 时间 https://github.com/BeyondDimension/SteamTools/blob/ece1768b2a9388aeef3474421fe16a7ebcf6880b/src/BD.WTTS.Client.Plugins.Authenticator/UI/ViewModels/AuthenticatorImportPageViewModel.cs#L68-L112

但是每次算的时候应该都去同步了一下 steam 时间 https://github.com/BeyondDimension/WinAuth/blob/de5b795ccf62fdab77c2e0b8fc3737e69efde8eb/src/WinAuth/WinAuth/SteamAuthenticator.cs#L934-L941

    protected override string CalculateCode(bool resyncTime = false, long interval = -1)
    {
        // sync time if required
        if (resyncTime || ServerTimeDiff == 0) // 手动导入的密钥 这里 ServerTimeDiff 一定是 0
            if (interval > 0)
                ServerTimeDiff = (interval * Period * 1000L) - CurrentTime;
            else
                Task.Run(Sync);

推翻了🤣,应该是只有导入后第一个码可能会有问题,后续的验证码时间应该是同步的

Image

这个 bitwarden 不知道怎么莫名其妙又追上了

如果时间差一直同步不上,有可能是 steam api 那个接口一直没通 https://github.com/BeyondDimension/SteamClient/blob/0a3cbf6624e3191016f72e0e68ec1fa981445fa1/src/BD.SteamClient8.Primitives/Constants/SteamApiUrls.cs#L168

然后呢,请求失败了(被捕获后 _lastSyncError 记下时间,60 分钟内不再自动重试,详见 ref/WinAuth/src/WinAuth/WinAuth/SteamAuthenticator.cs:896-925)

eric-gitta-moore avatar Oct 16 '25 14:10 eric-gitta-moore