Impersonation would be a dick move, and would ruin my reputation. Do not need laws to avoid such things. Obvious social repercussions are enough.
Still impersonation sucks, and it happens. Thankfully we can solve this with cryptography without trying to beg the legal system of hundreds of countries to agree on enforcement tactics.
I publish 100% of code I write as FOSS. I also sign my commits. If the code shows up later without attribution to me, I would prove it publicly to call out dishonest behavior.
I would also never use legal action for this though. All information should be free. I only put FOSS licenses on code to ensure I do not get sued and so corporations bound by such silly rules have a difficult time using my work in private codebases without paying me for an alternate license.
I would abolish all IP law if I could. Let all information be free without legal risk to authors or those that share it.