A little interesting is that you think you need to move part of the authentication to the client. If you want to use the usual solution, the KOGI server-side offer is the way to go.
But you also seem to be asking questions about memory leaks related to secrets provided by your user. Good questions. But in order to take a general blow by replying, I would say that it must be browser specific. The internal elements of the browser, the internal mechanisms are javascript-dependent, where the client application (that is, the browser or js in the browser) stores the values entered by the user.
Most likely, these values will not be duplicated without the need for all memory, but there is no way to guarantee this. Apart from responsible javascript encoding methods, you can do nothing to guarantee the restriction of the location of user inputs.
Minor retreat
The main point is that if you store it on the client, it is not really secure - if only the service stores encrypted information on the client with a key that only the server has (or the user through their correct credentials). That way you could apparently encode the JS application to do some kind of confirmation on the client - just like the way a bank card (used?) Does POS authentication by checking the PIN for the PIN on the map, not back to the database. This is based on the (somewhat far-fetched) assumption that the user does not have direct access to read / write the cookie / local storage of the dark area on the client / magnetic strip on the bank card. Therefore, I would advise this only as a disqualifier of false authentications, and not as the only qualifier for credentials.
Main point
If you want to be stateless, just save the user credentials in localstorage or as a cookie, but encrypt them using the server key. When you need it, send XHR with the encrypted / used stored credentials to the server via HTTPS, let your server decrypt them and send them to the callback. Then pass this text to HTTPS to authenticate.
Crisp stringfellow
source share