Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
423b3e9
refactor: match AppCheck with firebase-js-sdk
russellwheatley Feb 12, 2026
5435550
refactor: modular should use internal AppCheck type
russellwheatley Feb 12, 2026
2b63dbf
chore: use AppCheckInternal in modular and remove ts-ignore for MODUL…
russellwheatley Feb 12, 2026
bda105b
refactor: namespaced.ts using previous index.d.ts + update modular ap…
russellwheatley Feb 12, 2026
bdeff28
chore: annotate namespaced types as deprecated
russellwheatley Feb 12, 2026
0fd4dcc
chore: update types to unsubscribe
russellwheatley Feb 12, 2026
8698293
refactor: change AppCheckListenerResult to AppCheckTokenResult
russellwheatley Feb 13, 2026
421ea77
fix(ai): use deprecated type so when we remove this will be flagged a…
russellwheatley Feb 13, 2026
2649a8c
chore: use firebase-js-sdk types for app check web
russellwheatley Feb 13, 2026
c277355
fix: remove FirebaseAppCheckTypes export from modular types
russellwheatley Feb 13, 2026
4aa08e7
fix: export FirebaseAppCheckTypes from index and fix type-tests
russellwheatley Feb 13, 2026
f5de6b8
refactor: remove statics from modular and export CustomProvider from …
russellwheatley Feb 13, 2026
98e0ac9
refactor: allow passing in providerOptions into constructor
russellwheatley Feb 16, 2026
76ab3a8
refactor: move Custom Provider and ReactNativeFirebaseAppCheckProvide…
russellwheatley Feb 16, 2026
2b8d3cf
refactor: modular types to match firebase-js-sdk as close as possible
russellwheatley Feb 16, 2026
2f44732
chore: ensure native module is types for app check
russellwheatley Feb 16, 2026
283b7ce
chore: annotate public types and rm deprecated types from internal
russellwheatley Feb 16, 2026
572df70
refactor: use class ReactNativeFirebaseAppCheckProvider as type
russellwheatley Feb 16, 2026
a2dbafb
chore: get common types internally
russellwheatley Feb 16, 2026
540ee78
fix: export FirebaseAppCheckTypes as type
russellwheatley Feb 16, 2026
ae7592e
Merge branch 'main' into app-check-match-js-sdk
russellwheatley Apr 9, 2026
3366f97
chore: port over js sdk app check types
russellwheatley Apr 9, 2026
6470f1c
docs: created v25 migraiton guide + update app-check docs with provid…
russellwheatley Apr 9, 2026
8c75ab4
chore: update comparison script with app check types
russellwheatley Apr 9, 2026
28b725e
docs: add v25 to spellchecker
russellwheatley Apr 9, 2026
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
248 changes: 248 additions & 0 deletions .github/scripts/compare-types/packages/app-check/app-check-sdk.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
/**
* The Firebase App Check Web SDK.
*
* @remarks
* Firebase App Check does not work in a Node.js environment using `ReCaptchaV3Provider` or
* `ReCaptchaEnterpriseProvider`, but can be used in Node.js if you use
* `CustomProvider` and write your own attestation method.
*
* @packageDocumentation
*/

import { FirebaseApp } from '@firebase/app';
import { PartialObserver } from '@firebase/util';
import { Unsubscribe } from '@firebase/util';

/**
* The Firebase App Check service interface.
*
* @public
*/
export declare interface AppCheck {
/**
* The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
*/
app: FirebaseApp;
}

/* Excluded from this release type: _AppCheckComponentName */

/* Excluded from this release type: _AppCheckInternalComponentName */

/**
* Options for App Check initialization.
* @public
*/
export declare interface AppCheckOptions {
/**
* A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
*/
provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
/**
* If set to true, enables automatic background refresh of App Check token.
*/
isTokenAutoRefreshEnabled?: boolean;
}

declare interface AppCheckProvider {
/* Excluded from this release type: getToken */
/* Excluded from this release type: initialize */
}

/**
* The token returned from an App Check provider.
* @public
*/
export declare interface AppCheckToken {
readonly token: string;
/**
* The local timestamp after which the token will expire.
*/
readonly expireTimeMillis: number;
}

declare interface AppCheckTokenInternal extends AppCheckToken {
issuedAtTimeMillis: number;
}

/**
* A listener that is called whenever the App Check token changes.
* @public
*/
export declare type AppCheckTokenListener = (token: AppCheckTokenResult) => void;

/**
* Result returned by `getToken()`.
* @public
*/
export declare interface AppCheckTokenResult {
/**
* The token string in JWT format.
*/
readonly token: string;
}

/**
* Custom provider class.
* @public
*/
export declare class CustomProvider implements AppCheckProvider {
private _customProviderOptions;
private _app?;
constructor(_customProviderOptions: CustomProviderOptions);
/* Excluded from this release type: getToken */
/* Excluded from this release type: initialize */
/* Excluded from this release type: isEqual */
}

