mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(core): Do not save credential overwrites data into the database (#13170)
This commit is contained in:
committed by
GitHub
parent
dd6d30c3d4
commit
298a7b0038
@@ -30,6 +30,18 @@ export class Credentials<
|
||||
this.data = this.cipher.encrypt(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update parts of the credential data.
|
||||
* This decrypts the data, modifies it, and then re-encrypts the updated data back to a string.
|
||||
*/
|
||||
updateData(toUpdate: Partial<T>, toDelete: Array<keyof T> = []) {
|
||||
const updatedData: T = { ...this.getData(), ...toUpdate };
|
||||
for (const key of toDelete) {
|
||||
delete updatedData[key];
|
||||
}
|
||||
this.setData(updatedData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the decrypted credential object
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user