Skip to content

mozilla-services/remote-settings-client

Remote Settings Client

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/)