mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-16 11:16:12 -04:00
Extend tests and fix payload parsing
This commit enhances the test coverage for `AirPodsProTest` by: - Verifying the hex representation of the public payload data. - Confirming that the private payload is null when no IRK/EncKey is set. - Verifying the hex representation of the private payload data when IRK/EncKey are set. Additionally, a fix is introduced in `AppleFactory.kt` to correctly parse the public payload by taking only the first 9 bytes instead of 16. This ensures that the private payload is only processed if the incoming message length matches the expected `PAIRING_MESSAGE_LENGTH`.
This commit is contained in:
@@ -65,10 +65,11 @@ class AppleFactory @Inject constructor(
|
||||
|
||||
val payload = ProximityPayload(
|
||||
public = ProximityPayload.Public(
|
||||
proximityMessage.data.take(16).toUByteArray()
|
||||
proximityMessage.data.take(9).toUByteArray()
|
||||
),
|
||||
private = run {
|
||||
if (!isIrkMatch) return@run null
|
||||
if (proximityMessage.data.size != ProximityPairing.PAIRING_MESSAGE_LENGTH) return@run null
|
||||
|
||||
val encKey = generalSettings.mainDeviceEncryptionKey.value
|
||||
if (encKey == null) return@run null
|
||||
|
||||
Reference in New Issue
Block a user