Firefox/Kinto: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Mention Lockbox)
(Remove decommissioned use-cases)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Kinto Integration in Firefox =
= Kinto Integration in Firefox =


[http://www.kinto-storage.org Kinto] is a simple JSON storage service that was integrated into Firefox, mainly for RemoteSettings and the <code>storage.sync</code> API.
[http://www.kinto-storage.org Kinto] is a simple JSON storage service that was integrated into Firefox, and currently used for RemoteSettings.


= Key features =
= Key features =
Line 24: Line 24:
|Mathieu Leplatre — :leplatrem
|Mathieu Leplatre — :leplatrem
|-
|-
|<code>storage.sync</code>
|[[WebExtensions]] API for user data storage. Every users have their own bucket (''default bucket'' plugin), the allowed amount of data is limited (''quotas'' plugin), and the data is encrypted using Firefox Accounts keys. See also [[CloudServices/Sync/ExtensionStorage_Design_Doc]]
|Ethan Glasser Camp — :glasserc
|-
|Test Pilot
|Some experiments (like Notes) require user data to be saved remotely and synchronized across devices. A Kinto server was deployed with Firefox Accounts login support, and kinto.js library is used to encrypt and sync data.
|Vlad Filippov — :vladikoff
|-
|Lockbox
|Synchronize on device datastore with remote
|https://lockbox.firefox.com
|}
|}


See also [https://www.servicedenuages.fr/en/kinto-at-mozilla Kinto at Mozilla]  
It used be supporting more use-cases in the past. See also [https://github.com/mozilla-services/servicedenuages.fr/blob/master/content/2017.12.kinto-at-mozilla.rst Kinto at Mozilla]  
 
Feel free to come and discuss on <code>#storage</code> :)


= Usage =
= Usage =
Line 83: Line 70:
= Resources =
= Resources =


* [https://www.servicedenuages.fr/en/kinto-at-mozilla Kinto at Mozilla] (blog post)
* [https://remote-settings.readthedocs.io Remote Settings docs]
* [https://blog.mathieu-leplatre.info/the-history-of-firefox-remote-settings.html The History of Remote Settings]
* [https://github.com/mozilla-services/servicedenuages.fr/blob/master/content/2017.12.kinto-at-mozilla.rst Kinto at Mozilla] (blog post) -- see also [https://web.archive.org/web/20180111085958/https://www.servicedenuages.fr/en/kinto-at-mozilla the published version, no longer available at its initial location]


= Contribute =
= Contribute =

Latest revision as of 09:58, 19 February 2021

Kinto Integration in Firefox

Kinto is a simple JSON storage service that was integrated into Firefox, and currently used for RemoteSettings.

Key features

  • Diff-based data synchronization
  • Offline persistence
  • Data integrity/signing
  • Peer review to publish data changes
  • Admin panel UI
  • Built-in Telemetry
  • Firefox Accounts Integration

Use Cases

Component Description Contact
RemoteSettings Firefox/RemoteSettings allows to ship data and files to Firefox. It is used for blocklists, security state, Activity Stream, Fennec assets and experiments etc. Mathieu Leplatre — :leplatrem

It used be supporting more use-cases in the past. See also Kinto at Mozilla

Usage

Two client libraries are vendored in Firefox:

HTTP client

const { KintoHttpClient } = Cu.import("resource://services-common/kinto-http-client.js", {});

const remote = "https://kinto.dev.mozaws.net/v1";
const headers = { Authorization: "Basic " + btoa("user:pass") };

const client = new KintoHttpClient(remote, {headers});
const records = await client.bucket("a-bucket")
                            .collection("a-collection")
                            .listRecords();

Offline client

const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js", {});

const remote = "https://kinto.dev.mozaws.net/v1";
const headers = { Authorization: "Basic " + btoa("user:pass") };

const kinto = new Kinto();
const bucket = "a-bucket";
const collection = kinto.collection("a-collection");

// Fetch/Publish changes.
const { ok } = await collection.sync({ bucket, remote, headers });

// Read local collection of records.
const records = await collection.list();

Resources

Contribute

Generate bundles

The Kinto client libraries are developed independently on Github:

  • kinto-http is the HTTP client for the Kinto REST API;
  • kinto.js is the offline-first client for Kinto.

With the help of Babel and browserify, a bundle is generated for Firefox with the minimum transpilation possible (eg. CommonJS require, ES7 decorators).

kinto.js

From the kinto.js repo, generate the moz-kinto-offline-client.js file:

$ npm run dist-fx

And overwrite it in the Firefox code base:

$ cp dist/moz-kinto-offline-client.js ../mozilla-central/services/common/kinto-offline-client.js

kinto-http.js

From the kinto-http.js repo, generate the moz-kinto-http-client.js file:

$ npm run dist-fx

And overwrite it in the Firefox code base:

$ cp dist/moz-kinto-http-client.js ../mozilla-central/services/common/kinto-http-client.js