All communication between the different Egendata parties is performed through signed messages shaped as JWT:s.
The following messages are required to establish a service as registered:
SERVICE_REGISTRATION
sends a message containing the information describing the service.LAWFUL_BASIS
contains information about the reason the service requires to read the data from the user.PERMISSION_BASE
contains information about the reason the service will request permission to the different areas of the user’s profile.When a user is registering the following information is being generated and sent to the operator:
ACCOUNT_REGISTRATION
the user’s device generates a unique id and sends it, as part of the message, to the operator, who prefixes it to the account.In this step we need to consider if the user has an already established connection or not with the service they are trying to log in to. In both cases the process starts by scanning the QR code of the service with the user’s device. After the QR code is scanned and until the following steps are completed the browser that housed the QR code starts polling the Operator for an ACCESS_TOKEN
.
In this case, the user’s device recognizes that there is an existing connection with this service stored in the App’s internal cache and the following messages are triggered:
LOGIN_RESPONSE
containing a serialized JWS LOGIN
as payload is sent to the operator. This LOGIN_RESPONSE
contains the user’s ID as the subject(iss?), and the service as a string in the body(within the LOGIN
).LOGIN
from the LOGIN_RESPONSE
a wraps it in a new LOGIN_EVENT
message and forwards the message to the service. This happens so the service doesn’t get access to the user’s ID.If this user’s device does not recognize the service then the following messages are triggered:
CONNECTION_INIT
is sent from the user’s device directly to the service’s /events
endpoint.CONNECTION_REQUEST
to the user’s device.CONNECTION_REQUEST
might optionally contain a PERMISSION_REQUEST_ARRAY
detailing all the areas it is requesting access from the user’s profile.PERMISSION_REQUEST_ARRAY
is missing, at the moment, there is no way to send this in a later stage in the communication. There is no error handling for this eventuality and it will result in the system not working, because it will find a null string where it is expecting a not null string.PERMISSION_REQUEST
in the PERMISSION_REQUEST_ARRAY
contains a LAWFUL_BASIS
. In the current implementation this is defaulted to consent unless specified otherwise.kid
(key id).CONNECTION_REQUEST
the device generates a CONNECTION
wrapped in a CONNECTION_RESPONSE
that is sent to the operator.CONNECTION_RESPONSE
extracts from it the CONNECTION
and rewraps it in a CONNECTION_EVENT
that is sent to the service.The keys for these connections (not the CEKs, those only exist within each document they encrypt and only in an encrypted state) are stored in the cache memory of the user’s device. If the cache is cleaned or the phone lost these connections cannot be recovered, since the keys cannot be recovered or recreated and the data cannot be decrypted. There is a connection entry in the operator for each connection made for each user, but the private keys are only stored in the device and thus irreplaceable.
There are several ways of revoking consent to an area of the PDS
A way of revoking consent is by deleting the data stored for that area in the domain’s storage in the user’s PDS. This however leads to complete and irreversible data loss.
The way this is accomplished is by replacing the CEK the data for the specific are has been encrypted with. 1. The data is decrypted. 1. A new CEK is generated. 1. The data us encrypted with teh new CEK. 1. The new CEK is encrypted only with the user’s public key for this domain+area and stored in the encrypted document. 1. the connection ID in the operator is destroyed.
Currently there is no implementation for the application to unpack a JWE. There exists a library for RSA and AES but no full JOSE implementation or native JOSE implementation.
DATA_READ_REQUEST
.
DATA_READ_REQUEST
message, this however has not been implemented.DATA_READ_REQUEST
the service includes the connection id that it wants the data to come from.
DATA_READ_REQUEST
the operator will verify that
DATA_READ_RESPONSE
.Currently only Dropbox is supported as a PDS. It is, however, called through an abstraction which treats it as fs
. This means that as long as another PDS can be called through the same abstraction, it is simple to implement.
DATA_READ_RESPONSE
message for each path requested. This means that for each domain and area path that has been requested the data stored in that folder is sent to the service separately.DATA_WRITE
message, from the service to the operator.It should be noted here that is should not be assumed that the user is not the owner of the data stored in their PDS. Ownership implies that the data can be altered, which is not the case for many peaces of data (i.e. tax agency information, police and criminal records). The user is the controller of their own data. This implies that they have control over who has access to their data.