mirror of
https://github.com/chaos-zhu/easynode.git
synced 2026-10-07 13:18:34 +08:00
- core/api/api_result.dart: ApiFailure 包装非 2xx 响应,附带 statusCode
与 401/403 判定,便于跳登录。
- core/api/api_client.dart: dio 封装,固定 ${serverAddress}/api/v1 base,
token header + Set-Cookie 双向桥接,统一抛 ApiFailure。
- features/auth/auth_session.dart: 持有 token/deviceId/server/user。
- features/auth/login_controller.dart: 规范化地址 -> HTTP 风险确认 ->
获取公钥 -> RSA 加密密码 -> 调 /login -> 解析 token/deviceId;
通过 ApiClientFactory 注入便于测试,并提供 onLoginSuccess 钩子。
- 4 个 fake 模式单测覆盖 HTTP 风险、空用户名/密码、无效地址。
- 同步修订规范与计划: 不再生成自有 mobile deviceId,登录字段沿用
web 端 (loginName/ciphertext/jwtExpires/jwtExpireAt[/mfa2Token]),
使用服务端返回的 deviceId 以兼容 revoke-login API。