Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/davidgraeff/firestore-db-and-auth-rs
/ functions
Functions
108 in github.com/davidgraeff/firestore-db-and-auth-rs
⨍
Functions
108
◇
Types & classes
96
↓ 9 callers
Method
client
(&self)
src/sessions.rs:122
↓ 9 callers
Function
extract_google_api_error_async
If the given reqwest response is status code 200, nothing happens Otherwise the response will be analysed if it contains a Google API Error response.
src/errors.rs:193
↓ 7 callers
Method
access_token
Returns the current access token. This method will automatically refresh your access token, if it has expired. If the refresh failed, this will retur
src/sessions.rs:103
↓ 7 callers
Method
add_jwks_public_keys
Add a JSON Web Key Set (JWKS) to allow verification of Google access tokens. Example: ``` use firestore_db_and_auth::credentials::Credentials; use f
src/credentials.rs:233
↓ 7 callers
Method
project_id
(&self)
src/sessions.rs:91
↓ 6 callers
Method
verify
Verifies that creating access tokens is possible with the given credentials and public keys. Returns an empty result type on success.
src/credentials.rs:183
↓ 5 callers
Function
write
Write a document to a given collection. If no document_id is given, Firestore will generate an ID. Check the [`WriteResult`] return value. If a docu
src/documents/write.rs:82
↓ 4 callers
Function
download_google_jwks
Download the Google JWK Set for a given service account. Returns the JWKS alongside the maximum time the JWKS is valid for. The resulting set of JWKs
src/jwt.rs:68
↓ 4 callers
Function
from_cache_file
Download the two public key JWKS files if necessary and cache the content at the given file path. Only use this option in cloud functions if the given
examples/utils/mod.rs:38
↓ 3 callers
Method
access_token
An access token. If a refresh token is known and the access token expired, the implementation should try to refresh the access token before returning.
examples/own_auth.rs:19
↓ 3 callers
Function
check_write
(result: WriteResult, doc_id: &str)
examples/create_read_write_document.rs:56
↓ 3 callers
Function
create
Firebase Auth provides server-side session cookie management for traditional websites that rely on session cookies. This solution has several advantag
src/sessions.rs:424
↓ 3 callers
Function
create_jwt
( credentials: &Credentials, scope: Option<Iter<S>>, duration: chrono::Duration, client_id: Op
src/jwt.rs:137
↓ 3 callers
Function
document_to_pod
Converts a firebase google-rpc-api inspired heavily nested and wrapped response document of the Firebase REST API into a given custom type. This is a
src/firebase_rest_to_rust.rs:124
↓ 3 callers
Function
firebase_auth_url
(v: &str, v2: &str)
src/users.rs:60
↓ 3 callers
Function
firebase_url
(v1: &str, v2: &str)
src/documents/mod.rs:76
↓ 3 callers
Function
query
Queries the database for specific documents, for example all documents in a collection of 'type' == "car". Example: ```no_run # use serde::{Serialize
src/documents/query.rs:36
↓ 3 callers
Function
read
Read a document of a specific type from a collection ## Arguments `auth` The authentication token `path` The document path / collection; For example
src/documents/read.rs:35
↓ 3 callers
Function
user_session_with_cached_refresh_token
(cred: &Credentials)
examples/utils/mod.rs:8
↓ 3 callers
Function
valid_test_credentials
()
examples/create_read_write_document.rs:223
↓ 3 callers
Function
verify_access_token
( credentials: &Credentials, access_token: &str, )
src/jwt.rs:197
↓ 3 callers
Method
with_jwkset
Adds public-key JWKs to a credentials instance and returns it. This method will also verify that the given JWKs files allow verification of Google ac
src/credentials.rs:150
↓ 2 callers
Method
compute_secret
Compute the Rsa keypair by using the private_key of the credentials file. You must call this if you have manually created a credentials object. This
src/credentials.rs:283
↓ 2 callers
Function
create_jwt_encoded
( credentials: &Credentials, scope: Option<Iter<'_, S>>, duration: chrono::Duration, client_id
src/jwt.rs:83
↓ 2 callers
Function
delete
Deletes the document at the given path. You cannot use this directly with paths from [`list`] and [`query`] document metadata objects. Those contain
src/documents/delete.rs:14
↓ 2 callers
Function
document_name
Simple method to join the path and document identifier in correct format
src/documents/read.rs:71
↓ 2 callers
Method
download_google_jwks
If you haven't called [`Credentials::add_jwks_public_keys`] to manually add public keys, this method will download one for your google service account
src/credentials.rs:250
↓ 2 callers
Function
extract_google_api_error_intern
( status: StatusCode, http_body: String, context: impl Fn() -> String, )
src/errors.rs:208
↓ 2 callers
Function
get_new_access_token
Gets a new access token via an api_key and a refresh_token.
src/sessions.rs:128
↓ 2 callers
Method
join
(&mut self, sep: &str)
src/documents/mod.rs:30
↓ 2 callers
Function
pod_to_document
Converts a custom data type into a firebase google-rpc-api inspired heavily nested and wrapped type to be consumed by the Firebase REST API. This is
src/firebase_rest_to_rust.rs:163
↓ 2 callers
Function
read_by_name
Read a document of a specific type from a collection by its Firestore document name ## Arguments `auth` The authentication token `document_name` The
src/documents/read.rs:10
↓ 2 callers
Function
request_document
Executes the request to retrieve the document. Returns the response from `reqwest`
src/documents/read.rs:57
↓ 2 callers
Function
run
()
examples/own_auth.rs:33
↓ 2 callers
Function
serde_value_to_firebase_value
Converts a flat serde json value into a firebase google-rpc-api inspired heavily nested and wrapped type to be consumed by the Firebase REST API. Thi
src/firebase_rest_to_rust.rs:69
↓ 2 callers
Function
service_account_session
(cred: Credentials)
examples/create_read_write_document.rs:68
↓ 2 callers
Function
sign_up_in
( session: &service_account::Session, email: &str, password: &str, action: &str, )
src/users.rs:122
↓ 2 callers
Function
user_account_session
(cred: Credentials)
examples/create_read_write_document.rs:96
↓ 1 callers
Method
access_token_unchecked
The access token, unchecked. Might be expired or in other ways invalid.
examples/own_auth.rs:23
↓ 1 callers
Method
decode_secret
Find the secret in the jwt set that matches the given key id, if any. Used for jws validation
src/credentials.rs:203
↓ 1 callers
Function
firebase_url_base
(v1: &str)
src/documents/mod.rs:63
↓ 1 callers
Function
firebase_url_extended
(v1: &str, v2: &str, v3: &str)
src/documents/mod.rs:68
↓ 1 callers
Function
firebase_url_query
(v1: &str)
src/documents/mod.rs:55
↓ 1 callers
Function
firebase_value_to_serde_value
Converts a firebase google-rpc-api inspired heavily nested and wrapped response value of the Firebase REST API into a flattened serde json value. Thi
src/firebase_rest_to_rust.rs:28
↓ 1 callers
Function
get_new_data
( collection_id: &str, url: &str, auth: &'a impl FirebaseAuthBearer, )
src/documents/list.rs:122
↓ 1 callers
Function
identitytoolkit_url
(project_id: &str)
src/sessions.rs:370
↓ 1 callers
Function
is_expired
Returns true if the access token (assumed to be a jwt) has expired An error is returned if the given access token string is not a jwt
src/jwt.rs:103
↓ 1 callers
Function
jwt_update_expiry_if
Returns true if the jwt was updated and needs signing
src/jwt.rs:115
↓ 1 callers
Function
list
List all documents of a given collection. Please note that this API acts as an iterator of same-like documents. This type is not suitable if you want
src/documents/list.rs:44
↓ 1 callers
Function
main
()
examples/firebase_user.rs:7
↓ 1 callers
Method
next
Skip empty entries
src/documents/query.rs:98
↓ 1 callers
Function
pem_to_der
Converts a PEM (ascii base64) encoded private key into the binary der representation
src/credentials.rs:67
↓ 1 callers
Function
refresh_to_access_endpoint
(v: &str)
src/sessions.rs:36
↓ 1 callers
Function
token_endpoint
(v: &str)
src/sessions.rs:28
↓ 1 callers
Function
user_info
Retrieve information about the firebase auth user associated with the given user session Error codes: - INVALID_ID_TOKEN - USER_NOT_FOUND
src/users.rs:69
↓ 1 callers
Function
valid_test_credentials
()
examples/utils/mod.rs:64
↓ 1 callers
Function
write_document
(session: &mut ServiceSession, doc_id: &str)
examples/create_read_write_document.rs:26
↓ 1 callers
Function
write_partial_document
(session: &mut ServiceSession, doc_id: &str)
examples/create_read_write_document.rs:38
Function
abs_to_rel
Converts an absolute path like "projects/{PROJECT_ID}/databases/(default)/documents/my_collection/document_id" into a relative document path like "my_
src/documents/mod.rs:87
Function
abs_to_rel_test
()
src/documents/mod.rs:92
Method
access_token_unchecked
(&self)
src/sessions.rs:95
Method
by_access_token
Create a new firestore user session by a valid access token Remember that such a session cannot renew itself. As soon as the access token expired, no
src/sessions.rs:309
Method
by_oauth2
Creates a new user session with OAuth2 provider token. If user don't exist it's create new user in firestore Arguments: - `credentials` The credentia
src/sessions.rs:333
Method
by_refresh_token
Create a new firestore user session via a valid refresh_token Arguments: - `credentials` The credentials - `refresh_token` A refresh token. Async su
src/sessions.rs:234
Method
by_user_id
Create a new firestore user session with a fresh access token. Arguments: - `credentials` The credentials - `user_id` The firebase Authentication use
src/sessions.rs:259
Method
client
The reqwest http client. The `Client` holds a connection pool internally, so it is advised that it is reused for multiple, successive connections.
examples/own_auth.rs:28
Function
contents
Return the raw unparsed content of the Firestore document. Methods like [`read()`](../documents/fn.read.html) will deserialize the JSON-encoded respon
src/documents/read.rs:50
Function
create_session_cookie_test
()
examples/session_cookie.rs:30
Method
default
()
src/dto.rs:65
Function
deserialize_credentials
()
src/credentials.rs:307
Function
doctest_credentials
()
src/credentials.rs:296
Method
download_jwkset
The public keys to verify generated tokens will be downloaded, for the given service account as well as for "securetoken@system.gserviceaccount.com".
src/credentials.rs:175
Function
extract_google_api_error
If the given reqwest response is status code 200, nothing happens Otherwise the response will be analysed if it contains a Google API Error response.
src/errors.rs:171
Function
firebase_user_test
()
examples/firebase_user.rs:22
Method
fmt
(&self, f: &mut fmt::Formatter)
src/errors.rs:92
Method
fmt
(&self, f: &mut fmt::Formatter<'_>)
src/credentials.rs:31
Method
from
(error: std::io::Error)
src/errors.rs:56
Method
from_file
Create a [`Credentials`] object by reading and parsing a google-service-account json file. This is a convenience method, that reads in the given cred
src/credentials.rs:139
Method
from_request
(request: &'a request::Request<'_>)
src/rocket/mod.rs:49
Function
get_provider
(provider: OAuth2Provider)
src/sessions.rs:55
Method
get_scopes
(&self)
src/jwt.rs:189
Function
hello
(auth: FirestoreAuthSessionGuard)
examples/rocket_http_protected_route.rs:21
Function
hello_not_logged_in
()
examples/rocket_http_protected_route.rs:27
Function
it_deserializes_a_document_with_empty_mapvalue
()
src/dto.rs:581
Function
it_deserializes_a_document_with_every_data_type
()
src/dto.rs:603
Function
it_document_name_joins_invalid_path_fragments
()
src/documents/read.rs:90
Function
it_document_name_joins_paths
()
src/documents/read.rs:79
Function
main
()
examples/rocket_http_protected_route.rs:7
Function
main
()
examples/session_cookie.rs:8
Function
main
()
examples/create_read_write_document.rs:199
Function
main
()
examples/own_auth.rs:60
Method
new
Create a new JWKSetDTO instance from a given json string You can use [`Credentials::add_jwks_public_keys`] to manually add more public keys later on.
src/jwt.rs:55
Method
new
(token: String, with_refresh_token: bool)
src/sessions.rs:148
Method
new
Create a [`Credentials`] object by parsing a google-service-account json string Example: Assuming that your firebase service account credentials fil
src/credentials.rs:129
Function
own_auth_test
()
examples/own_auth.rs:65
Function
pem_to_der_test
()
src/credentials.rs:89
Method
project_id
(&self)
examples/own_auth.rs:14
Function
service_account_session_test
()
examples/create_read_write_document.rs:245
Function
sign_in
Signs in with the given email and password and returns a user session. Error codes: EMAIL_NOT_FOUND: There is no user record corresponding to this id
src/users.rs:170
Function
sign_up
Creates the firebase auth user with the given email and password and returns a user session. Error codes: EMAIL_EXISTS: The email address is already
src/users.rs:160
next →
1–100 of 108, ranked by callers