Skip to main content

repull_auth_code

Function repull_auth_code 

Source
pub async fn repull_auth_code(
    http: &Client,
    attribution: UserAttribution,
    uid: u64,
    web_sig: &str,
    device_id: &str,
    broker_id: u32,
) -> Result<BrokerAuthCode>
Expand description

请求新的 broker auth_code,对齐 C++ RepullAuthCode.

§参数

  • http: 复用 bridge 创建的 reqwest::Client(含 webpki-roots TLS 配置)
  • attribution: 当前账户 user_attribution (决定 auth_domain)
  • uid: 当前账户 uid (== AuthResult.user_id)
  • web_sig: 持久化的 web_sig (来自 SavedCredentials.web_sig 或 AuthResult.web_sig)。空字符串 → 直接 Err(向后兼容旧凭据无此字段 的场景,调用方应跳过 repull、fallback 走 platform refresh)。
  • device_id: 设备 ID (16-hex)
  • broker_id: 目标 broker (1001 / 1007 / 1008 / 1009 / 1012 / 1017 / 1019)

§返回

成功: BrokerAuthCode { broker_id, auth_code, invalid_time } —— 与 parse_auth_code_list 解出的元素同结构, caller 可直接走 broker_auth HTTP + broker_tcp_login 流程。

失败: Err(FutuError::*). 见模块文档 fallback 策略.