If you want to pass custom data to a discount function securely, one way to do this is through the use of metafields. Metafields act as custom fields on an object, allowing you to store extra information for products, customers, orders, etc. in your Shopify store.
You can create a metafield for your app where you store the parameter you want to use for granting discounts. Then in your discount function, you can access this metafield and apply a discount accordingly.