for me it was enough to have this code to disconnect unknown devices and learn new ones when holding button as per "Disconnect when an unknown address is found (whitelisting)" chapter in that guide
NRF.whitelist=[];
NRF.on('connect',function(addr) {
if (!NRF.whitelist.includes(addr)){
if (BTN1.read()){ // add to whitelist when button is held while connecting
NRF.whitelist.push(addr);
//vibrate(1,1,100,0);
} else
NRF.disconnect();
}
});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
https://www.espruino.com/BLE+Security
for me it was enough to have this code to disconnect unknown devices and learn new ones when holding button as per "Disconnect when an unknown address is found (whitelisting)" chapter in that guide