Crates.io | fireplace |
lib.rs | fireplace |
version | 0.3.0 |
source | src |
created_at | 2023-11-27 13:12:40.762874 |
updated_at | 2024-10-18 11:39:34.210557 |
description | A client for Firebase that seeks to provide a user-friendly interface to interact with Firestore, Firebase Auth, and similar. |
homepage | https://github.com/Filify-app/fireplace |
repository | https://github.com/Filify-app/fireplace |
max_upload_size | |
id | 1050418 |
size | 256,423 |
The bestest, best Firebase library for Rust because there are no other libraries.
This is a home-made client for Firebase's Admin SDK that seeks to provide a user friendly interface to interact with Firestore, Firebase Auth, and similar.
To verify ID tokens for Firebase Auth, OpenSSL is required. For installation, see the openssl
crate's documentation.
Check out the examples
directory or view the crate documentation on docs.rs, which includes many examples. Test-run the hello-world example with:
cargo run --example hello
This requires you to fetch your service account JSON file as described below.
The easiest way is to get your service account JSON file that can be used to authorize requests to Firebase. This file will also decide which project on Firebase to send requests to.
Your JSON file will look something like this:
{
"type": "service_account",
"project_id": "...",
"private_key_id": "...",
"private_key": "-----BEGIN PRIVATE KEY----- ...",
"client_email": "...",
"client_id": "...",
"auth_uri": "...",
"token_uri": "...",
"auth_provider_x509_cert_url": "...",
"client_x509_cert_url": "..."
}
Currently I've made the tests use a real in-the-cloud Firebase project to ensure that everything works as expected. However, this has the consequence that you need to set up access and be careful about tests affecting each other.
For testing, the following environment variables need to be set so the tests can connect to the cloud:
FIREBASE_PROJECT_ID
FIREBASE_CLIENT_ID
FIREBASE_CLIENT_EMAIL
FIREBASE_PRIVATE_KEY
FIREBASE_PRIVATE_KEY_ID
They should correspond to their values from the service account JSON file.
Additionally, some of the Firestore tests may need indices to be created. See the error messages for which.