fix(mp): 存储层语义统一 + UTF-16 截断修复

- secureGet: 增加 TextEncoder/TextDecoder 替代 charCodeAt 避免 UTF-16 截断
- secureGet: _es_ 前缀键返回空时增加明文键 fallback(对齐 storageGet 语义)
- request.ts safeGet / auth.ts storageGet: 简化为直接委托 secureGet
This commit is contained in:
iven
2026-05-21 22:34:14 +08:00
parent ee7dd0d6e1
commit fd994edf3e
3 changed files with 13 additions and 21 deletions

View File

@@ -4,11 +4,9 @@ import * as authApi from '@/services/auth';
import { secureGet, secureSet, secureRemove } from '@/utils/secure-storage';
import { clearRequestCache, markLoggingOut, clearLoggingOut, setCachedPatientId } from '@/services/request';
// secureGet fallback: _es_ 加密键为空时尝试明文键(兼容 MCP 注入等场景)
// secureGet 已内置明文键 fallback,无需再手动 fallback
function storageGet(key: string): string {
const val = secureGet(key);
if (val) return val;
return Taro.getStorageSync(key) || '';
return secureGet(key);
}
import { resetAllStores } from './index';