fix: enable cipher key encryption feature for 2026.4.x clients and streamline key handling

This commit is contained in:
shuaiplus
2026-05-31 01:03:32 +08:00
parent 192071e4a7
commit fd9707c396
6 changed files with 76 additions and 24 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
import { decryptStr, decryptBw } from './crypto';
import { looksLikeCipherString } from './app-support';
import type { Cipher } from './types';
async function decryptCipherField(
@@ -22,7 +23,7 @@ async function decryptCipherField(
// Preserve the old raw fallback for fields that are genuinely unreadable.
}
}
return value;
return looksLikeCipherString(value) ? '' : value;
}
export async function decryptSingleCipher(
+4 -4
View File
@@ -1,5 +1,5 @@
import { base64ToBytes, decryptBw, decryptStr } from './crypto';
import { deriveSendKeyParts } from './app-support';
import { deriveSendKeyParts, looksLikeCipherString } from './app-support';
import type { Cipher, Folder, Send } from './types';
export interface DecryptVaultCoreArgs {
@@ -38,7 +38,7 @@ async function decryptField(
try {
return await decryptStr(value, enc, mac);
} catch {
return value;
return looksLikeCipherString(value) ? '' : value;
}
}
@@ -63,7 +63,7 @@ async function decryptCipherField(
// Preserve the old raw fallback for fields that are genuinely unreadable.
}
}
return value;
return looksLikeCipherString(value) ? '' : value;
}
async function decryptFieldWithSource(
@@ -88,7 +88,7 @@ async function decryptFieldWithSource(
// Keep plain fallback.
}
}
return { text: raw, source: 'plain' };
return { text: looksLikeCipherString(raw) ? '' : raw, source: 'plain' };
}
export async function decryptVaultCore(args: DecryptVaultCoreArgs): Promise<DecryptVaultCoreResult> {