mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-06-16 21:03:58 +08:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user