I'm creating an authentication system using python and web3.py.
I'm trying to authenticate a user using
from web3.auto import w3 msg = 'sdb41554xcb4xc548cxd84dxcb' message = encode_defunct(text=msg) signed_message = w3.eth.account.sign_message(message, private_key=private_key) x = w3.eth.account.recover_message(message, signature=signed_message.signature) if x.lower() == addr.lower(): return 'AUTHENTICATED'
where addr is the account address of the user store in DB.
For this, the user has to provide his private_key every time. But what I want is that the user only provides the passphrase(which was earlier used while creating the account). His public_key is already stored in Database with his profile.
My question is:
Is there any way that whenever the user provides his passphrase and public_key(coming from DB), private_key is automatically retrieved and thus can be used to sign the message? Any library or something present for the same?
I don't want the user to remember his private_key for the whole time.(While passphrase can be remembered)
Other way: I can import the account in Metamask and whenever he logs in, Metamask prompts open to sign the message. But this will make Metamask compulsory for the users which I don't want.