-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object returned by save or create is cyphered #23
Comments
Hi @eyp , You can use the decrypt method as provided by the encryption plugin - see below for an example:
where |
Thanks. I'm experiencing the same issue doing a find({my criteria}). |
@eyp - yes, you can loop through and decrypt the fields. We can also consider providing an option for the plugin that would automatically decrypt them - would this be something useful for you? |
Yes, I think it would be better to have an option. What I was looking for was something that made transparent the insertion of ciphered fields, but also the read from the database. So what I wanted only was to have some fields ciphered in the database, not outside it. |
The 'init' hook should decrypt your data, |
Just after doing MySchema.find({some criteria}) I need to decrypt the fields manually. |
Dear @eyp |
@eyp please try with latest release (2.1.1) 😁 |
It's strange, now I'm in 2.1.1 and I still have to decrypt manually, doing: |
It's true that your test is working fine, so it should be working in my case as well. I'll revise my code to figure out what's happening. |
So what's happening is that even if my version is 2.1.1 (updated with npm, of course), the file that is downloaded doesn't have the change you did for fixing this error (the line 207): schema.pre("init", function(_next, _data) { instead of schema.post("init", function(_next, _data) { |
Anyway, just realized you released 2.1.3 that has everything. So forget about it. |
If I have a field name marked as cyphered and I do:
new User(myUser).save().then((savedUser) => {
savedUser.name is cyphered
}
Shouldn't it be like when I do a find? Or I must do a find afterwardsto be able to use the object?
The text was updated successfully, but these errors were encountered: