pub struct PairVerifyClient { /* private fields */ }Expand description
Drives the controller side of HomeKit Pair Verify (M1–M4).
Construct with new, call
start to obtain the M1 payload, then feed each
accessory response to handle and transmit the
PairVerifyStep::Send payload it yields, until
PairVerifyStep::Done returns the SessionKeys.
Implementations§
Source§impl PairVerifyClient
impl PairVerifyClient
Sourcepub fn new(controller: &ControllerKeypair, accessory: &AccessoryPairing) -> Self
pub fn new(controller: &ControllerKeypair, accessory: &AccessoryPairing) -> Self
Create a client that verifies against accessory using controller’s
long-term identity. A fresh random ephemeral X25519 keypair is generated.
Sourcepub fn new_with_ephemeral(
controller: &ControllerKeypair,
accessory: &AccessoryPairing,
ephemeral_secret: [u8; 32],
) -> Self
pub fn new_with_ephemeral( controller: &ControllerKeypair, accessory: &AccessoryPairing, ephemeral_secret: [u8; 32], ) -> Self
Test/replay constructor that injects a fixed ephemeral X25519 secret so a captured trace can be reproduced deterministically.
Production code calls PairVerifyClient::new, which generates a fresh
random ephemeral keypair. Mirrors PairSetupClient::new_with_private.
Sourcepub fn start(&mut self) -> Vec<u8> ⓘ
pub fn start(&mut self) -> Vec<u8> ⓘ
Produce the M1 payload (State=1, PublicKey) and advance the state
machine to await M2.
Sourcepub fn handle(&mut self, response: &[u8]) -> Result<PairVerifyStep>
pub fn handle(&mut self, response: &[u8]) -> Result<PairVerifyStep>
Feed the accessory’s next response. Returns PairVerifyStep::Send with
the M3 payload after consuming M2, then PairVerifyStep::Done with the
SessionKeys after consuming M4.
§Errors
Returns a CryptoError if handle is called before
start or after completion, if the accessory
response is malformed or carries an error code, if M2 decryption or the
accessory’s Ed25519 signature fails to verify, or if the accessory’s
identifier does not match the stored pairing.
Sourcepub fn broadcast_key(&self, controller_ltpk: &[u8]) -> Result<BroadcastKey>
pub fn broadcast_key(&self, controller_ltpk: &[u8]) -> Result<BroadcastKey>
Derive the HAP-BLE broadcast-notification key after Pair Verify completes:
HKDF-SHA512 over the Pair-Verify shared secret (ikm), salted with the
controller’s long-term public key (LTPK), info "Broadcast-Encryption-Key".
Call after PairVerifyStep::Done.
§Errors
CryptoError if called before the shared secret is established (i.e.
before Pair Verify reached M2), or on HKDF failure.