Skip to main content

Module trade_pwd

Module trade_pwd 

Source
Expand description

交易密码来源封装

优先级(对 LLM 透明,它只会调 futu_unlock_trade 工具,密码永不入 prompt):

  1. 账号级 OS keychain —— futucli set-trade-pwd --account <login-account>
  2. 环境变量 FUTU_TRADE_PWD(container / systemd EnvironmentFile 场景)
  3. legacy 全局 OS keychain —— v1.4.109 前的 trade-password 兜底读取
  4. 都没有 → 报错

MD5 在 server 端计算后再发网关。LLM 从来看不到明文 / MD5。

Functions§

get_trade_password_for_account
试着拿到交易密码明文。成功则返回 Ok(pwd);任何来源都没找到返回 Err
get_trade_password_md5_for_account
把密码 MD5 化再返回(unlock_trade RPC 要的格式)
md5_hex 🔒
non_empty_trimmed 🔒
read_keyring_password 🔒
trade_password_from_sources 🔒
trade_pwd_account_from 🔒