I'm giving each of my users an unique Blocktrail wallet that is protected by two API keys (which the server knows) and one passphrase (unique to each wallet).
I want the wallet's passphrase to be unavailable to anyone but the logged-in user (session persistent), so that nobody, even server administrators, can look at the wallet's password and make transactions from the wallet.
I'm already encrypting user account passwords with bcrypt.
This is what I would ideally like to implement:
- A passphrase that only a logged in user "has access" to. (Not directly, but through their session).
- That the passphrase is available for when the user decides to make a transaction from within the client UI (the passphrase is needed in order to make transactions), but that the user isn't required to type in a second password or type in their account's password every time.
- That nobody is able to know what the passphrase is for any specific user, not server admins looking at databases/server sessions, not hackers breaking into the server and writing scripts that leak the passphrase, not myself.
Is this possible at all? My guess is that I'd have to somehow derive a hash, perhaps, of the user password before encrypting it with bcrypt, use that as the passphrase and store that in the session, or probably in a cookie (with additional security?). But then again, administrators sneak-peaking at the server can look at whatever is stored in each session, retrieve the passphrase, and steal the bitcoins, right? And also, I think that storing a hashed password client side wouldn't be such a good idea.
I'm really new to security, so I have no clue as to what would be the best approach for this. Or perhaps I am being too paranoid, and should just use the bcrypted password or a random string (stored in a database) as the wallet's passphrase? (Considering two API keys are also required).
I'm just looking for a hint in the right direction, since I don't even know if what I want is even achievable. Thanks.