Skip to main content

refresh_credentials_on_disk

Function refresh_credentials_on_disk 

Source
pub async fn refresh_credentials_on_disk(
    http: &Client,
    account: &str,
    device_id: &str,
    protocol_identity: BackendProtocolIdentity,
    region_code: Option<&str>,
    attribution: UserAttribution,
) -> Result<RefreshCredentialsReport, FutuError>
Expand description

v1.4.34: 给 daemon-reload 升级用——用磁盘缓存的 (uid, tgtgt, device_sig, rand_key) 走一次 remember_login,成功则把新 tgtgt 写回 credentials 文件。

安全边界:不保留 plaintext 密码;本层返回完整 authority 结果,由 gateway 中央 runtime 负责原子发布,backend 不持有运行时状态。

失败场景

  • credentials 文件不存在 → Err(调用方应回退 “shutdown + restart”)
  • tgtgt 过期(服务端拒)→ Err(同上)
  • 服务端返 code=20(重新 SMS 验证)→ Err(daemon 运行中不可能交互 SMS)