Facing issue with customer personal data encryption for shopify app

Hello,

Context of problem:

I am making one shopify app which connects to my platform (cash-register site) in there i am getting orders from shopify and showing it to my platform for which i need to create customer and as per shopify policy i need encrypt all customer personal data(email, phone, name).
But i am not encrypting these field for non-shopify customer in platform but if do encrypt for only shopify customers it’s ruining my queries:

Problem example:
User searches a customer with email or name but at backend when i run query in db i don’t know if this customer we are trying to find is from shopify if it is i need to encrypt query to match it

Solution i thought but didn’t work for me:
At first i thought of encrypting all the customers personal data but for that i need decrypt every time i find one or more customers and encryption and decryption are bit heave processes for CPU. so it could slower my server so i didn’t do this.

More info:
I am using mongodb as my database and i have one field called ‘source’ which indicate if customer is from shopify or from somewhere else.

Is there any way to tackle this issue?

Thank you!

Hi @user4679

  1. Encrypt Shopify customer data deterministically (same plaintext → same ciphertext).

  2. Keep non-Shopify customer data unencrypted.

  3. When searching:

    • Check the source field.

    • If source = "shopify", encrypt the search value the same way before querying.

    • If source != "shopify", search normally.

This way, your queries still work without decrypting all data, and you only encrypt/decrypt when needed.

But the problem is this source field is inside customer right i would get this after i run the query and get the customer before that i don’t know the source of this customer users is trying to find