From 6914104a08d00274351a92943fa3e9d3bf230999 Mon Sep 17 00:00:00 2001 From: GroM Date: Thu, 14 Nov 2024 11:09:06 +0100 Subject: [PATCH] Highlight TN based swap --- doc/flow.md | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/doc/flow.md b/doc/flow.md index 57ae3b8a..2f4b3a27 100644 --- a/doc/flow.md +++ b/doc/flow.md @@ -8,16 +8,9 @@ sequenceDiagram participant FRCA as FROM Coin App participant DS as Device Screen - activate EA - EA-->>EA: Check if previous cycle - EA-->>DS: if previous cycle - activate DS - DS-->>DS: display sign status - DS-->>EA: - deactivate DS - LL->>EA: START_NEW_TRANSACTION (0x03) activate EA + activate EA EA-->>EA: Create a nonce for the transaction EA-->>LL: Device Transaction ID (nonce) deactivate EA @@ -36,7 +29,7 @@ sequenceDiagram LL->>EA: PROCESS_TRANSACTION_RESPONSE (0x06) activate EA - EA-->>EA: Receive the transaction proposal from the exchange partner + EA-->>EA: Receive and parse the transaction proposal from the exchange partner EA-->>LL: return deactivate EA @@ -47,7 +40,7 @@ sequenceDiagram deactivate EA rect rgb(200, 200, 200) - note right of LL: SPL Token swap + note right of LL: Trusted Name based swap LL->>+EA: SEND_PKI_CERTIFICATE EA->>EA: Validate Certificate EA->>EA: Save Certificate @@ -59,13 +52,20 @@ sequenceDiagram EA-->>EA: Verify if descriptor key_id is equald to certificate key id EA-->>EA: Verify if certificate key usage is equal to trusted_name (0x04) EA-->>EA: Verify descriptor signature - EA-->>EA: Save descriptor in memory (payout_address's owner or refund_address's owner) + EA-->>EA: Save descriptor in memory (e.g. for SPL token, token account's owner = address from TAG_ADDRESS) EA-->>-LL: OK end LL->>+EA: CHECK_PAYOUT_ADDRESS (0x08) + alt Trusted Name swap + rect rgb(200, 200, 200) + note right of EA: Trusted Name based swap + EA->>+TOCA: os_lib_call(CHECK_ADDRESS, address, derivation_path) + end + else EA->>+TOCA: os_lib_call(CHECK_ADDRESS, payout_address, derivation_path) - TOCA-->>TOCA: Check that the payout address belongs to the device + end + TOCA-->>TOCA: Check that the [payout] address is owned by the device TOCA-->>-EA: os_lib_end(): Result EA->>+TOCA: os_lib_call(GET_PRINTABLE_AMOUNT) TOCA-->>TOCA: Format the receiving amount @@ -73,8 +73,15 @@ sequenceDiagram EA-->>-LL: return LL->>+EA: CHECK_REFUND_ADDRESS_NO_DISPLAY (0x0C) + alt Trusted Name swap + rect rgb(200, 200, 200) + note right of EA: Trusted Name based swap + EA->>+TOCA: os_lib_call(CHECK_ADDRESS, address, derivation_path) + end + else EA->>+FRCA: os_lib_call(CHECK_ADDRESS, refund_address, derivation_path) - FRCA-->>FRCA: Check that the refund address belongs to the device + end + FRCA-->>FRCA: Check that the [refund] address belongs to the device FRCA-->>-EA: os_lib_end(): Result EA->>+FRCA: os_lib_call(GET_PRINTABLE_AMOUNT) FRCA-->>FRCA: Format the sending amount @@ -86,7 +93,7 @@ sequenceDiagram LL->>+EA: PROMPT_UI_DISPLAY (0x0F) rect rgb(200, 200, 200) - note right of LL: SPL Token swap + note right of LL: Trusted Name based swap EA-->>EA: Use descriptor info to display token account owner address in addition to payout or refund address end EA->>+DS: Request UI validation @@ -107,6 +114,12 @@ sequenceDiagram FRCA-->>EA: os_lib_end() deactivate FRCA EA-->>EA: Save last cycle data: Coin appname + sign status + EA-->>EA: Check if previous cycle + EA-->>DS: if previous cycle + activate DS + DS-->>DS: display sign status + DS-->>EA: + deactivate DS deactivate EA ``` \ No newline at end of file