.decrypt()
Decrypt any auto-encrypted attributes in the records returned for this particular query.
query.decrypt()
This method doesn't accept any arguments.
To retrieve user records with ssn
decrypted:
await User.find().decrypt();
// =>
// [ { id: 4, fullName: 'Finn Mertens', ssn: '555-55-5555' } ]
If the records were retrieved without .decrypt()
, you would get:
await User.find();
// =>
// [ { id: 4, fullName: 'Finn Mertens', ssn: 'YWVzLTI1Ni1nY20kJGRlZmF1bHQ=$F4Du3CAHtmUNk1pn$hMBezK3lwJ2BhOjZ$6as+eXnJDfBS54XVJgmPsg' } ]
- This is just a shortcut for
.meta({decrypt: true})