@@ -960,6 +960,159 @@ _Output data_
960
960
961
961
None
962
962
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 with address | 00 | 00 | see below
982
+ | E0 | 30 | 05 : update multiple accounts with address | 00 : next data
983
+
984
+ 01 : last data | variable | see below
985
+
986
+ | E0 | 30 | 06 : update an account with derivation path | 00 | 00 | see below
987
+ | E0 | 30 | 07 : update multiple accounts with derivation path | 00 : next data
988
+
989
+ 01 : last data | variable | see below
990
+ |==============================================================================================================================
991
+
992
+ Commands summary:
993
+
994
+ - `delete all accounts`: _Purge_ the Address Book, and remove all entries.
995
+ - `get account`: Retrieve a specific Address Book entry; the Account Number is given in parameter.
996
+ - `rename an account`: _Change_ the Name assigned to an Account.
997
+ - `update an account`: _Add_ a new account, or _Rename_ an existing one.
998
+ - `update multiple accounts`: _Add_ new accounts and/or _Rename_ existing ones.
999
+ This is a _chaining_ command, meaning several APDU must be sent successively,
1000
+ and the last one should have P2 = 0x01 to trig the confirmation screens.
1001
+
1002
+ > For _update account_ commands, we have each time 2 variants:
1003
+ >
1004
+ > - Providing the full address
1005
+ > - Providing the full derivation path, allowing the device to securely derivate and compute the address.
1006
+
1007
+ _Input data_
1008
+
1009
+ ##### If P1 == `rename an account`
1010
+
1011
+ [width="80%"]
1012
+ |==============================================================================================================================
1013
+ | *Description* | *Length*
1014
+ | Old Account Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1015
+ | New Account Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1016
+ |==============================================================================================================================
1017
+
1018
+ > The _Old Account name_ length must be written in P2.
1019
+
1020
+ ##### If P1 == `update an account`
1021
+
1022
+ This command is used to _Add_ a new Address Book entry. If the pair (*_Address_*, *_Chain Id_*) already exists,
1023
+ the command will be considered as a _Rename_.
1024
+
1025
+ ###### Case with Address
1026
+
1027
+ [width="80%"]
1028
+ |==============================================================================================================================
1029
+ | *Description* | *Length*
1030
+ | Chain Id (8 Bytes) | 16
1031
+ | Address (20 hex values without '0x') | 40
1032
+ | Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1033
+ |==============================================================================================================================
1034
+
1035
+ ###### Case with Derivation Path
1036
+
1037
+ [width="80%"]
1038
+ |==============================================================================================================================
1039
+ | *Description* | *Length*
1040
+ | Chain Id (8 Bytes) | 16
1041
+ | Derivation Path (1 Byte length + up to 5 x 4 Bytes) | variable (max 42)
1042
+ | Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1043
+ |==============================================================================================================================
1044
+
1045
+
1046
+ ##### If P1 == `update multiple account`
1047
+
1048
+ Compared to the previous `update an account`, the principle here is to chain multiple APDU
1049
+ to update (_Add_/_Rename_) several Address Book entries at once.
1050
+ The review/confirmation will be displayed only once when all APDU have been sent.
1051
+ Thus, the last APDU must be distinguished using the P2 value.
1052
+
1053
+ ###### Case with Address
1054
+
1055
+ [width="80%"]
1056
+ |==============================================================================================================================
1057
+ | *Description* | *Length*
1058
+ | Chain Id (8 Bytes) | 16
1059
+ | Address (20 hex values without '0x') | 40
1060
+ | Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1061
+ |==============================================================================================================================
1062
+
1063
+ ###### Case with Derivation Path
1064
+
1065
+ [width="80%"]
1066
+ |==============================================================================================================================
1067
+ | *Description* | *Length*
1068
+ | Chain Id (8 Bytes) | 16
1069
+ | Derivation Path (1 Byte length + up to 5 x 4 Bytes) | variable (max 42)
1070
+ | Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1071
+ |==============================================================================================================================
1072
+
1073
+ _Output data_
1074
+
1075
+ ##### If P1 == `get account`
1076
+
1077
+ [width="80%"]
1078
+ |==============================================================================================================================
1079
+ | *Description* | *Length*
1080
+ | Chain Id (8 Bytes) | 16
1081
+ | Address (20 hex values without '0x') | 40
1082
+ | Account Name (up to 16 ascii characters, 32 hex values - without '0x') | variable (max 32)
1083
+ |==============================================================================================================================
1084
+
1085
+
1086
+ _Status Word_
1087
+
1088
+ The returned Status Word depends on the command:
1089
+
1090
+ ##### If P1 == `update multiple account`
1091
+
1092
+ For each intermediate APDU, the Status Word will contain the remaining available entries in the lower bits.
1093
+ For example, it will return `0x9002` when the command is correctly completed, and there are still `2` remaining (free) entries.
1094
+ Of course, after the *Last* one (with P2 = 0x01), it will be `0x9000`, indicating everything has been done and completed.
1095
+
1096
+ ##### Other commands
1097
+
1098
+ The other commands will return `0x9000` when correctly completed.
1099
+
1100
+ ##### Errors
1101
+
1102
+ In case of error, the _Status Word_ will be:
1103
+
1104
+ [width="80%"]
1105
+ |==============================================================================================================================
1106
+ | *Description* | *Status Word*
1107
+ | Error in P1 / P2 parameters | 0x6B00
1108
+ | Memory error: No more Address Book entries available | 0x6A80
1109
+ | Requested Data not found | 0x6A88
1110
+ | Add an account, but using an already assigned name | 0x6A80
1111
+ | Update an account, but APDU length is inconsistent | 0x6983
1112
+ | Add an account, but it is already present in the Address Book | 0x6985
1113
+ |==============================================================================================================================
1114
+
1115
+
963
1116
964
1117
## Transport protocol
965
1118
0 commit comments