dont specify host port
This commit is contained in:
parent
7a49efe6f6
commit
72525381c9
|
@ -50,9 +50,6 @@ impl AccessorySocket {
|
|||
socket.set_linger(Some(Duration::from_secs(10)))?;
|
||||
|
||||
let address: SocketAddr = format!("{ip}:{port}").parse()?;
|
||||
let host: SocketAddr = "192.168.50.187:12345".parse()?;
|
||||
|
||||
socket.bind(&host.into())?;
|
||||
socket.connect(&address.into())?;
|
||||
|
||||
Ok(Self {
|
||||
|
@ -199,11 +196,10 @@ impl AccessorySocket {
|
|||
|
||||
let mut buf = [0; 1024];
|
||||
|
||||
log::info!("about to read");
|
||||
let mut read_num = self.socket.read(&mut buf)?;
|
||||
|
||||
log::info!("read {read_num} bytes");
|
||||
while read_num == 0 {
|
||||
log::info!("read 0 bytes - about to reconnect");
|
||||
std::thread::sleep(std::time::Duration::from_millis(200));
|
||||
self.socket.flush()?;
|
||||
|
||||
|
@ -222,7 +218,6 @@ impl AccessorySocket {
|
|||
self.socket.flush()?;
|
||||
|
||||
read_num = self.socket.read(&mut buf)?;
|
||||
log::info!("read {read_num} bytes");
|
||||
}
|
||||
|
||||
let mut headers = [httparse::EMPTY_HEADER; 4];
|
||||
|
|
|
@ -147,14 +147,11 @@ impl DevicePairingData {
|
|||
buf
|
||||
};
|
||||
// 8. Use Ed25519 togenerate iOSDeviceSignature by signing iOSDeviceInfo with its long-term secret key, iOSDeviceLTSK
|
||||
let mut keypair = self.ios_device_ltsk.to_vec();
|
||||
keypair.extend_from_slice(&self.ios_device_ltpk);
|
||||
let signing_key = ed25519_dalek::SigningKey::from_keypair_bytes(&keypair.try_into()?)?;
|
||||
let signing_key = ed25519_dalek::SigningKey::from_bytes(&self.ios_device_ltsk);
|
||||
let signature = signing_key.sign(&ios_device_info);
|
||||
|
||||
// 9. Construct sub-TLV
|
||||
let mut encrypted_tlv = //tlv8::encode(&);
|
||||
([
|
||||
let mut encrypted_tlv = ([
|
||||
(
|
||||
TlvType::Identifier.into(),
|
||||
self.ios_pairing_id.encode_value(),
|
||||
|
@ -163,7 +160,8 @@ impl DevicePairingData {
|
|||
TlvType::Signature.into(),
|
||||
(&signature.to_bytes()).encode_value(),
|
||||
),
|
||||
]).encode();
|
||||
])
|
||||
.encode();
|
||||
|
||||
// 10. Encrypt sub-TLV: encryptedData, authTag = ChaCha20-Poly1305(SessionKey, Nonce=”PV-Msg03”, AAD=<none>, Msg=<Sub-TLV>)
|
||||
let nonce: [u8; 12] = [0; 4]
|
||||
|
|
Loading…
Reference in a new issue