Skip to content

Commit

Permalink
0.6.16
Browse files Browse the repository at this point in the history
πŸ˜€
Hopefully a even Better Beta Release Version:
Fix merge issue for state.py

0.6.15
πŸ˜€
Better Beta Release Version:
Improved support for multiple advertising of IPs:

(see new image AdvancedOptions.png)
Homekit Server Options: Advertised Interfaces:  (in my example)
::1 = (IVP6 localhost)
192.168.1.6 = (Ethernet interface)
192.168.1.92 = (Wifi interface)
&
Homekit Server: IP address
IVP4 IP interface that server is running on
192.168.1.6 = (Ethernet interface)

0.6.14
Beta release version:
Use  byte/binary data for UUIDs as it appears apple changing from Lowercase to Uppercase at times.  This bypasses this issue now and into the future.
Allow multiple network stacks for mDNS ivp4 and ivp6 con-currently.
Currently defaults to network internet default interface only, but manually can enter ivp4 and ivp6 addresses in HomeKit Server advanced settings.  Beware if incorrect network settings fail without error messaging.

0.6.9
Bug fix for 0.6.8 missing pair_five binary conversion

0.6.8
Update HomeKit library to use binary blob for pairing data, to avoid any UUID formatting changes

0.6.7
Update Python ZeroConf to 0.63
Change pair verify error messaging to be clearer
Update installs to use v4only mdns on first run
  • Loading branch information
Ghawken committed Jun 16, 2023
1 parent 9e37224 commit 5f11ba4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion HomeKitLink-Siri.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.6.15</string>
<string>0.6.16</string>
<key>ServerApiVersion</key>
<string>3.2</string>
<key>IwsApiVersion</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Module for `State` class."""
from typing import Dict
from uuid import UUID
from typing import List, Optional, Union

from cryptography.hazmat.primitives.asymmetric import ed25519
Expand Down Expand Up @@ -41,7 +43,6 @@ def __init__(
self.addresses = address
else:
self.addresses = [util.get_local_address()]

self.mac = mac or util.generate_mac()
self.pincode = pincode or util.generate_pincode()
self.port = port or DEFAULT_PORT
Expand All @@ -53,6 +54,7 @@ def __init__(

self.private_key = ed25519.Ed25519PrivateKey.generate()
self.public_key = self.private_key.public_key()
self.uuid_to_bytes: Dict[UUID, bytes] = {}
self.accessories_hash = None

@property
Expand All @@ -62,37 +64,43 @@ def address(self) -> str:

# ### Pairing ###
@property
def paired(self):
def paired(self) -> bool:
"""Return if main accessory is currently paired."""
return len(self.paired_clients) > 0

def is_admin(self, client_uuid):
def is_admin(self, client_uuid: UUID) -> bool:
"""Check if a paired client is an admin."""
if client_uuid not in self.client_properties:
return False
return bool(self.client_properties[client_uuid][CLIENT_PROP_PERMS] & ADMIN_BIT)

def add_paired_client(self, client_uuid, client_public, perms):
def add_paired_client(
self, client_username_bytes: bytes, client_public: bytes, perms: bytes
) -> None:
"""Add a given client to dictionary of paired clients.
:param client_uuid: The client's UUID.
:type client_uuid: uuid.UUID
:param client_username_bytes: The client's user id bytes.
:type client_username_bytes: bytes
:param client_public: The client's public key
(not the session public key).
:type client_public: bytes
"""
client_username_str = client_username_bytes.decode("utf-8")
client_uuid = UUID(client_username_str)
self.uuid_to_bytes[client_uuid] = client_username_bytes
self.paired_clients[client_uuid] = client_public
self.client_properties[client_uuid] = {CLIENT_PROP_PERMS: ord(perms)}

def remove_paired_client(self, client_uuid):
def remove_paired_client(self, client_uuid: UUID) -> None:
"""Remove a given client from dictionary of paired clients.
:param client_uuid: The client's UUID.
:type client_uuid: uuid.UUID
"""
self.paired_clients.pop(client_uuid)
self.client_properties.pop(client_uuid)
self.uuid_to_bytes.pop(client_uuid, None)

# All pairings must be removed when the last admin is removed
if not any(self.is_admin(client_uuid) for client_uuid in self.paired_clients):
Expand Down

0 comments on commit 5f11ba4

Please sign in to comment.