Skip to content

Commit

Permalink
fixup! fix(core,legacy): Fix domain-only ethTypedData
Browse files Browse the repository at this point in the history
Add new screen for approving domain-only eth type data on Trezor T.
This replaces the old "Confirm message" screen.
  • Loading branch information
aloisklink committed Jan 5, 2022
1 parent 2d1a145 commit 23be403
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/apps/ethereum/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ async def confirm_hash(ctx: Context, message_hash: bytes) -> None:
)


def require_confirm_empty_typed_message(ctx: Context) -> Awaitable[None]:
return confirm_text(
ctx,
"confirm_empty_typed_message",
title="Confirm message",
data="",
description="No message field",
)


async def should_show_domain(ctx: Context, name: bytes, version: bytes) -> bool:
domain_name = decode_typed_data(name, "string")
domain_version = decode_typed_data(version, "string")
Expand Down
2 changes: 2 additions & 0 deletions core/src/apps/ethereum/sign_typed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .layout import (
confirm_hash,
confirm_typed_value,
require_confirm_empty_typed_message,
should_show_array,
should_show_domain,
should_show_struct,
Expand Down Expand Up @@ -84,6 +85,7 @@ async def generate_typed_data_hash(
# In this case, we ignore the "message" part and only use the "domain" part
# https://ethereum-magicians.org/t/eip-712-standards-clarification-primarytype-as-domaintype/3286
if primary_type == "EIP712Domain":
await require_confirm_empty_typed_message(ctx)
message_hash = b""
else:
show_message = await should_show_struct(
Expand Down

0 comments on commit 23be403

Please sign in to comment.