Pair with devices that are not connected
Pairing was added in version 0.8.0. It still requires connect to be called first, due to that the OS native device communication objects being created in the connect methods (setting of the self._requester attributes). One could refactor this so that pair and unpair could be called on unconnected BleakClients as well.
Since pairing requires communicating with the remote device, I don't see how pairing could be done without connecting first.
The BlueZ D-Bus API docs for "Pair" says:
This method will connect to the remote device, initiate pairing and then retrieve all SDP records (or GATT primary services).
And the Windows API doesn't really have a notion of being "connected", so it seems like it should be possible to pair without an active gatt session.
macOS doesn't allow explicit pairing, but rather prompts for it automatically the first time you try to access a characteristic that requires authentication.
The Android API doesn't say one way or the other. https://developer.android.com/reference/android/bluetooth/BluetoothDevice#createBond()
And the Windows API doesn't really have a notion of being "connected", so it seems like it should be possible to pair without an active gatt session.
This is correct at least for BlueZ, tested with https://github.com/hbldh/bleak/pull/1133/commits/dd50aa66730f80e95ca43acd69b2e7a9f2e67043#diff-dca4aa1d374b221291b543a5d1296bbf912b43d1e2ebc51ed11c1eb153fbb89bR193-R196