Describe a scenario where a side-channel attack could expose a private key, and how would you mitigate it in your code?