mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
address PR comments
This commit is contained in:
@@ -1256,6 +1256,7 @@ class Central(Connection.Listener):
|
||||
self.device.classic_enabled = self.classic
|
||||
|
||||
# Set up a pairing config factory with minimal requirements.
|
||||
self.device.config.keystore = "JsonKeyStore"
|
||||
self.device.pairing_config_factory = lambda _: PairingConfig(
|
||||
sc=False, mitm=False, bonding=False
|
||||
)
|
||||
@@ -1408,6 +1409,7 @@ class Peripheral(Device.Listener, Connection.Listener):
|
||||
self.device.classic_enabled = self.classic
|
||||
|
||||
# Set up a pairing config factory with minimal requirements.
|
||||
self.device.config.keystore = "JsonKeyStore"
|
||||
self.device.pairing_config_factory = lambda _: PairingConfig(
|
||||
sc=False, mitm=False, bonding=False
|
||||
)
|
||||
|
||||
@@ -1589,7 +1589,6 @@ class Connection(utils.CompositeEventEmitter):
|
||||
encryption_key_size: int
|
||||
authenticated: bool
|
||||
sc: bool
|
||||
link_key: Optional[bytes] # [Classic only]
|
||||
link_key_type: Optional[int] # [Classic only]
|
||||
gatt_client: gatt_client.Client
|
||||
pairing_peer_io_capability: Optional[int]
|
||||
@@ -1630,7 +1629,6 @@ class Connection(utils.CompositeEventEmitter):
|
||||
EVENT_PAIRING = "pairing"
|
||||
EVENT_PAIRING_FAILURE = "pairing_failure"
|
||||
EVENT_SECURITY_REQUEST = "security_request"
|
||||
EVENT_LINK_KEY = "link_key"
|
||||
|
||||
@utils.composite_listener
|
||||
class Listener:
|
||||
@@ -1694,7 +1692,6 @@ class Connection(utils.CompositeEventEmitter):
|
||||
self.encryption_key_size = 0
|
||||
self.authenticated = False
|
||||
self.sc = False
|
||||
self.link_key = None
|
||||
self.link_key_type = None
|
||||
self.att_mtu = ATT_DEFAULT_MTU
|
||||
self.data_length = DEVICE_DEFAULT_DATA_LENGTH
|
||||
@@ -5072,15 +5069,6 @@ class Device(utils.CompositeEventEmitter):
|
||||
# [Classic only]
|
||||
@host_event_handler
|
||||
def on_link_key(self, bd_addr, link_key, key_type):
|
||||
authenticated = key_type in (
|
||||
hci.HCI_AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P_192_TYPE,
|
||||
hci.HCI_AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P_256_TYPE,
|
||||
)
|
||||
pairing_keys = PairingKeys()
|
||||
pairing_keys.link_key = PairingKeys.Key(
|
||||
value=link_key, authenticated=authenticated
|
||||
)
|
||||
|
||||
# Store the keys in the key store
|
||||
if self.keystore:
|
||||
authenticated = key_type in (
|
||||
@@ -5099,7 +5087,6 @@ class Device(utils.CompositeEventEmitter):
|
||||
if connection := self.find_connection_by_bd_addr(
|
||||
bd_addr, transport=PhysicalTransport.BR_EDR
|
||||
):
|
||||
connection.link_key = link_key
|
||||
connection.link_key_type = key_type
|
||||
connection.emit(connection.EVENT_LINK_KEY)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user