/**
* Options when creating a {@link CustomProvider}.
* @public
*/
export declare interface CustomProviderOptions {
/**
* Function to get an App Check token through a custom provider
* service.
*/
getToken: () => Promise<AppCheckToken>;
}

/**
* Requests a Firebase App Check token. This method should be used
* only if you need to authorize requests to a non-Firebase backend.
*
* Returns limited-use tokens that are intended for use with your
* non-Firebase backend endpoints that are protected with
* <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
* Replay Protection</a>. This method
* does not affect the token generation behavior of the
* #getAppCheckToken() method.
*
* @param appCheckInstance - The App Check service instance.
* @returns The limited use token.
* @public
*/
export declare function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;

/**
* Get the current App Check token. If `forceRefresh` is false, this function first
* checks for a valid token in memory, then local persistence (IndexedDB).
* If not found, or if `forceRefresh` is true, it makes a request to the
* App Check endpoint for a fresh token. That request attaches
* to the most recent in-flight request if one is present.
*
* @param appCheckInstance - The App Check service instance.
* @param forceRefresh - If true, will always try to fetch a fresh token.
* If false, will use a cached token if found in storage.
* @public
*/
export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;

/**
* Activate App Check for the given app. Can be called only once per app.
* @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for
* @param options - App Check initialization options
* @public
*/
export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;

/**
* Registers a listener to changes in the token state. There can be more
* than one listener registered at the same time for one or more
* App Check instances. The listeners call back on the UI thread whenever
* the current token associated with this App Check instance changes.
*
* @param appCheckInstance - The App Check service instance.
* @param observer - An object with `next`, `error`, and `complete`
* properties. `next` is called with an
* {@link AppCheckTokenResult}
* whenever the token changes. `error` is optional and is called if an
* error is thrown by the listener (the `next` function). `complete`
* is unused, as the token stream is unending.
*
* @returns A function that unsubscribes this listener.
* @public
*/
export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;

/**
* Registers a listener to changes in the token state. There can be more
* than one listener registered at the same time for one or more
* App Check instances. The listeners call back on the UI thread whenever
* the current token associated with this App Check instance changes.
*
* @param appCheckInstance - The App Check service instance.
* @param onNext - When the token changes, this function is called with an
* {@link AppCheckTokenResult}.
* @param onError - Optional. Called if there is an error thrown by the
* listener (the `onNext` function).
* @param onCompletion - Currently unused, as the token stream is unending.
* @returns A function that unsubscribes this listener.
* @public
*/
export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
export { PartialObserver }

/**
* App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it
* for an App Check token.
*
* @public
*/
export declare class ReCaptchaEnterpriseProvider implements AppCheckProvider {
private _siteKey;
private _app?;
private _heartbeatServiceProvider?;
/**
* Throttle requests on certain error codes to prevent too many retries
* in a short time.
*/
private _throttleData;
/**
* Create a ReCaptchaEnterpriseProvider instance.
* @param siteKey - reCAPTCHA Enterprise score-based site key.
*/
constructor(_siteKey: string);
/* Excluded from this release type: getToken */
/* Excluded from this release type: initialize */
/* Excluded from this release type: isEqual */
}

/**
* App Check provider that can obtain a reCAPTCHA V3 token and exchange it
* for an App Check token.
*
* @public
*/
export declare class ReCaptchaV3Provider implements AppCheckProvider {
private _siteKey;
private _app?;
private _heartbeatServiceProvider?;
/**
* Throttle requests on certain error codes to prevent too many retries
* in a short time.
*/
private _throttleData;
/**
* Create a ReCaptchaV3Provider instance.
* @param siteKey - ReCAPTCHA V3 siteKey.
*/
constructor(_siteKey: string);
/* Excluded from this release type: getToken */
/* Excluded from this release type: initialize */
/* Excluded from this release type: isEqual */
}

/**
* Set whether App Check will automatically refresh tokens as needed.
*
* @param appCheckInstance - The App Check service instance.
* @param isTokenAutoRefreshEnabled - If true, the SDK automatically
* refreshes App Check tokens as needed. This overrides any value set
* during `initializeAppCheck()`.
* @public
*/
export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isTokenAutoRefreshEnabled: boolean): void;
export { Unsubscribe }

export { }
102 changes: 102 additions & 0 deletions .github/scripts/compare-types/packages/app-check/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/**
* Known differences between the firebase-js-sdk @firebase/app-check public
* API and the @react-native-firebase/app-check modular API.
*
* Each entry must have a `name` (the export name) and a `reason` explaining
* why the difference exists. Any difference NOT listed here will cause CI to
* fail so that new drift is caught and deliberately acknowledged.
*/

