Edit Page

.decrypt()

Decrypt any auto-encrypted attributes in the records returned for this particular query.

query.decrypt()

Usage

#

This method doesn't accept any arguments.

Example

#

To retrieve user records with ssn decrypted:

await User.find({fullName: 'Finn Mertens'}).decrypt();
// =>
// [ { id: 4, fullName: 'Finn Mertens', ssn: '555-55-5555' } ]

If the records were retrieved without .decrypt(), you would get:

await User.find({fullName: 'Finn Mertens'});
// =>
// [ { id: 4, fullName: 'Finn Mertens', ssn: 'YWVzLTI1Ni1nY20kJGRlZmF1bHQ=$F4Du3CAHtmUNk1pn$hMBezK3lwJ2BhOjZ$6as+eXnJDfBS54XVJgmPsg' } ]

Notes

#

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

Reference