Refactor rule engine to decrypt account names during evaluation
- Make rule evaluation functions async to support account name decryption - Add encryption key parameter to all rule evaluation functions - Decrypt account names before rule matching and normalize to lowercase - Update all call sites to await async rule evaluation and pass encryption key - Simplify note decryption logic in edit transaction dialog by moving key retrieval earlier
This commit is contained in:
parent
323b7386c1
commit
952634603c
|
|
@ -62,7 +62,8 @@ async function decryptAccountName(
|
|||
key: CryptoKey,
|
||||
): Promise<string> {
|
||||
try {
|
||||
return await decrypt(account.name, key, account.name_iv);
|
||||
const decryptedAccountName = await decrypt(account.name, key, account.name_iv);
|
||||
return decryptedAccountName.trim();
|
||||
} catch (error) {
|
||||
console.error('Failed to decrypt account name:', account.id, error);
|
||||
return '';
|
||||
|
|
@ -87,7 +88,6 @@ export async function prepareTransactionData(
|
|||
const category = transaction.category_id
|
||||
? categories.find((c) => c.id === transaction.category_id)
|
||||
: null;
|
||||
|
||||
const accountName = account
|
||||
? await decryptAccountName(account, encryptionKey)
|
||||
: '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue