I'm working on a web app, and I know little about security/cryptography (for now, still learning) but I'm trying to set up a front-end where:
At the very beginning, the user puts in their private key.
The key is stored as a variable in javascript.
Any time the user does anything to interact with the backend, the key is used to sign or encrypt whatever data it needs to, the data is sent, and when the user is done with everything, they close the browser.
Is this a secure way of doing this? Can anything but my JS code access this key in the process?
(P.S. it's gonna be RSA or ECC so asymmetric, private key is only known by front end user)