1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-21 15:39:01 +00:00

core/bitcoin: Support preauthorization in GetOwnershipProof message.

This commit is contained in:
Andrew Kozlik 2020-07-23 17:04:16 +02:00 committed by Andrew Kozlik
parent c772de9d3c
commit 00258f2d4d

View File

@ -14,7 +14,9 @@ from .keychain import with_keychain
from .ownership import generate_proof, get_identifier
if False:
from typing import Optional
from apps.common.keychain import Keychain
from .authorization import CoinJoinAuthorization
# Maximum number of characters per line in monospace font.
_MAX_MONO_LINE = 18
@ -22,8 +24,16 @@ _MAX_MONO_LINE = 18
@with_keychain
async def get_ownership_proof(
ctx, msg: GetOwnershipProof, keychain: Keychain, coin: coininfo.CoinInfo
ctx,
msg: GetOwnershipProof,
keychain: Keychain,
coin: coininfo.CoinInfo,
authorization: Optional[CoinJoinAuthorization] = None,
) -> OwnershipProof:
if authorization:
if not authorization.check_get_ownership_proof(msg):
raise wire.ProcessError("Unauthorized operation")
else:
await validate_path(
ctx,
addresses.validate_full_path,
@ -57,7 +67,7 @@ async def get_ownership_proof(
msg.ownership_ids = [ownership_id]
# In order to set the "user confirmation" bit in the proof, the user must actually confirm.
if msg.user_confirmation:
if msg.user_confirmation and not authorization:
text = Text("Proof of ownership", ui.ICON_CONFIG)
text.normal("Do you want to create a")
if not msg.commitment_data: