feat(firebase_app_check,windows): add custom App Check provider support#18184
feat(firebase_app_check,windows): add custom App Check provider support#18184lukemmtt wants to merge 3 commits intofirebase:mainfrom
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
98e57f2 to
976a491
Compare
… provider, clarify provider docs The Dart FlutterApi now returns CustomAppCheckToken, a class carrying both the minted token and its wall-clock expiry in Unix epoch milliseconds, instead of just a string. This lets backends mint tokens with arbitrary lifetimes without the plugin hardcoding a refresh window, and it removes a 55-minute constant from the C++ plugin that assumed every backend mints ~1-hour tokens. Short-lived tokens for stricter posture and longer-lived tokens for fewer round-trips are both supported by the same API. The Windows plugin's GetToken now pipes the expiry from Dart straight through to AppCheckToken.expire_time_millis, so the Firebase C++ SDK caches for the exact lifetime the backend chose. Also updates stale provider docs on windows_providers.dart (the base and debug-provider docs previously described debug as the only supported Windows provider, which was already out of date once custom support landed) and expands WindowsCustomProvider's docs with a usage example showing a FirebaseAppCheckFlutterApi implementation. Regenerates all Pigeon bindings (Dart, Kotlin, Swift, C++) from the updated source.
0964913 to
b7f0ba2
Compare
|
Hey @lukemmtt, thanks for the contribution. Could you please add tests to cover this change? |
|
Will do, thanks for the reminder @SelaseKay 🙏🏻 |
Exercises the Windows activate() payload for WindowsCustomProvider and WindowsDebugProvider (with and without an explicit debug token), plus the FirebaseAppCheckFlutterApi success and PlatformException envelopes.
Summary
Adds custom App Check provider support for Windows, addressing the custom-provider part of issue 12227. Combined with the debug provider from PR 18140, this allows Flutter Windows apps to meet Firebase App Check enforcement for Firestore, Functions, Storage, Auth, and Realtime Database.
Specifically, this PR adds the FlutterFire plumbing (Pigeon bridge and Windows plugin wiring) that exposes the Firebase C++ SDK's custom-provider interface to Flutter developers. With this infrastructure, Flutter apps on Windows can supply App Check tokens by implementing a custom Dart handler. That handler is the integration point any Windows attestation (TPM hardware attestation, Microsoft Store licensing, Azure Attestation, or an auth-backed token minted by a Cloud Function) needs to feed App Check.
Usage
Activate the provider alongside existing platform providers and register your handler to supply fresh tokens:
The Firebase SDK will automatically attach tokens from this handler to subsequent Firebase backend requests.
Design notes
The public Flutter API follows existing naming conventions (
providerWindows), aligning withproviderAndroidandproviderApple. The shared PigeonactivateAPI includes a corresponding optionalwindowsProviderparameter.CustomAppCheckTokenincludes both the token string and its absolute expiry in Unix epoch milliseconds. Returning the expiry from Dart lets consumer backends pick arbitrary TTLs (short for stricter posture, longer for fewer round trips) without the plugin hardcoding a refresh window.Currently,
GetLimitedUseAppCheckTokendelegates toGetAppCheckToken(false)because the Firebase C++ SDK does not yet offer a dedicated limited-use token method. Regular App Check enforcement is unaffected; only replay-protection scenarios see this fallback behavior. This path can transition once the SDK supports limited-use tokens.References