IOTA Masked Authenticated Messaging makes it possible for sensors and other devices to encrypt entire data streams and securely anchor those into the IOTA Tangle in a quantum proof fashion. Only authorized parties will be able to read and reconstruct the entire data stream. In essence it works a lot like a radio where only those with the right frequency can listen in, in MAM only those with the right channel IDs get access to the data. More information about MAM can be read on IOTA development roadmap.
First, update your RuuviTags to the hackathon firmware with your phone. The full firmware contains complete hex package, you can use it if you want to have a connection to RuuviTag with developer shield. Instructions on how to upload the firmware can be found on DFU page.
We have made a NodeJS program which listens to incoming Bluetooth advertisements and tries to automatically connect to anything which has Nordic UART service available. The connection sometimes fails, and if there is an exception while program is running you might have to restart your bluetooth stack using sudo hciconfig hci0 restart. The program is tested both on Debian and Raspberry Pi running Rasbian.
RuuviTag starts advertising itself on boot and keeps advertising until a BLE connection is made. Program will send a predefined data packet when command is given through command line interface. RuuviTag parses this package and replies with plaintext package with message "INIT MAM". After a few seconds the MAM encryption is complete on RuuviTags side and and the message is split into chunks which will be sent to connected device. You can follow the progress of the program by checking the RED LED: Led is on when there is activity on RuuviTag. You'll see that LED is on for a few seconds while message is being processed and then led starts blinking while message is transmitted in chunks.
Once transmission is complete, RuuviTag goes back to sleep to conserve power. You can disconnect and reconnect later on to your RuuviTag and send "4" again to get another MAM message. You can check the messages in the iotasearch service.
The demonstration allows you to store environmental data into IOTA Tangle, protected with MAM. If you have an use case in your mind we'll be happy to help you to implement any additional features you'll require on RuuviTag.
How did you use the MAM protocol? We're sure others would love to know!
Ruuvi Innovations Ltd (Oy) / FinlandWeb Design Niku Creative