I'm pretty new to German, and when I read and watched German content, I noticed that they sometimes use ich and mir in the same phrase. For example:
Ich war mir sicher, dass ich im Test die richtigen Antworten gab.
As I understand the sentence, in English I'd just say "I was sure,...".
I don't understand the function of mir.
Why is it there and what does it express?