spruceid / siwe-py

A Python implementation of Sign-In with Ethereum
https://login.xyz
Apache License 2.0
66 stars 28 forks source link

Message from string doesn't work #21

Closed zekiblue closed 2 years ago

zekiblue commented 2 years ago

Hey

I want to use siwe for one of my project. However i am having issue. When I create SiweMessage always when i use with string. Even tho the string version is created with SiweMessage a little snippet to reproduce the issue.

from eth_account import Account
from siwe.siwe import SiweMessage

account = Account.create()
test_message = {
        "domain": "test",
        "address": account.address,
        "uri": "test",
        "version": "1",
        "chain_id": "1",
    }
message = SiweMessage(test_message)
signature = account.sign_message(
        messages.encode_defunct(text=message.prepare_message())
    ).signature

# Fails here
message_from_string = SiweMessage(message.prepare_message())
zekiblue commented 2 years ago

I simply forgot to add the statement, but the error messages can be improved to direct in the better direction