Add more tests for AirPods data decryption

This commit adds a test case to `AirPodsProTest` to verify the decryption of AirPods Pro data with and without encryption/IRK keys. It also introduces a new test class `RPACheckerTest` to validate the RPA checking mechanism.

Helper functions for converting hex strings to byte arrays and setting mock keys have been added to `BaseAirPodsTest` to simplify test setup.
This commit is contained in:
darken
2025-06-06 06:03:41 +02:00
committed by Matthias Urhahn
parent 3b00613dde
commit eda81822aa
5 changed files with 85 additions and 34 deletions
@@ -58,10 +58,10 @@ class AppleFactory @Inject constructor(
suspend fun create(scanResult: BleScanResult): PodDevice? = lock.withLock {
val proximityMessage = getMessage(scanResult) ?: return@withLock null
val payload = getPayload(scanResult, proximityMessage)
val factory = podFactories.firstOrNull { it.isResponsible(proximityMessage) }
val payload = getPayload(scanResult, proximityMessage)
return@withLock (factory ?: unknownAppleFactory).create(
scanResult = scanResult,
@@ -42,7 +42,6 @@ data class AirPodsGen1(
getModelInfo().full == DEVICE_CODE && length == ProximityPairing.PAIRING_MESSAGE_LENGTH
}
override fun create(
scanResult: BleScanResult,
payload: ProximityPayload