cloud_frog library

A library to help build secure Google Cloud services using Dart Frog.

Classes

DateTimeService
Provides time locally and in specific timezones.
EncryptionKey
A Google Cloud KMS encryption key.
Project
A Google Cloud project.
User
The request's authenticated user.

Constants

issuerFirebasePrefix → const String
The Firebase token issuer prefix.
issuerGoogle → const String
The Google Accounts OIDC issuer.

Properties

authenticateFirebaseUser → Middleware
A Dart Frog middleware that verifies that the current route is invoked by a signed-in Firebase user.
no setter
firebasePublicKeysProvider → Middleware
A provider of Firebase authentication public keys.
final
gCloudPublicKeysProvider → Middleware
A provider of Google Cloud API public keys.
final
projectId Future<String>
Gets the current Google Cloud project's ID from the metadata service.
no setter
projectProvider → Middleware
A provider of the current Google Cloud project.
final

Functions

decrypt(String cipher, EncryptionKey key, {AuthClient? client, String? additionalAuthenticatedData}) Future<String?>
Decrypts a value using Google Cloud KMS.
encrypt(String value, EncryptionKey key, {AuthClient? client, String? additionalAuthenticatedData}) Future<String?>
Encrypts a value using Google Cloud KMS.
googleapisServiceAccountClient({required String serviceAccountEmailEnv, required String serviceAccountIdEnv, required String serviceAccountKeySecretName, required List<String> scopes}) Future<AuthClient>
Obtains a Google APIs client based on a service account.
secret(String name) Future<String>
Retrieves a secret from the platform's secret manager.
validateFirebaseToken() → Middleware
A middleware that validates the signature and contents of the request token for a Firebase end user.
validateToken({required bool verifyAudience, String? issuer}) → Middleware
A middleware that validates the signature and contents of the request token for a Google Cloud service account.
verifyContextUser(List<String> allowedEmails) → Middleware
A middleware that checks that the user present in the request context is authorized.
verifyServiceAccount(List<String> allowedEmails, {bool verifyAudience = true, String? issuer}) → Middleware
A Dart Frog middleware that verifies that the current route is invoked by an authorized service account.