DATA SECURITY
How Your Data Is Handled
Earth Estimator stores different information depending on whether a user is signed in or not.
GUEST USERS
Unsigned Users
Guest data stays in the browser.
For unsigned users, Earth Estimator saves game results and preferred game settings in the browser's local storage.
This means that the information is stored on the user's own device rather than in Earth Estimator's account database.
Information stored locally can include:
Game settings
Game mode
Selected countries
Selected themes
Previous game results
Because this information is stored locally, it can be more fragile.
Clearing browser data, changing browser or changing device can cause the locally stored information to disappear.
Unsigned users
Earth Estimator does not create a cloud player profile or save guest game data in its account database.ACCOUNTS
Signed-In Users
Signing in allows settings and results to be connected to an account instead of one browser.
To prevent game results and preferred settings from being lost, users have the option to identify themselves using either:
Authentication is handled through the user's Google identity.
Authentication is handled through Firebase Authentication.
Earth Estimator uses Firebase Authentication, provided by Google, to handle this process.
Earth Estimator itself does not receive or store the user's plaintext password.
Instead, Firebase handles the authentication process and provides Earth Estimator with an authenticated user identity.
User
↓
Firebase Authentication
↓
Identity verified
↓
Firebase UID
↓
Earth Estimator
The Firebase UID is a unique identifier connected to the authenticated account.
Earth Estimator can then use that identifier to locate the correct user's saved data.
users/{uid}/gameResults
users/{uid}/settings
The actual Firebase Authentication implementation can be placed here if the authentication code should be displayed on this page.
[CODE PLACEHOLDER]
Firebase Authentication listener
- Detect authenticated user
- Read user.uid
- Detect signed-out state
- Load account-specific data
AUTHORIZATION
Protecting User Data
Authentication identifies the user. Firestore Security Rules determine what that user is allowed to access.
Earth Estimator uses Firebase Firestore Security Rules to prevent one account from reading another account's data.
A simplified version of the rule looks like this:
allow read, create:
if request.auth != null
&& request.auth.uid == userId;
Two conditions must therefore be true.
The request must come from a signed-in Firebase user.
The authenticated Firebase UID must match the UID belonging to the requested data.
For example, imagine a user has:
That user can access data stored under:
users/abc123/
but should not be authorized to access data belonging to another Firebase UID.
The Firebase UID acts as the account boundary.
A signed-in user should only be able to access the Firestore data belonging to their own UID.STORED INFORMATION
What Earth Estimator Stores
For signed-in users, Earth Estimator may store:
- Email address
- Firebase user ID
- Game settings
- Selected game mode
- Selected themes and countries
- Number of questions
- Accuracy result from each completed game
- Game type
- Time the game was completed
Earth Estimator does not store a readable copy of the user's password in its Firestore database.
Firebase Authentication handles the password and authentication system separately.
[CODE PLACEHOLDER]
Example Firestore settings document
{
gameMode: "...",
selectedThemes: [...],
selectedCountries: [...],
numberOfQuestions: ...
}
[CODE PLACEHOLDER]
Example Firestore game result
{
accuracy: ...,
gameMode: "...",
questionCount: ...,
country: ...,
clientPlayedAt: ...,
playedAt: ...
}
The basic system can therefore be summarized like this:
Passwords
→ Firebase Authentication
User identity
→ Firebase UID
Game settings
→ Firestore
Game results
→ Firestore
Unsigned user data
→ Browser local storage
This allows Earth Estimator to keep guest data local while giving signed-in users a way to keep their settings and results connected to their account across different sessions and devices.
IN SHORT
Authentication, authorization and storage are kept separate.
Guest players keep their game information in their browser.
Signed-in players use Firebase Authentication to establish their identity.
Their Firebase UID is then used to connect them to their own game settings and results in Firestore.
Earth Estimator does not need to store readable user passwords in its Firestore database.
Return Home