Secure way of encrypting payload in Javascript for user authentification

Yeah don’t do this. Private key is intended to be private per client.

The 10 second key generation is a price you need to pay. There are some js crypto apis that can make it faster.