-
Notifications
You must be signed in to change notification settings - Fork 5
Store
Antonio Calatrava edited this page Oct 19, 2020
·
6 revisions
The store is an encrypted data store where we can store JSON data.
We can store application-specific settings (for instance, for local clients).
Contact information could also be stored in the store.
DB on client
"contacts" ==> collection
1 ==> "address: jaytaph!, full name: Joshua Thijssen..... ",
2 ==> "address: acalatrava!, full name: Antonio Calatrava..... ",
"foo" ==> collection
"bar" ==> collection
"config" ==> jsonblob of config
And the client will keep a keys
store with the checksums of all the data
"keys" ==> collection
"/contacts/1" ==> modification timestamp
"/contacts/2" ==> modification timestamp
"/foo/bar/config" ==> > modification timestamp
On the first connection to the server, and in order to keep the data in sync with the server (and other clients) the client will send a GET
request to get the metadata of the DB stored on the server
GET /store?since=timestamp
[
sha256("/contacts/1"),
sha256("/contacts/2"),
sha256("/foo/bar/config"),
]
The client will download the updated data or push the new data on the client
GET /store/sha256("/contacts/1"))
{
timestamp: timestamp,
data: blob (which is aes_encrypt("address: jaytaph!, full name: Joshua Thijssen..... "))
}
PUT /store/sha256("/contacts/1"))
{
timestamp: timestamp,
data: blob (which is aes_encrypt("address: jaytaph!, full name: Joshua Thijssen..... "))
}