mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 14:05:18 +00:00
Add protocol version negotiation for future compatibility
- Add version negotiation messages (0x20 versionHello, 0x21 versionAck) - Implement VersionHello and VersionAck message types with platform info - Add ProtocolVersion struct for version management and negotiation - Update BinaryProtocol to check supported versions - Add version negotiation to connection flow before Noise handshake - Maintain backward compatibility with legacy peers (assume v1) - Add comprehensive test suite with 40+ test cases - Update documentation with version negotiation details This ensures BitChat clients can negotiate protocol versions for smooth upgrades while maintaining full backward compatibility with existing clients.
This commit is contained in:
@@ -167,6 +167,7 @@ class ChannelVerificationTests: XCTestCase {
|
||||
let update = ChannelPasswordUpdate(
|
||||
channel: channel,
|
||||
ownerID: ownerID,
|
||||
ownerFingerprint: "test-fingerprint", // Mock fingerprint
|
||||
encryptedPassword: Data(), // Would be encrypted in real scenario
|
||||
newKeyCommitment: newCommitment
|
||||
)
|
||||
@@ -191,9 +192,12 @@ class MockBluetoothMeshService: BluetoothMeshService {
|
||||
var mockNoiseSessionEstablished = false
|
||||
var mockDecryptedPassword: String?
|
||||
|
||||
override func sendChannelKeyVerifyResponse(_ response: ChannelKeyVerifyResponse, to peerID: String) {
|
||||
// Mock the method without override since it's not overrideable
|
||||
func mockSendChannelKeyVerifyResponse(_ response: ChannelKeyVerifyResponse, to peerID: String) {
|
||||
sentVerifyResponse = true
|
||||
lastVerifyResponse = response
|
||||
// Call the real method if needed
|
||||
super.sendChannelKeyVerifyResponse(response, to: peerID)
|
||||
}
|
||||
|
||||
override func getNoiseService() -> NoiseEncryptionService {
|
||||
|
||||
Reference in New Issue
Block a user