Decrypt/Edit data before returning from a publish method


Hi guys/girls.

When data is inserted/upserted into the database for a given collection, occasionally I have to encrypt it. Currently I am doing this using Collection.before.insert (from the Meteor Collection Hooks package).

This data obviously needs decrypting before reaching the client though. I don’t want to decrypt on the client as I want the encryption key to remain on the server only.

Ideally I’d like to be able to decrypt the information in the publisher for the given collection.

Any ideas on how this might be achieved.

I’ve looked at using the following technique but had no luck.