Adopting a child given to me - help!

Does anyone know what to do or how this would go? Here’s the situation, say we took in a toddler for someone who wants to give him up for adoption but still is unsure, so unofficially you take him in for her. Then she decides she wants it to be permanent - then how would we go about to making it legal that he would be ours now?