What constitutes as stealing of an idea?
This answer assumed that OP was in some way senior to their counterpart, either in position or experience. Since this assumption is not true (OP is a masters student, the other person is a PhD student), it seems there is some fault for both parties in how they communicated expectations at the beginning of the project.

It's going to be difficult if not impossible for anyone here to judge this because none of us are in the situation and have the daily exposure required to do so.
However, with the limited information you give here, it sounds to me like someone came to you with an idea, and rather than help them with their idea you judged yourself more capable to do the work and took off with it.
It's like instead of helping a student understand their confusion on part of their homework, you've done most of the assignment for them, while keeping them informed of your progress. In doing so, yes you've helped them complete their homework, but you've stolen from them the opportunity to learn while doing it. Or imagine a 5 year old assembling a train set. They've run into a problem and can't get a loop connected because they've installed too tight of a bend, and ask for help. Do you provide some suggestions on how they might fix the problem? do you rearrange a piece or two to help demonstrate this? Or do you wait for them to go to sleep and show them when they wake up how you've completed it all for them and solved all their problems? Clearly you get the credit for completing the train set, but was it fair?
It sounds a bit like you've stolen an idea to me. The conversation about the project and authorship should have occurred at the beginning before you decided to &quot;run with it&quot;, or at least in one of the intervening times when this person indicated they didn't have the time right now, not when you'd like to finish off the project and already did all the work. Arguably the other person should have brought this up on their own then and not now, but there are various reasons (such as social hierarchies, cultural norms, and their own personality) that may have prevented them from doing so, and if you are the more experienced person in the situation the onus is on you.
You very much may deserve the majority of credit on the final work. The infraction is not in deceit about what you were working on, but on taking on so much of the project that it became yours without getting permission or an understanding up front. Especially if all you were asked was if you would help with a literature review.