Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for EIP-1271 contract wallets #30

Merged
merged 4 commits into from Sep 16, 2022
Merged

Add support for EIP-1271 contract wallets #30

merged 4 commits into from Sep 16, 2022

Conversation

sbihel
Copy link
Member

@sbihel sbihel commented Sep 13, 2022

Close #16
Close #17

Copy link
Contributor

@payton payton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Made a few minor comments @sbihel .

siwe/siwe.py Outdated
@@ -221,7 +235,9 @@ def verify(
domain: Optional[str] = None,
nonce: Optional[str] = None,
timestamp: Optional[datetime] = None,
provider: Optional[HTTPProvider] = None,
provider: HTTPProvider = HTTPProvider(
endpoint_uri="https://cloudflare-eth.com"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this feels too opinionated.

siwe/siwe.py Outdated
import rfc3987
import web3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from web3.exceptions import BadFunctionCallOutput

siwe/siwe.py Outdated
hash_ = _hash_eip191_message(message)
try:
response = contract.caller.isValidSignature(hash_, bytes.fromhex(signature[2:]))
return response.hex() == "1626ba7e"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add comment explaining what this magicvalue is (from eip: // bytes4(keccak256("isValidSignature(bytes32,bytes)") )

@sbihel sbihel merged commit ee7ffa3 into main Sep 16, 2022
@sbihel sbihel deleted the feat/eip1271 branch September 16, 2022 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support EIP-1271: Standard Signature Validation Method for Contracts
2 participants