Debian Codegraph @

third_party/rust/tabs/README.md

raw
1 # Synced Tabs Component
2
3 ![status-img](https://img.shields.io/static/v1?label=not%20implemented&message=Firefox%20Preview,%20Desktop,%20iOS&color=darkred)
4
5 ## Implementation Overview
6
7 This crate implements an in-memory syncing engine for remote tabs.
8
9 ## Directory structure
10 The relevant directories are as follows:
11
12 - `src`: The meat of the library. This contains cross-platform rust code that
13 implements the syncing of tabs.
14 - `ffi`: The Rust public FFI bindings. This is a (memory-unsafe, by necessity)
15 API that is exposed to Kotlin and Swift. It leverages the `ffi_support` crate
16 to avoid many issues and make it more safe than it otherwise would be.
17 It uses protocol buffers for marshalling data over the FFI.
18 - `android`: This contains android bindings to synced tabs, written in Kotlin. These
19 use JNA to call into to the code in `ffi`.
20 - `ios`: This contains the iOS binding to synced tabs, written in Swift. These use
21 Swift's native support for calling code written in C to call into the code in
22 `ffi`.
23
24 ## Features
25 - Synchronization of the local and remote session states.
26
27 ## Business Logic
28
29 ### Storage
30
31 The storage is all done in memory for simplicity purposes. The host applications are free to persist the remote tabs list if it makes sense to them.
32
33 ### Payload format
34
35 Every remote sync record is roughly a list of tabs with their URL history (think of the back button). There is one record for each client.
36
37 ### Association with device IDs
38
39 Each remote tabs sync record is associated to a "client" using a `client_id` field, which is really a foreign-key to a `clients` collection record.
40 However, because we'd like to move away from the clients collection, which is why this crate associates these records with Firefox Accounts device ids.
41 Currently for platforms using the sync-manager provided in this repo, the `client_id` is really the Firefox Accounts device ID and all is well, however for older platforms it is a distinct ID, which is why we have to feed the `clients` collection to this Tabs Sync engine to associate the correct Firefox Account device id.
42
43 ## Getting started
44
45 **Prerequisites**: Firefox account authentication is necessary to obtain the keys to decrypt synced tabs data. See the [android-components FxA Client readme](https://github.com/mozilla-mobile/android-components/blob/master/components/service/firefox-accounts/README.md) for details on how to implement on Android. For iOS, Firefox for iOS still implement the legacy oauth.
46
47 **Platform-specific details**:
48 - <TODO-ST> Android
49 - iOS: start with the [guide to consuming rust components on iOS](https://github.com/mozilla/application-services/blob/main/docs/howtos/consuming-rust-components-on-ios.md)
50
51 ## API Documentation
52 - TODO
53
54 ## Testing
55
56 <TODO-ST>
57
58 ## Telemetry
59 <TODO-ST>
60
61 ## Examples
62 <TODO-ST>