Backup&Restore

This commit is contained in:
ericz committed 2026-11-08 00:40:23 +01:00
1 parent 394df3109b
commit aae2bf6d60
29 files changed
+2769 -120

No files matched your search

+14
View File
@@ -195,6 +195,8 @@ const int cmdImportContact = 18;
const int cmdReboot = 19;
const int cmdGetBattAndStorage = 20;
const int cmdDeviceQuery = 22;
const int cmdExportPrivateKey = 23;
const int cmdImportPrivateKey = 24;
const int cmdSendLogin = 26;
const int cmdSendStatusReq = 27;
const int cmdGetContactByKey = 30;
@@ -259,6 +261,8 @@ const int respCodeNoMoreMessages = 10;
const int respCodeExportContact = 11;
const int respCodeBattAndStorage = 12;
const int respCodeDeviceInfo = 13;
const int respCodePrivateKey = 14;
const int respCodeDisabled = 15;
const int respCodeContactMsgRecvV3 = 16;
const int respCodeChannelMsgRecvV3 = 17;
const int respCodeChannelInfo = 18;
@@ -1087,6 +1091,16 @@ Uint8List buildTraceReq(int tag, int auth, int flag, {Uint8List? payload}) {
return writer.toBytes();
}
Uint8List buildExportPrivateKeyFrame() =>
Uint8List.fromList([cmdExportPrivateKey]);
Uint8List buildImportPrivateKeyFrame(Uint8List keyData) {
if (keyData.length != 64) {
throw ArgumentError.value(keyData.length, 'keyData.length', 'must be 64');
}
return Uint8List.fromList([cmdImportPrivateKey, ...keyData]);
}
// Build a export contact frame
// [cmd][pub_key x32 / if empty exports your contact info]
Uint8List buildExportContactFrame(Uint8List pubKey) {