Replies: 4 comments 5 replies
-
|
check it out example - https://github.com/ujjwalguptaofficial/jsstore-encrypt/tree/main/examples/typescript particularly, check also check this file which |
Beta Was this translation helpful? Give feedback.
-
|
Okey, thanks for your update. I saw last weeks changes on the plugin and it was already better understandable. Also to speed it a bit up i would suggest you check the fields that needs to be encrypt only once at "init_db" like: if (request.name == 'init_db') {
for (const table of query.tables) {
if (typeof table.encrypt === "string") { table.encrypt = [table.encrypt]; }
if (Array.isArray(table.encrypt)) {
for (const [key, column] of Object.entries(table.columns)) {
if (column.encrypt === true) {
table.encrypt.push(key);
}
}
// when there are no fields to be encrypted, then disable the encryption option.
if (table.encrypt.length===1) table.encrypt = false;
} else {
table.encrypt = false;
}
}
}in the update/insert section you dan you only need to check of table.encrypt is not false and do a for 1 to length loop to check the fields that need to encrypted. ps, table.encrypt[0] is the key. good luck. BTW a little nickpicking please consider renaming the encryptValue into encryptValues and the parameter into values because you try to change more then one value. |
Beta Was this translation helpful? Give feedback.
-
|
@nielsnl68 have updated code with support for update, where & others cases. I have also updated readme & examples with latest changes. I hope this gives better context now. Let me know if you have any suggestion. I will also write article but will take some time, my focus will be still on making examples & readme better that everyone should be able to understand. |
Beta Was this translation helpful? Give feedback.
-
|
thanks, good work man. I have on issue to tackel for you. But i will create an other post for that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
i'm trying out the encrypt middleware and im strucling to understand what should be done inside the
encryptDataand thedecryptData. Can you show some simple code that would could be inside those functions?thanks
Beta Was this translation helpful? Give feedback.
All reactions