Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

mozilla-services/remote-settings-client

Remote Settings Client

Warning: This repository was archived in January 2025. The official Rust client for Remote Settings now lives at https://github.com/mozilla/application-services/tree/main/components/remote_settings

A Rust Remote Settings Client to fetch collection data.

Available features:

  • Synchronization of local storage via rkv, memory, or filesystem
  • Signatures and cert chains verification via NSS rc_crypto or ring+oid-registry
  • Download of attachments
  • Write operations on records
  • Signoff operations (request review, approve, reject)

Relies on Mozilla's viaduct for its pluggable HTTP backend (eg. reqwest or FFI on Android).

See also the Storage and Verification traits to extend or customize the client behaviour.

Quick start

Cargo.toml:

[dependencies]
remote-settings-client = { version = "0.1", features = ["ring_verifier"] }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "v75.2.0"}
viaduct-reqwest = { git = "https://github.com/mozilla/application-services", rev = "v75.2.0"}

Minimal example:

use remote_settings_client::Client;
pub use viaduct::set_backend;
pub use viaduct_reqwest::ReqwestBackend;

fn main() {
  set_backend(&ReqwestBackend).unwrap();

  let client = Client::builder()
    .collection_name("search-config")
    .build();

  match client.get() {
    Ok(records) => println!("{:?}", records),
    Err(error) => println!("Error fetching/verifying records: {:?}", error),
  };
}

See also our demo project!

Documentation

Crate documentation

Logging

Using env_logger, the log level can be set via an environ variable:

RUSTLOG={debug/info} cargo run

fn main() {
  env_logger::init() // initialize logger
  ..
}

License

Licensed under Mozilla Public License, Version 2.0 (https://www.mozilla.org/en-US/MPL/2.0/)