You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
513 B
Python

from web3.auto import w3
from eth_account.messages import encode_defunct
from flipbook import config
def verify_signature(message, signature, public_address):
msg = encode_defunct(text=message)
recovered = w3.eth.account.recover_message(msg, signature=signature)
if recovered.lower() == public_address.lower():
return True
else:
return False
def allowed_file(filename):
return "." in filename and \
filename.rsplit(".", 1)[1].lower() in config.ALLOWED_EXTENSIONS