import type { PackageConfig } from '../../src/types';

const config: PackageConfig = {
nameMapping: {},
missingInRN: [
{
name: 'AppCheckTokenListener',
reason:
'RN Firebase exposes token change listeners through the `onTokenChanged` overloads but does not export the standalone listener type alias from the firebase-js-sdk.',
},
{
name: 'PartialObserver',
reason:
'RN Firebase re-exports this type from `@react-native-firebase/app` common types rather than mirroring the firebase-js-sdk utility export directly.',
},
{
name: 'ReCaptchaEnterpriseProvider',
reason:
'Web-only reCAPTCHA Enterprise provider from the firebase-js-sdk. RN Firebase uses `ReactNativeFirebaseAppCheckProvider` to configure native platform providers instead.',
},
{
name: 'ReCaptchaV3Provider',
reason:
'Web-only reCAPTCHA v3 provider from the firebase-js-sdk. RN Firebase uses `ReactNativeFirebaseAppCheckProvider` for cross-platform provider configuration.',
},
{
name: 'Unsubscribe',
reason:
'RN Firebase re-exports this type from `@react-native-firebase/app` common types rather than mirroring the firebase-js-sdk utility export directly.',
},
],
extraInRN: [
{
name: 'AppCheckProvider',
reason:
'RN Firebase keeps the provider interface public because its native and React Native-specific provider classes are part of the package surface.',
},
{
name: 'ReactNativeFirebaseAppCheckProviderOptions',
reason:
'RN Firebase-specific base options type used to configure native and React Native provider behavior across platforms.',
},
{
name: 'ReactNativeFirebaseAppCheckProviderWebOptions',
reason:
'RN Firebase-specific web provider config shape used by `ReactNativeFirebaseAppCheckProvider.configure()`.',
},
{
name: 'ReactNativeFirebaseAppCheckProviderAppleOptions',
reason:
'RN Firebase-specific Apple provider config shape used to select native iOS/macOS App Check providers.',
},
{
name: 'ReactNativeFirebaseAppCheckProviderAndroidOptions',
reason:
'RN Firebase-specific Android provider config shape used to select native Android App Check providers.',
},
{
name: 'ReactNativeFirebaseAppCheckProviderOptionsMap',
reason:
'RN Firebase-specific cross-platform provider options map used to configure Android, Apple, and web providers together.',
},
{
name: 'ReactNativeFirebaseAppCheckProviderConfig',
reason:
'RN Firebase convenience config object that allows provider options to be passed directly during initialization.',
},
{
name: 'ReactNativeFirebaseAppCheckProvider',
reason:
'RN Firebase-specific provider class that wraps native platform provider selection; there is no firebase-js-sdk equivalent export.',
},
],
differentShape: [
{
name: 'initializeAppCheck',
reason:
'RN Firebase returns `Promise<AppCheck>` because App Check initialization crosses the native bridge, whereas the firebase-js-sdk returns `AppCheck` synchronously.',
},
{
name: 'AppCheckOptions',
reason:
'RN Firebase accepts `CustomProvider`, `ReactNativeFirebaseAppCheckProvider`, or a RN-specific provider config object instead of the firebase-js-sdk reCAPTCHA provider classes.',
},
{
name: 'CustomProvider',
reason:
'The RN Firebase `CustomProvider` class is tailored to the React Native/native initialization model, so its public class shape differs from the firebase-js-sdk version.',
},
],
};

export default config;
16 changes: 16 additions & 0 deletions .github/scripts/compare-types/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import path from 'path';
import type { PackageConfig } from './types';

import aiConfig from '../packages/ai/config';
import appCheckConfig from '../packages/app-check/config';
import firestoreConfig from '../packages/firestore/config';
import firestorePipelinesConfig from '../packages/firestore-pipelines/config';

Expand Down Expand Up @@ -109,6 +110,21 @@ export const packages: PackageEntry[] = [
],
config: aiConfig,
},
{
name: 'app-check',
firebaseSdkTypesPaths: [
path.join(SCRIPT_DIR, 'packages', 'app-check', 'app-check-sdk.d.ts'),
],
rnFirebaseModularFiles: [
path.join(rnDist('app-check'), 'types', 'appcheck.d.ts'),
path.join(rnDist('app-check'), 'modular.d.ts'),
],
rnFirebaseSupportFiles: [
path.join(rnDist('app-check'), 'providers.d.ts'),
path.join(rnDist('app-check'), 'types', 'internal.d.ts'),
],
config: appCheckConfig,
},
{
name: 'firestore',
firebaseSdkTypesPaths: [
Expand Down
1 change: 1 addition & 0 deletions .spellcheck.dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ v6
v7
v9
v22
v25
Ventura
VertexAI
VPN
Expand Down
Loading
Loading