refactor(storage): remove unused helpers and legacy aliases

clear()/hasItem() and the secureStorage/encryptData/decryptData/isEncrypted aliases had no callers. migratePlaintextKeys now reuses isObfuscated instead of duplicating the prefix literal.
This commit is contained in:
LTbinglingfeng
2026-06-13 02:04:45 +08:00
Unverified
parent 403c51c31b
commit 07cdc5a8c4
2 changed files with 1 additions and 22 deletions
+1 -17
View File
@@ -71,13 +71,6 @@ class ObfuscatedStorageService {
localStorage.removeItem(key);
}
/**
* 清空所有数据
*/
clear(): void {
localStorage.clear();
}
/**
* 迁移旧的明文缓存为加密格式
*/
@@ -87,7 +80,7 @@ class ObfuscatedStorageService {
if (!raw) return;
// 如果已经是加密格式,跳过
if (raw.startsWith('enc::v1::')) {
if (isObfuscated(raw)) {
return;
}
@@ -106,15 +99,6 @@ class ObfuscatedStorageService {
}
});
}
/**
* 检查键是否存在
*/
hasItem(key: string): boolean {
return localStorage.getItem(key) !== null;
}
}
export const obfuscatedStorage = new ObfuscatedStorageService();
// Backward-compatible alias (historically named "secureStorage").
export const secureStorage = obfuscatedStorage;
-5
View File
@@ -101,8 +101,3 @@ export function deobfuscateData(payload: string): string {
export function isObfuscated(value: string): boolean {
return value?.startsWith(ENC_PREFIX) || false;
}
// Backward-compatible aliases (this module was historically named "encryption").
export const encryptData = obfuscateData;
export const decryptData = deobfuscateData;
export const isEncrypted = isObfuscated;