You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I will get straight to the point.
I am not the most expierenced coder and I ran into a problem. I need to update my database during special events.
Multiple data strings are encrypted.
When I call them they get decrytped and displayed correctly and they stay encrypted in the database.
Now when I update them and add something to a string, it kinda lays plain on the database.
I already tried to manuelly set the _enc to false but then when I upload the updated data to the database it stays decrypted and the _enc stays falls even tho it should be uploaded with _enc : true but the program doesn't encrypted it for some reason.
Also doing $set I get an error saying "try it with $setField or something.
I now put it in the add section of the Update and it works so far yet it stays _enc:false
The text was updated successfully, but these errors were encountered:
If I don't put _enc to false I get this TypeError [ERR_INVALID_ARG_TYPE]: The "iv" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, or DataView. Received undefined at Decipheriv.createCipherWithIV (node:internal/crypto/cipher:134:29) at new Decipheriv (node:internal/crypto/cipher:289:3) at Object.createDecipheriv (node:crypto:149:10) at decryptAes256Ctr (F:\Banlogger\node_modules\mongoose-field-encryption\lib\mongoose-field-encryption.js:18:27) at decrypt (F:\Banlogger\node_modules\mongoose-field-encryption\lib\mongoose-field-encryption.js:64:12) at decryptFields (F:\Banlogger\node_modules\mongoose-field-encryption\lib\mongoose-field-encryption.js:167:26) at model.<anonymous> (F:\Banlogger\node_modules\mongoose-field-encryption\lib\mongoose-field-encryption.js:234:7) at Kareem.execPostSync (F:\Banlogger\node_modules\kareem\index.js:311:29) at model.syncWrapper [as $__init] (F:\Banlogger\node_modules\kareem\index.js:333:26) at Document.init (F:\Banlogger\node_modules\mongoose\lib\document.js:640:8) { code: 'ERR_INVALID_ARG_TYPE' }
And if I put it to _enc: false then it won't encrypt as it stats in the database that _enc is false, so the program kinda skips the encryption.
The error only happens when I add another data string to the already existing one.
It is hard to find out what the issue is without looking at your code. Note that this library comes with a lot of tests which might help you in using it correctly, see this test for findOneAndUpdate:
Hey, I will get straight to the point.
I am not the most expierenced coder and I ran into a problem. I need to update my database during special events.
Multiple data strings are encrypted.
When I call them they get decrytped and displayed correctly and they stay encrypted in the database.
Now when I update them and add something to a string, it kinda lays plain on the database.
I already tried to manuelly set the _enc to false but then when I upload the updated data to the database it stays decrypted and the _enc stays falls even tho it should be uploaded with _enc : true but the program doesn't encrypted it for some reason.
Also doing $set I get an error saying "try it with $setField or something.
I now put it in the add section of the Update and it works so far yet it stays _enc:false
The text was updated successfully, but these errors were encountered: