From 5f7a1a7a5a4311fd71ed113624dd1d0fe9e72ff5 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 15 Aug 2017 17:47:05 +0200 Subject: [PATCH] add protocol description --- protob/protocol.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 protob/protocol.md diff --git a/protob/protocol.md b/protob/protocol.md new file mode 100644 index 0000000000..38dc411e0a --- /dev/null +++ b/protob/protocol.md @@ -0,0 +1,21 @@ +# TREZOR Protocol + +## version 1 + +Messages are sent in packets of 64 bytes. + +First packet has the following structure: + +| offset | length | type | contents | +|--------|--------|-------------|---------------------------------------------------------------------------------------| +| 0 | 3 | char[3] | '?##' magic constant | +| 3 | 2 | BE uint16_t | numerical [message type](messages.proto#L14) | +| 5 | 4 | BE uint32_t | message size | +| 9 | 55 | uint8_t[55] | first 55 bytes of message encoded in Protocol Buffers (padded with zeroes if shorter) | + +Following packets has the following structure: + +| offset | length | type | contents | +|--------|--------|-------------|----------------------------------------------------------------------------------------| +| 0 | 1 | char[1] | '?' magic constant | +| 1 | 63 | uint8_t[63] | following bytes of message encoded in Protocol Buffers (padded with zeroes if shorter) |