Lost a best friend.

To start off this long story I have a best friend let’s call her H and I have another friend and let’s call her J so H told me a big secret and as a best friend she told me not to say anything she expected me to keep my word. I hated what she did and what the secret was so I vented to my friend J about it. Then alittle while after that J and H get in a argument and J threatens to expose H and H wonders how she knows about it so she asked me to my face did you tell J and I said “no” which is a big mistake on my part because I did. Then her and J made up and J told H that I was talking crap about H but really I was just venting to J about how I didn’t like what she did, it wasn’t exactly “talking crap” anyway H gets mad at me which she has the right to be because I told her secret, I lied to her face and I vented about her problems to someone that had nothing to do with it. J and I are not friends anymore let’s leave it at that and H doesn’t talk to me anymore this did happen the other day so she probably needs to cool down but I feel terrible about what I did and I regret it but all I can do now is apologize and learn from my mistakes. I do want H as a friend and my best friend but I don’t know exactly how to fix it other then apologize.