I had the the idea of a secure alternative login process using an EOS smart contract instead of firebase or Amazon cognito. I would like to know if something like this feasible?
My idea is somewhat like.
- Server creates cookie with a specific id
- Server sends cookie with id to client
- Client gets cookie with unique id from server
- Client wants to login so he executes a action "Login" from contract and writes the id he got from the server in the form of a SHA256 hash in the contract (contract writes the timestamp of execution also in the table)
- Client sends message to the server when the action was successful that he wants to login.
- Server looks up the EOS contract table for the name and if the entry is not older than 1-2sec and checks if the hashed id is the same as the server gave to the client.
- If everything is ok, the client gets a session and can see his private data or whatever the website returns.
(server could be something like node.js with express-session and reactjs/vue/angular as front-end)
I don't know if this is a secure way to do this or an alternative for firebase auth and amazon cognito. I would also be interested in other thoughts, how one could realize something like that.