Merge remote-tracking branch 'origin/dev' into test-regions Also added fixes

This commit is contained in:
zjs81
2026-06-15 22:46:59 -07:00
133 changed files with 34463 additions and 19330 deletions
+8 -3
View File
@@ -207,13 +207,13 @@ const int cmdSendTelemetryReq = 39;
const int cmdGetCustomVar = 40;
const int cmdSetCustomVar = 41;
const int cmdSendBinaryReq = 50;
const int cmdSetFloodScope = 54;
const int cmdSendControlData = 55;
const int cmdGetStats = 56;
const int cmdSendAnonReq = 57;
const int cmdSetAutoAddConfig = 58;
const int cmdGetAutoAddConfig = 59;
const int cmdSetPathHashMode = 61;
const int cmdSetFloodScope = 54;
// Text message types
const int txtTypePlain = 0;
@@ -467,8 +467,13 @@ String pubKeyToHex(Uint8List pubKey) {
// Helper to convert hex string to public key
Uint8List hexToPubKey(String hex) {
if (hex.length != pubKeySize * 2) {
throw FormatException(
'Public key hex must be ${pubKeySize * 2} chars, got ${hex.length}',
);
}
final result = Uint8List(pubKeySize);
for (int i = 0; i < pubKeySize && i * 2 + 1 < hex.length; i++) {
for (int i = 0; i < pubKeySize; i++) {
result[i] = int.parse(hex.substring(i * 2, i * 2 + 2), radix: 16);
}
return result;
@@ -1022,7 +1027,7 @@ Uint8List buildSendTelemetryReq(Uint8List? pubKey) {
writer.writeBytes(Uint8List(3)); // reserved bytes
writer.writeBytes(pubKey);
} else {
writer.writeBytes(Uint8List(4)); // reserved bytes
writer.writeBytes(Uint8List(3)); // reserved bytes
}
return writer.toBytes();
}