Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use rs_firebase_admin_sdk::{
};

// Supply the Firebase project ID directly instead of reading GOOGLE_CLOUD_PROJECT
let live_app = App::live_with_project_id("my-firebase-project-id").await.unwrap();
let live_app = App::live_with_project_id("my-firebase-project-id").unwrap();
```

For more examples please see https://github.com/expl/rs-firebase-admin-sdk/tree/main/examples
2 changes: 1 addition & 1 deletion examples/clear_emulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2024"

[dependencies]
rs-firebase-admin-sdk = { path = "../../lib" }
tokio = { version = "1.51", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.52", features = ["macros", "rt-multi-thread"] }
4 changes: 2 additions & 2 deletions examples/clear_emulator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ where

#[tokio::main]
async fn main() {
let emulator_app = App::emulated();
let emulator_admin = emulator_app.auth("http://localhost:9099".into());
let emulator_app = App::emulated("http://localhost:9099".into());
let emulator_admin = emulator_app.auth();

clear_emulator(&emulator_admin).await;
}
2 changes: 1 addition & 1 deletion examples/cookies/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2024"
[dependencies]
rs-firebase-admin-sdk = { path = "../../lib" }
time = { version = "0.3" }
tokio = { version = "1.51", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.52", features = ["macros", "rt-multi-thread"] }
7 changes: 3 additions & 4 deletions examples/cookies/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rs_firebase_admin_sdk::{App, auth::FirebaseAuthService, jwt::TokenValidator};
use rs_firebase_admin_sdk::{App, auth::FirebaseAuthService};
use time::Duration;

#[tokio::main]
Expand All @@ -10,8 +10,7 @@ async fn main() {
.create_session_cookie(oidc_token, Duration::seconds(60 * 60))
.await
.unwrap();
let live_cookie_validator = live_app.cookie_validator().unwrap();

let live_cookie_validator = live_app.cookie_token_verifier().unwrap();

live_cookie_validator.validate(&cookie).await.unwrap();
live_cookie_validator.validate(cookie).await.unwrap();
}
2 changes: 1 addition & 1 deletion examples/get_users/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2024"

[dependencies]
rs-firebase-admin-sdk = { path = "../../lib" }
tokio = { version = "1.51", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.52", features = ["macros", "rt-multi-thread"] }
4 changes: 2 additions & 2 deletions examples/get_users/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ async fn main() {
print_all_users(&live_auth_admin).await;

// Emulator Firebase App
let emulator_app = App::emulated();
let emulator_auth_admin = emulator_app.auth("http://localhost:9099".into());
let emulator_app = App::emulated("http://localhost:9099".into());
let emulator_auth_admin = emulator_app.auth();

print_all_users(&emulator_auth_admin).await;
}
2 changes: 1 addition & 1 deletion examples/verify_token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2024"

[dependencies]
rs-firebase-admin-sdk = { path = "../../lib", features = ["tokens"] }
tokio = { version = "1.51", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.52", features = ["macros", "rt-multi-thread"] }
13 changes: 7 additions & 6 deletions examples/verify_token/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use rs_firebase_admin_sdk::{App, jwt::TokenValidator};
use std::sync::Arc;

async fn verify_token<T: TokenValidator>(token: &str, validator: &T) {
async fn verify_token(token: String, validator: Arc<dyn TokenValidator>) {
match validator.validate(token).await {
Ok(token) => {
let user_id = token.get("sub").unwrap().as_str().unwrap();
Expand All @@ -17,11 +18,11 @@ async fn main() {
// Live
let oidc_token = std::env::var("ID_TOKEN").unwrap();
let live_app = App::live().await.unwrap();
let live_token_validator = live_app.id_token_verifier().unwrap();
verify_token(&oidc_token, &live_token_validator).await;
let live_token_validator = live_app.token_validator().unwrap();
verify_token(oidc_token.clone(), live_token_validator.clone()).await;

// Emulator
let emulator_app = App::emulated();
let emulator_token_validator = emulator_app.id_token_verifier();
verify_token(&oidc_token, &emulator_token_validator).await;
let emulator_app = App::emulated("http://emulator:9099".into());
let emulator_token_validator = emulator_app.token_validator().unwrap();
verify_token(oidc_token, emulator_token_validator).await;
}
10 changes: 5 additions & 5 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rs-firebase-admin-sdk"
version = "4.3.0"
version = "5.0.0"
rust-version = "1.88"
edition = "2024"
authors = ["Kostas Petrikas"]
Expand All @@ -18,7 +18,7 @@ default = ["tokens"]
tokens = ["dep:jsonwebtoken", "dep:jsonwebtoken-jwks-cache"]

[dependencies]
tokio = { version = "1.51", features = ["sync"], default-features = false }
tokio = { version = "1.52", features = ["sync"], default-features = false }
error-stack = "0.7"
thiserror = "2.0"
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -28,12 +28,12 @@ headers = "0.4"
reqwest = { version = "0.13", features = ["charset", "json", "hickory-dns", "rustls", "brotli"], default-features = false }
urlencoding = "2.1"
bytes = "1"
google-cloud-auth = "1.8"
google-cloud-auth = "1.13"
time = { version = "0.3", features = ["serde"] }
base64 = "0.22"
jsonwebtoken = { version = "10", optional = true }
jsonwebtoken-jwks-cache = { version = "0.3", optional = true }

[dev-dependencies]
tokio = { version = "1.51", features = ["macros", "rt-multi-thread"] }
serial_test = "3.4"
tokio = { version = "1.52", features = ["macros", "rt-multi-thread"] }
serial_test = "3.5"
Loading
Loading