- This flow builds upon the the contracts explained and coded in the IOT-Contracts repo.
- Credential Issuer (
CI
) - Entity that emits signed credentials that allow citizens to configure their IoT devices to share data with others participating in the DECODE ecosystem. It controls the Credential Issuer API already developed and explained in CREDENTIAL ISSUING NOTES. - Administrator (
CA
) - Entity that works with community groups in order to define policies that control how participating citizen's device data should be processed and encrypted. This entity is responsible for making various calls to API endpoints to create new communities - Dashboard (Verifier) (
VE
)- The dashboard being operated by Eurecat is an entity that provides a dashboard that allows verified users to view data collected for a community. In reference to the Coconut authentication protocol this entity must be able to verify a blind credential provided by a Citizen and be able to grant or deny access to private resources based on this verification. - Citizen (
CIT
) - a citizen taking part in the IoT pilot for DECODE, who has installed theDecode App
and will receive an IoT device and take part in the workshops. - Iot Device Manager (
IOT-DM
) - An entity who manages the underlying infrastructure to which the distributed IoT devices connect and submit data. In addition they manage user onboarding via an existing onboarding application which is the point of entry for a citizen (CIT
) to become part of the DECODE IoT pilot. Finally this entity also currently is responsible for providing the infrastructure on which the server components for the IoT pilot are running.
POLICYSTORE
- server running on infrastructure managed byIOT-DM
. Provides read/write API for community policy definitions. Makes calls to theDASHBOARD
to register new community dashboards on creationENCODER
- server running on infrastructure managed byIOT-DM
that is able to subscribe to the MQTT broker operated byIOT-DM
and create encrypted streams of data which are then written to theDATASTORE
DATASTORE
- server that provides a data storage layer for encrypted events emitted by theENCODER
that runs on infrastructure managed byIOT-DM
.DASHBOARD
- service operated by theVE
that stores decrypted events read from theDATASTORE
, and is able to participate in the Coconut authentication flow to grant or deny access to private dashboards to citizens that are able to present a valid blind credential.CREDENTIAL_ISSUER
- service that is required for generating credentials and then verifying them.ONBOARDING_APP
- a service created by theIOT-DM
that allows users to configure their physical device to connect to their home network and collects information from the user on the location and exposure of the device.
-
Community creation - the setup and registration of available communities by the
CA
-
Device onboarding - new citizens (
CIT
) adding the devices to DECODE, and initializing theirDecode App
with the details of these devices -
Data collection - citizens choose communities to belong to which starts data being collected in encrypted form for that community
-
User authentication - citizen uses Coconut to securely prove their right to access a community
CA
works with a community group in order to define a policy for the community containing a set of operations that the community wishes to apply to participating devices.CA
executes the setup steps defined in the CREDENTIAL ISSUING NOTES to create a newAUTHORIZABLE ATTRIBUTE
for which credentials can be created. This call provides theCA
with an$authorizable_attribute_id
and$credential_issuer_endpoint_url
.CA
creates a$community_creation_request
including a$community_definition
along with the obtained$authorizable_attribute_id
and$credential_issuer_endpoint_url
.CA
sends this$community_creation_request
via a POST request to the$policystore_create_community
endpoint.- The
POLICYSTORE
sends a POST request to the$dashboard_api_create_encrypted_dashboard
endpoint which causes theDASHBOARD
service to create a new dashboard with associated keypair, and returns the$community_public_key
to thePOLICYSTORE
. - The
POLICYSTORE
saves this information after which point the community has been created and is ready for citizens to participate in.
-
CIT
is guided to install theDecode App
during the course of a workshop. -
CIT
uses theONBOARDING_APP
in order to configure their physical device and supplies some information on the location and exposure of the device. -
ONBOARDING_APP
shows a page which allows theCIT
to add their device to DECODE. This page shows a QR code (with corresponding short form URL) which encodes the following properties:$device_token
,$device_location
, and$device_exposure
-
CIT
uses theirDecode App
to scan the QR code (or manually enters the URL in their browser), which captures this information into theDecode App
. -
The
Decode App
presents a UI to the user which is the mechanism by which they will be able to add their device to DECODE. -
The
Decode App
sends a POST request to the$policystore_list_policies
endpoint which returns a list of all available community policies. -
The
Decode App
presents a UI which shows this list of available community policies. -
CIT
chooses which community they wish to join, so then theDecode App
executes the credential issuing steps defined in the Credential Issuing document to create a blind credential for the specified$authorizable_attribute_id
. -
The
Decode App
then sends a POST request to the$encoder_create_stream
endpoint which creates a new stream for the specified device. This new stream causes encrypted data to be written to the encrypted datastore via the$encrypted_datastore_write
endpoint
- The
DASHBOARD
is able to start requesting encrypted events as soon as a new dashboard has been registered by sending a POST request to the$read_encrypted_events
endpoint on theDATASTORE
. - This endpoint will initially return no events, but as soon as a
CIT
has chosen to add their device to a community, then encrypted events will start to appear in this dataset. - The
DASHBOARD
will use Zenroom to decrypt the events as they have the corresponding private key for the community, and these unencrypted events will be stored in theDASHBOARD's
time series datastore
-
A
CIT
wishes to view the communities dataset via theDASHBOARD
, so they open theDASHBOARD
url and attempt to open the specified dashboard. -
The
DASHBOARD
knows the requested dashboard is protected so rather than showing to theCIT
it instead presents a login page containing a QR code (and a short form URL). This QR code encodes a login link which the wallet must be able to scan to initiate the Coconut blind credential login flow.
The link the dashboard should send to is: https://iot.decodeproject.eu/#/login?sessionId=abc123&callback=http://93ff8837.ngrok.io/oauth/iot_login_callback
See the QR handling notes for reference.
-
The
Decode App
after scanning the code (or entering the short form) displays a UI which prompts the user as to whether they wish to share their blind proof for the community with the dashboard. If the user agrees, the app creates a$login_request
containing their blind proof as well as some additional metadata back to theDASHBOARD's
login URL (TODO: document this method) -
The
DASHBOARD
parses the incoming$login_request
, and then sends a request to the$credential_issuer_endpoint_address
to obtain a public verification key for the specified$authorizable_attribute_id
. -
The
DASHBOARD
then executes the Coconut script to verify the blind credential, and if the credential is valid, creates a new session for theCIT
, i.e. logging them into the requested dashboard, and then redirects the user to that page.
Written by Sam Mulube [email protected] with minor revisions from Oleguer Sagarra [email protected]