-
-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ble: allow configuring device privacy (v2) #2506
Conversation
About Maybe I missed something, which is kind of likely, considering the absolutely gigantic size of the SDK, and me being relatively unfamiliar with it, but I'm just gonna leave |
9a35de9
to
e403b98
Compare
I did some testing and everything seems to be ok:
Weirdly enough the watch keeps using a random address when doing a clean boot, but it also still requires a passkey to pair, so I guess this doesn't introduce that behavior. |
I plan on writing an app to set this up, along with configuring a private random address using the |
@bobrippling You're welcome :) I've been mulling about adding a shorthand for:
Maybe |
e403b98
to
9d1aa16
Compare
Yeah that's a much better idea, more likely to be found by users rather than stashed in an app too.
I like the sound of |
This allows using a random private resolvable address to prevent being tracked. Currently only enabled on Bangle.js 2.
9d1aa16
to
0eb7d73
Compare
I've changed it to allow either undefined, a bool, something numeric that is then converted to a bool with If that bool is true, we're now using (hopefully sensible) defaults of:
|
This looks great, thanks! I've just tweaked the docs a little bit, but merging now. It's a shame about not adding to non-Bangle.js2 devices, but it's a constant stuggle to fit stuff in the available flash so it seems best to leave this out as you have unless it's something others are requesting a lot.
This is interesting as a softdevice restart isn't always required when we do a non-fastload transition - it's probably kicked off by the setServices call. For instance https://github.com/espruino/Espruino/blob/master/libs/bluetooth/jswrap_bluetooth.c#L1510 It might be worth investigating as it's possible we can be a bit more careful about under what circumstances we do a restart (right now we don't restart if ANCS is enabled and we request it again, but we do always restart if HID is used). It'd not only fix your problem but would really speed up app transitions too. |
This is great, thank you! |
This allows using a random private resolvable address to prevent being tracked.
Currently only enabled on Bangle.js 2.
NRF.setSecurity()
now accepts an additional optionprivacy
that is either a bool or looks like this:Example usage:
Short version (that basically does the same thing):
And
NRF.getSecurityStatus()
also returns the current privacy config.There's some more info in the docs for
NRF.setSecurity()
.One thing that (currently) cannot be configured is our IRK. Should be possible to add this as well, but I'd rather not do that, because that would complicate things a bit.
Something I don't really like is, that the random address does not only change every 15 minutes, but also every time the softdevice restarts, which happens every time there is a non-fastload transition between apps. But I guess this isn't really avoidable.
The initial setup with Gadgetbridge can be kind of weird and create a bunch of devices that don't actually exist, but everything works without (noticable) issues after that.
Note that this alone probably is not enough to avoid being trackable, because a unique-enough device name, like "Bangle.js ffff", might still be enough for a device to be identified. A workaround may be to change the bootloader to call
NRF.setAdvertising({}, {showName: false});
, but this has to be turned off for pairing with Gadgetbridge to work.Because builds like to fail when adding something that uses more flash, I put this feature behind a flag that I called
ESPR_BLE_PRIVATE_ADDRESS_SUPPORT
, that is currently only present on Bangle.js 2.This is my second attempt at making a PR for this; the first one is here.
The main difference is, that the first PR introduced new methods for setting and getting the privacy config, while this PR integrates the privacy options into
NRF.setSecurity()
andNRF.getSecurityStatus()
.I didn't touch
NRF.getAddress()
- that method still returns the real address while a private one is in use.Feedback is very much appreciated :)