I started rebuilding a trusting relationship with my wife under very similar circumstances.
Back in October 2016 I had relapsed hard (and secretly) immediately after returning home from rehab. At the time I had a bug up my ass that getting onto naltrexone would help me resist the cravings that kept me on the abstain/relapse rollercoaster. But before initiating naltrexone, a person needs to accumulate ~7 days opiate-free, otherwise the new drug will induce precipitated withdrawals. I tried and tried, but just couldn't string together anything close to 7 days clean. So finally I said 'fuck it' and dropped my first naltrexone pill. Bad idea. Within 15 minutes I was in the worst WDs I've ever had. I was just a disaster.
After a couple hours like that my wife came home from work. I considered trying to hide the WDs by saying I had the flu. But at that moment I was so broken and terrified that I simply told her the truth.
It was *rough*. She walked out the door to stay with a friend of hers b/c she was so pissed at me, though she didn't tell me where she was going or when she'd return. That was about as alone as I've ever felt.
...But, we've come back pretty well since then. As awful as it felt at the time, I've become glad I told her the truth that day. It caused a huge rupture between us. But after that, it gave us solid ground (no lies) to begin repairing the trust that my years of heroin addiction had harmed.