Module installations

Module installations 

Source
Expand description

§Firebase Installations

The Installations module issues Firebase Installation IDs (FIDs) and scoped auth tokens used by other Firebase services. This Rust port mirrors the public JS API while speaking directly to the official Firebase Installations REST endpoints.

Porting status: 45% [##### ] (details)

§Quick Start Example

use firebase_rs_sdk::app::{initialize_app, FirebaseAppSettings, FirebaseOptions};
use firebase_rs_sdk::installations::{get_installations, InstallationToken};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
   let app = initialize_app(
       FirebaseOptions {
           api_key: Some("AIza...".into()),
           project_id: Some("my-project".into()),
           app_id: Some("1:123:web:abc".into()),
           ..Default::default()
       },
       Some(FirebaseAppSettings::default()),
   ).await?;

   let installations = get_installations(Some(app.clone()))?;
   let fid = installations.get_id().await?;
   let InstallationToken { token, expires_at } = installations.get_token(false).await?;
   println!("FID={fid}, token={token}, expires={expires_at:?}");
   Ok(())
}

§References to the Firebase JS SDK

§WASM Notes

  • Enable the wasm-web feature to pull in the fetch-based REST client and browser-specific glue.
  • Add experimental-indexed-db alongside wasm-web to persist installations to IndexedDB; without it, wasm builds fall back to in-memory persistence while keeping the same API surface.
  • IndexedDB persistence now has wasm-bindgen tests that validate round-trip storage and BroadcastChannel propagation (src/installations/persistence.rs).

Structs§

AppConfig
Extracted configuration required to contact the Firebase Installations REST API.
FilePersistence
InstallationEntryData
Public data describing a cached Firebase Installation entry.
InstallationToken
Represents an authentication token produced by the Firebase Installations service.
Installations
InstallationsError
InstallationsInternal
PersistedAuthToken
PersistedInstallation
RegisteredInstallation

Enums§

InstallationsErrorCode

Constants§

INSTALLATIONS_API_URL

Traits§

InstallationsPersistence

Functions§

delete_installations
Deletes the cached Firebase Installation for the given instance.
extract_app_config
Mirrors the JavaScript helper extractAppConfig from packages/installations/src/helpers/extract-app-config.ts.
get_installations
get_installations_internal
internal_error
invalid_argument
register_installations_component
request_failed

Type Aliases§

IdChangeUnsubscribe
InstallationsResult