Skip to content
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: add method to resolve random addresses #2400

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

ssievert42
Copy link
Contributor

This adds a method NRF.resolveAddress(), that allows resolving a "random private resolvable address" of a bonded peer to that peer's actual address.

Sadly the peer manager function that is needed for this, pm_address_resolve(), only exists in nrf sdk v14.1 and above, and thus the only device that currently supports this is Bangle.js 2.

My usecase is whitelisting my smartphone on Bangle.js 2, which works nicely after modifying both the settings and bootloader apps to use this method.

@gfwilliams
Copy link
Member

It's odd that pm_address_resolve just calls im_address_resolve, and that exists on SDK12, so maybe we could use that?

This looks really good though - it'd make whitelist a lot better

This adds a method NRF.resolveAddress(), that allows resolving a "random private resolvable address" of a bonded peer to that peer's actual address.
@ssievert42
Copy link
Contributor Author

Using im_address_resolve seems to work, at least on Bangle.js 2 👍

Add useful example code
@gfwilliams
Copy link
Member

Looks great, thanks! Works on SDK12 too. Just added a useful code example.

If you're able to contribute the Bangle.js whitelist code you have (if it can be backwards compatible to builds without this function) that'd be awesome.

However I realise that the Nordic SDK does have some whitelist code internally that we're not using, so I guess potentially it makes more sense to enable the use of that from Bangle.js rather than the slightly hacky solution at the moment?

@gfwilliams gfwilliams merged commit 704daa5 into espruino:master Aug 15, 2023
15 checks passed
@gfwilliams
Copy link
Member

Just a heads-up that I added NRF.on('passkey', ...) as it seems it was missing - this allows us to display a passkey on the screen that then has to be entered on the connecting device

@ssievert42
Copy link
Contributor Author

If you're able to contribute the Bangle.js whitelist code you have (if it can be backwards compatible to builds without this function) that'd be awesome.

Alright, I'll do that in a moment 👍

However I realise that the Nordic SDK does have some whitelist code internally that we're not using, so I guess potentially it makes more sense to enable the use of that from Bangle.js rather than the slightly hacky solution at the moment?

Yup, I think so too! Although that would (if I'm not looking at the wrong code) limit us to 8 (see BLE_GAP_WHITELIST_ADDR_MAX_COUNT) peers and, most importantly, the hacky js only solution seems to work correctly. So 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants