application-services/components/fxa-client
Mark Hammond b09581e8e9 [Tabs] Update the pending close schema so it's also a queue of things to send.
* Abstracts the API towards being more general-purpose "tab command" rather than
  being purely about closing individual tabs, with the intention that it's
  easier to add, say, "close all inactive" (because with 100% certainty I
  know this will be a very early request)

* Updates the schema creation code to be less foot-gun-y.

* Renaming a few things so that we consistently use `device_id` for the fxa id
  and `client_id` for the Sync client ID.

* Fixes the case when syncing when the device ID != fxa id.
2024-05-28 19:13:32 +00:00
..
android Typos 2024-05-24 20:17:12 +00:00
ios/FxAClient Typos 2024-05-24 20:17:12 +00:00
src [Tabs] Update the pending close schema so it's also a queue of things to send. 2024-05-28 19:13:32 +00:00
.gitignore Reorganize the repo 2018-12-13 15:25:21 -05:00
Cargo.toml Use uniffi as a workspace dependency 2023-12-15 18:32:25 +00:00
README.md Update README.md to fix dead link 2023-10-12 15:20:04 +00:00
build.rs Updating UniFFI to version 0.23 2023-01-27 12:38:55 -05:00
uniffi.toml Remove duplicate DeviceType enums. (#5316) 2023-04-28 05:35:26 +10:00

README.md

Firefox Accounts Client

The fxa-client component lets applications integrate with the Firefox Accounts identity service.

Features

The fxa-client component offers support for:

  1. Letting users sign in to your app, using either an email-and-password-based OAuth flow or a QR-code-based pairing flow.
  2. Accessing basic profile information about the signed-in user, such as email address and display name.
  3. Obtaining OAuth access tokens and client-side encryption keys, in order to access account-enabled services such as Firefox Sync.
  4. Listing and managing other applications connected to the user's account.
  5. Sending tabs to other applications that are capable of receiving them.
  6. Managing a device record for your signed-in application, making it visible to other applications connected to the user's account.

The component does not offer, and we have no concrete plans to offer:

  • The ability to store data "in the cloud" associated with the user's account.

Using the Firefox Accounts client

Before using this component

This component does not currently integrate with the Glean SDK and does not submit any telemetry, so you do not need to request a data-review before using this component.

Prerequisites

To use this component, your application must be registered to integrate with Firefox Accounts as an OAuth client and have a unique OAuth client_id.

You should also be familiar with how to integrate application-services components into an application on your target platform:

Core Concepts

You should understand the core concepts of OAuth and the Firefox Accounts system before attempting to use this component. Please review the Firefox Accounts Documentation for more details.

In particular, you should understand the different types of auth token in the FxA ecosystem and how each is used, as well as how OAuth scopes work for accessing related services.

Component API

For details on how to use this component, consult the public interface definition or view the generated Rust API documentation by running:

cargo doc --no-deps --open

Working on the Firefox Accounts client

Prerequisites

To effectively work on the FxA Client component, you will need to be familiar with:

Overview

This component uses uniffi-rs to create its public API surface in Rust, and then generate bindings for Kotlin and Swift. The code is organized as follows:

  • The public API surface is implemented in ./src/lib.rs, with matching declarations in ./src/fxa_client.udl to define how it gets exposed to other languages.
    • All the implementation details are written in Rust and can be found under ./src/internal/.
  • The ./android/ directory contains android-specific build scripts that generate Kotlin wrappers and publish them as an AAR. It also contains a small amount of hand-written Kotlin code for things that are not yet supposed by UniFFI.
  • The ./ios/ directory contains ios-specific build scripts that generate Swift wrappers for consumption via an Xcode build. It also contains some hand-written Swift code to expose a higher-level convenience API.

Detailed Docs

We use rustdoc to document both the public API of this component and its various internal implementation details. View the docs by running:

cargo doc --no-deps --document-private-items --open

In particular, the internal sub-module contains most of the business logic, and is delegated to from the public API.