Skip to content

Commit 0b13a52

Browse files
committed
Update doc
1 parent e2aae6b commit 0b13a52

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

docs/apdu.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ The general structure of a request and response is as followed:
4141
| 0xE005 | Failed to derive pub key |
4242
| 0xE006 | Invalid token size |
4343
| 0xE007 | Invalid metadata version |
44+
| 0xE008 | Invalid token proof size |
4445
| 0xEF00 | Internal error |
4546

4647
## Commands definitions
@@ -131,11 +132,42 @@ This command returns a signature of the passed transaction
131132
|-------|----------|-----------------------------|-------------------|
132133
| CLA | byte (1) | Application Identifier | 0x80 |
133134
| INS | byte (1) | Instruction ID | 0x03 |
134-
| P1 | byte (1) | Payload desc | 0x00: first transaction data block <br> 0x01: subsequent transaction data block |
135-
| P2 | byte (1) | ignored | |
135+
| P1 | byte (1) | Payload desc | 0x00, 0x01, 0x02 |
136+
| P2 | byte (1) | ignored | 0x00, 0x01 |
136137
| L | byte (1) | Bytes in payload | (depends) |
137138

138-
Input data (first transaction data block):
139+
We use `P1` and `P2` to distinguish between different data frames:
140+
141+
* `P1` = 0 and `P2` = 0 indicates the first token metadata data frame
142+
* `P1` = 1 and `P2` = 1 indicates a token proof data frame
143+
* `P1` = 1 and `P2` = 0 indicates subsequent metadata data frames
144+
* `P1` = 2 and `P2` = 0 indicates the first tx data frame
145+
* `P1` = 2 and `P2` = 1 indicates subsequent tx data frames
146+
147+
Input data (first token metadata frame):
148+
149+
| Field | Type | Content | Expected |
150+
|----------------|------------------------|----------------------|-------------------|
151+
| Token Size | byte (1) | Token Size | Any value between 0 and 5, inclusive |
152+
| Token Metadata | 46 | Token Metadata | ? |
153+
| Token Proof Size | 2 | Token Proof Size | ? |
154+
| Token Proof | byte (?) | Token Proof | ? |
155+
156+
Input data (token proof frame):
157+
158+
| Field | Type | Content | Expected |
159+
|----------------|------------------------|----------------------|-------------------|
160+
| Token Proof | byte (?) | Token Proof | ? |
161+
162+
Input data (subsequent token metadata frame):
163+
164+
| Field | Type | Content | Expected |
165+
|----------------|------------------------|----------------------|-------------------|
166+
| Token Metadata | 46 | Token Metadata | ? |
167+
| Token Proof Size | 2 | Token Proof Size | ? |
168+
| Token Proof | byte (?) | Token Proof | ? |
169+
170+
Input data (first transaction data frame):
139171

140172
| Field | Type | Content | Expected |
141173
|----------------|------------------------|----------------------|-------------------|
@@ -144,11 +176,9 @@ Input data (first transaction data block):
144176
| Path[2] | byte (4) | Derivation Path Data | ? |
145177
| Path[3] | byte (4) | Derivation Path Data | ? |
146178
| Path[4] | byte (4) | Derivation Path Data | ? |
147-
| Token Size | byte (1) | Token Size | Any value between 0 and 5, inclusive |
148-
| Token Metadata | byte (Token Size * 46) | Token Metadata | ? |
149179
| Payload | byte (?) | Transaction Payload | ? |
150180

151-
Input data (subsequent transaction data block):
181+
Input data (subsequent transaction data frame):
152182

153183
| Field | Type | Content | Expected |
154184
|---------|----------|---------------------------|-------------------|

0 commit comments

Comments
 (0)