@@ -960,6 +960,125 @@ _Output data_
960960
961961None
962962
963+ ### Favorite Accounts
964+
965+ #### Description
966+
967+ This command allows to synchronize an Address Book between Ledger Live and the device.
968+ This allows user-friendly and easier address verifications.
969+ Also, the entries from the Address Book can be displayed as a QR code for easier control or sharing.
970+
971+ #### Coding
972+
973+ 'Command'
974+
975+ [width="80%"]
976+ |==============================================================================================================================
977+ | *CLA* | *INS* | *P1* | *P2* | *Lc* | *Le*
978+ | E0 | 30 | 01 : delete all accounts | 00 | 00 | empty
979+ | E0 | 30 | 02 : get account | account Nb | 00 | empty
980+ | E0 | 30 | 03 : rename an account | old name size | variable | see below
981+ | E0 | 30 | 04 : update an account | 00 | 00 | see below
982+ | E0 | 30 | 05 : update multiple accounts | 00 : next data
983+
984+ 01 : last data | variable | see below
985+ |==============================================================================================================================
986+
987+ Commands summary:
988+
989+ - `delete all accounts`: _Purge_ the Address Book, and remove all entries.
990+ - `get account`: Retrieve a specific Address Book entry; the Account Number is given in parameter.
991+ - `rename an account`: _Change_ the Name assigned to an Account.
992+ - `update an account`: _Add_ a new account, or _Rename_ an existing one.
993+ - `update multiple accounts`: _Add_ new accounts and/or _Rename_ existing ones.
994+ This is a _chaining_ command, meaning several APDU must be sent successively,
995+ and the last one should have P2 = 0x01 to trig the confirmation screens.
996+
997+
998+ _Input data_
999+
1000+ ##### If P1 == `rename an account`
1001+
1002+ [width="80%"]
1003+ |==============================================================================================================================
1004+ | *Description* | *Length*
1005+ | Old Account Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1006+ | New Account Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1007+ |==============================================================================================================================
1008+
1009+ The _Old Account name_ length must be written in P2.
1010+
1011+ ##### If P1 == `update an account`
1012+
1013+ [width="80%"]
1014+ |==============================================================================================================================
1015+ | *Description* | *Length*
1016+ | chain_id (8 Bytes) | 16
1017+ | Address (20 hex values without '0x') | 40
1018+ | Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1019+ |==============================================================================================================================
1020+
1021+ This command is used to _Add_ a new Address Book entry. It the provided pair (*_Address_*, *_Chain_id_*) already exists,
1022+ the command will be considered as a _Rename_.
1023+
1024+ ##### If P1 == `update multiple account`
1025+
1026+ [width="80%"]
1027+ |==============================================================================================================================
1028+ | *Description* | *Length*
1029+ | chain_id (8 Bytes) | 16
1030+ | Address (20 hex values without '0x') | 40
1031+ | Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1032+ |==============================================================================================================================
1033+
1034+ Compared to the previous `update an account`, the principle here is to chain multiple APDU
1035+ to update (_Add_/_Rename_) several Address Book entries at once.
1036+ The review/confirmation will be displayed only once when all APDU have been sent.
1037+ Thus, the last APDU must be distinguished using the P2 value.
1038+
1039+ _Output data_
1040+
1041+ ##### If P1 == `get account`
1042+
1043+ [width="80%"]
1044+ |==============================================================================================================================
1045+ | *Description* | *Length*
1046+ | chain_id (8 Bytes) | 16
1047+ | Address (20 hex values without '0x') | 40
1048+ | Account Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1049+ |==============================================================================================================================
1050+
1051+
1052+ _Status Word_
1053+
1054+ The returned Status Word depends on the command:
1055+
1056+ ##### If P1 == `update multiple account`
1057+
1058+ For each intermediate APDU, the Status Word will contain the remaining available entries in the lower bits.
1059+ For example, it will return `0x9002` when the command is correctly completed, and there are still `2` remaining (free) entries.
1060+ Of course, after the *Last* one (with P2 = 0x01), it will be `0x9000`, indicating everything has been done and completed.
1061+
1062+ ##### Other commands
1063+
1064+ The other commands will return `0x9000` when correctly completed.
1065+
1066+ ##### Errors
1067+
1068+ In case of error, the _Status Word_ will be:
1069+
1070+ [width="80%"]
1071+ |==============================================================================================================================
1072+ | *Description* | *Status Word*
1073+ | Error in P1 / P2 parameters | 0x6B00
1074+ | Memory error: No more Address Book entries available | 0x6A80
1075+ | Requested Data not found | 0x6A88
1076+ | Add an account, but using an already assigned name | 0x6A80
1077+ | Update an account, but APDU length is inconsistent | 0x6983
1078+ | Add an account, but it is already present in the Address Book | 0x6985
1079+ |==============================================================================================================================
1080+
1081+
9631082
9641083## Transport protocol
9651084
0 commit comments