I found recently that all women should have a wali or Wakil(layer) to represent  them during  the Nikah otherwise it is not valid. 

This is my second marriage. 

Before the marriage, I told him I need someone to represent me because I have no male relative, the *Imam who did our Nikah had told me I don't need one* and I can represent myself *because I was a divorcee* and two of his relatives witnessed the Nikah and that's enough. 

We have a child together now.

I have the following questions:

- Was the Nikah valid?

- Have I committed a sin because I didn't know?

- What can I do or how can I repent?

- What will make of our child if the Nikah was not valid? (Illegitimate?)

I'm scare, afraid I committed  a sin unintentionally.  Any guidance  would be gladly appreciated.

FYI - That imam did not represent me and said it is not required