@react-native-firebase/app-check 24.1.1 → 25.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/module/index.js +1 -0
  3. package/dist/module/index.js.map +1 -1
  4. package/dist/module/modular.js +7 -24
  5. package/dist/module/modular.js.map +1 -1
  6. package/dist/module/namespaced.js +2 -16
  7. package/dist/module/namespaced.js.map +1 -1
  8. package/dist/module/providers.js +39 -0
  9. package/dist/module/providers.js.map +1 -0
  10. package/dist/module/types/appcheck.js +1 -86
  11. package/dist/module/types/appcheck.js.map +1 -1
  12. package/dist/module/types/internal.js +4 -0
  13. package/dist/module/types/internal.js.map +1 -0
  14. package/dist/module/types/namespaced.js +60 -0
  15. package/dist/module/types/namespaced.js.map +1 -0
  16. package/dist/module/version.js +1 -1
  17. package/dist/module/web/RNFBAppCheckModule.android.js +2 -2
  18. package/dist/module/web/RNFBAppCheckModule.android.js.map +1 -1
  19. package/dist/module/web/RNFBAppCheckModule.ios.js +2 -2
  20. package/dist/module/web/RNFBAppCheckModule.ios.js.map +1 -1
  21. package/dist/module/web/RNFBAppCheckModule.js +5 -2
  22. package/dist/module/web/RNFBAppCheckModule.js.map +1 -1
  23. package/dist/typescript/lib/index.d.ts +2 -1
  24. package/dist/typescript/lib/index.d.ts.map +1 -1
  25. package/dist/typescript/lib/modular.d.ts +7 -8
  26. package/dist/typescript/lib/modular.d.ts.map +1 -1
  27. package/dist/typescript/lib/namespaced.d.ts +5 -10
  28. package/dist/typescript/lib/namespaced.d.ts.map +1 -1
  29. package/dist/typescript/lib/providers.d.ts +19 -0
  30. package/dist/typescript/lib/providers.d.ts.map +1 -0
  31. package/dist/typescript/lib/types/appcheck.d.ts +53 -204
  32. package/dist/typescript/lib/types/appcheck.d.ts.map +1 -1
  33. package/dist/typescript/lib/types/internal.d.ts +125 -0
  34. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  35. package/dist/typescript/lib/types/namespaced.d.ts +358 -0
  36. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  37. package/dist/typescript/lib/version.d.ts +1 -1
  38. package/dist/typescript/lib/web/RNFBAppCheckModule.android.d.ts +2 -2
  39. package/dist/typescript/lib/web/RNFBAppCheckModule.android.d.ts.map +1 -1
  40. package/dist/typescript/lib/web/RNFBAppCheckModule.d.ts +6 -6
  41. package/dist/typescript/lib/web/RNFBAppCheckModule.d.ts.map +1 -1
  42. package/dist/typescript/lib/web/RNFBAppCheckModule.ios.d.ts +2 -2
  43. package/dist/typescript/lib/web/RNFBAppCheckModule.ios.d.ts.map +1 -1
  44. package/lib/index.ts +2 -21
  45. package/lib/modular.ts +39 -39
  46. package/lib/namespaced.ts +17 -36
  47. package/lib/providers.ts +49 -0
  48. package/lib/types/appcheck.ts +56 -258
  49. package/lib/types/internal.ts +162 -0
  50. package/lib/types/namespaced.ts +422 -0
  51. package/lib/version.ts +1 -1
  52. package/lib/web/RNFBAppCheckModule.android.ts +2 -2
  53. package/lib/web/RNFBAppCheckModule.ios.ts +2 -2
  54. package/lib/web/RNFBAppCheckModule.ts +17 -22
  55. package/package.json +6 -6
  56. package/plugin/tsconfig.json +2 -1
  57. package/plugin/tsconfig.tsbuildinfo +1 -1
  58. package/tsconfig.json +2 -2
  59. package/typedoc.json +1 -11
  60. package/dist/module/ReactNativeFirebaseAppCheckProvider.js +0 -14
  61. package/dist/module/ReactNativeFirebaseAppCheckProvider.js.map +0 -1
  62. package/dist/typescript/lib/ReactNativeFirebaseAppCheckProvider.d.ts +0 -8
  63. package/dist/typescript/lib/ReactNativeFirebaseAppCheckProvider.d.ts.map +0 -1
  64. package/lib/ReactNativeFirebaseAppCheckProvider.ts +0 -21
@@ -0,0 +1,358 @@
1
+ import type { ReactNativeFirebase } from '@react-native-firebase/app';
2
+ /**
3
+ * Firebase App Check package for React Native.
4
+ *
5
+ * #### Example 1
6
+ *
7
+ * Access the firebase export from the `appCheck` package:
8
+ *
9
+ * ```js
10
+ * import { firebase } from '@react-native-firebase/app-check';
11
+ *
12
+ * // firebase.appCheck().X
13
+ * ```
14
+ *
15
+ * #### Example 2
16
+ *
17
+ * Using the default export from the `appCheck` package:
18
+ *
19
+ * ```js
20
+ * import appCheck from '@react-native-firebase/app-check';
21
+ *
22
+ * // appCheck().X
23
+ * ```
24
+ *
25
+ * #### Example 3
26
+ *
27
+ * Using the default export from the `app` package:
28
+ *
29
+ * ```js
30
+ * import firebase from '@react-native-firebase/app';
31
+ * import '@react-native-firebase/app-check';
32
+ *
33
+ * // firebase.appCheck().X
34
+ * ```
35
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
36
+ * @firebase app-check
37
+ */
38
+ export declare namespace FirebaseAppCheckTypes {
39
+ type FirebaseModule = ReactNativeFirebase.FirebaseModule;
40
+ /**
41
+ * An App Check provider. This can be either the built-in reCAPTCHA provider
42
+ * or a custom provider. For more on custom providers, see
43
+ * https://firebase.google.com/docs/app-check/web-custom-provider
44
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
45
+ */
46
+ export interface AppCheckProvider {
47
+ /**
48
+ * Returns an AppCheck token.
49
+ */
50
+ getToken(): Promise<AppCheckToken>;
51
+ }
52
+ /**
53
+ * Custom provider class.
54
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
55
+ * @public
56
+ */
57
+ export class CustomProvider implements AppCheckProvider {
58
+ constructor(customProviderOptions: CustomProviderOptions);
59
+ getToken(): Promise<AppCheckToken>;
60
+ }
61
+ /**
62
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
63
+ */
64
+ export interface CustomProviderOptions {
65
+ /**
66
+ * Function to get an App Check token through a custom provider
67
+ * service.
68
+ */
69
+ getToken: () => Promise<AppCheckToken>;
70
+ }
71
+ /**
72
+ * Options for App Check initialization.
73
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
74
+ */
75
+ export interface AppCheckOptions {
76
+ /**
77
+ * The App Check provider to use. This can be either the built-in reCAPTCHA provider
78
+ * or a custom provider.
79
+ */
80
+ provider: CustomProvider | ReactNativeFirebaseAppCheckProvider;
81
+ /**
82
+ * If true, enables SDK to automatically
83
+ * refresh AppCheck token as needed. If undefined, the value will default
84
+ * to the value of `app.automaticDataCollectionEnabled`. That property
85
+ * defaults to false and can be set in the app config.
86
+ */
87
+ isTokenAutoRefreshEnabled?: boolean;
88
+ }
89
+ /**
90
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
91
+ */
92
+ export type NextFn<T> = (value: T) => void;
93
+ export type ErrorFn = (error: Error) => void;
94
+ export type CompleteFn = () => void;
95
+ /**
96
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
97
+ */
98
+ export interface Observer<T> {
99
+ next: NextFn<T>;
100
+ error: ErrorFn;
101
+ complete: CompleteFn;
102
+ }
103
+ /**
104
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
105
+ */
106
+ export type PartialObserver<T> = Partial<Observer<T>>;
107
+ /**
108
+ * A function that unsubscribes from token changes.
109
+ */
110
+ export type Unsubscribe = () => void;
111
+ /**
112
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
113
+ */
114
+ export interface ReactNativeFirebaseAppCheckProviderOptions {
115
+ /**
116
+ * debug token to use, if any. Defaults to undefined, pre-configure tokens in firebase web console if needed
117
+ */
118
+ debugToken?: string;
119
+ }
120
+ /**
121
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
122
+ */
123
+ export interface ReactNativeFirebaseAppCheckProviderWebOptions extends ReactNativeFirebaseAppCheckProviderOptions {
124
+ /**
125
+ * The web provider to use, either `reCaptchaV3` or `reCaptchaEnterprise`, defaults to `reCaptchaV3`
126
+ */
127
+ provider?: 'debug' | 'reCaptchaV3' | 'reCaptchaEnterprise';
128
+ /**
129
+ * siteKey for use in web queries, defaults to `none`
130
+ */
131
+ siteKey?: string;
132
+ }
133
+ /**
134
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
135
+ */
136
+ export interface ReactNativeFirebaseAppCheckProviderAppleOptions extends ReactNativeFirebaseAppCheckProviderOptions {
137
+ /**
138
+ * The apple provider to use, either `deviceCheck` or `appAttest`, or `appAttestWithDeviceCheckFallback`,
139
+ * defaults to `DeviceCheck`. `appAttest` requires iOS 14+ or will fail, `appAttestWithDeviceCheckFallback`
140
+ * will use `appAttest` for iOS14+ and fallback to `deviceCheck` on devices with ios13 and lower
141
+ */
142
+ provider?: 'debug' | 'deviceCheck' | 'appAttest' | 'appAttestWithDeviceCheckFallback';
143
+ }
144
+ /**
145
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
146
+ */
147
+ export interface ReactNativeFirebaseAppCheckProviderAndroidOptions extends ReactNativeFirebaseAppCheckProviderOptions {
148
+ /**
149
+ * The android provider to use, either `debug` or `playIntegrity`. default is `playIntegrity`.
150
+ */
151
+ provider?: 'debug' | 'playIntegrity';
152
+ }
153
+ /**
154
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
155
+ */
156
+ export interface ReactNativeFirebaseAppCheckProvider extends AppCheckProvider {
157
+ /**
158
+ * Specify how the app check provider should be configured. The new configuration is
159
+ * in effect when this call returns. You must call `getToken()`
160
+ * after this call to get a token using the new configuration.
161
+ * This custom provider allows for delayed configuration and re-configuration on all platforms
162
+ * so AppCheck has the same experience across all platforms, with the only difference being the native
163
+ * providers you choose to use on each platform.
164
+ */
165
+ configure(options: {
166
+ web?: ReactNativeFirebaseAppCheckProviderWebOptions;
167
+ android?: ReactNativeFirebaseAppCheckProviderAndroidOptions;
168
+ apple?: ReactNativeFirebaseAppCheckProviderAppleOptions;
169
+ isTokenAutoRefreshEnabled?: boolean;
170
+ }): void;
171
+ }
172
+ /**
173
+ * Result returned by `getToken()`.
174
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
175
+ */
176
+ export interface AppCheckTokenResult {
177
+ /**
178
+ * The token string in JWT format.
179
+ */
180
+ readonly token: string;
181
+ }
182
+ /**
183
+ * The token returned from an `AppCheckProvider`.
184
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
185
+ */
186
+ export interface AppCheckToken {
187
+ /**
188
+ * The token string in JWT format.
189
+ */
190
+ readonly token: string;
191
+ /**
192
+ * The local timestamp after which the token will expire.
193
+ */
194
+ readonly expireTimeMillis: number;
195
+ }
196
+ /**
197
+ * The result return from `onTokenChanged`
198
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
199
+ */
200
+ export type AppCheckListenerResult = AppCheckToken & {
201
+ readonly appName: string;
202
+ };
203
+ /**
204
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
205
+ */
206
+ export interface Statics {
207
+ CustomProvider: typeof CustomProvider;
208
+ SDK_VERSION: string;
209
+ }
210
+ /**
211
+ * The Firebase App Check service is available for the default app or a given app.
212
+ *
213
+ * #### Example 1
214
+ *
215
+ * Get the appCheck instance for the **default app**:
216
+ *
217
+ * ```js
218
+ * const appCheckForDefaultApp = firebase.appCheck();
219
+ * ```
220
+ *
221
+ * #### Example 2
222
+ *
223
+ * Get the appCheck instance for a **secondary app**:
224
+ *˚
225
+ * ```js
226
+ * const otherApp = firebase.app('otherApp');
227
+ * const appCheckForOtherApp = firebase.appCheck(otherApp);
228
+ * ```
229
+ *
230
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
231
+ */
232
+ export interface Module extends FirebaseModule {
233
+ /**
234
+ * The current `FirebaseApp` instance for this Firebase service.
235
+ */
236
+ app: ReactNativeFirebase.FirebaseApp;
237
+ /**
238
+ * Create a ReactNativeFirebaseAppCheckProvider option for use in react-native-firebase
239
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
240
+ */
241
+ newReactNativeFirebaseAppCheckProvider(): ReactNativeFirebaseAppCheckProvider;
242
+ /**
243
+ * Initialize the AppCheck module. Note that in react-native-firebase AppCheckOptions must always
244
+ * be an object with a `provider` member containing `ReactNativeFirebaseAppCheckProvider` that has returned successfully
245
+ * from a call to the `configure` method, with sub-providers for the various platforms configured to meet your project
246
+ * requirements. This must be called prior to interacting with any firebase services protected by AppCheck
247
+ *
248
+ * @param options an AppCheckOptions with a configured ReactNativeFirebaseAppCheckProvider as the provider
249
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
250
+ */
251
+ initializeAppCheck(options: AppCheckOptions): Promise<void>;
252
+ /**
253
+ * Activate App Check
254
+ * On iOS App Check is activated with DeviceCheck provider simply by including the module, using the token auto refresh default or
255
+ * the specific value (if configured) in firebase.json, but calling this does no harm.
256
+ * On Android if you call this it will install the PlayIntegrity provider in release builds, the Debug provider if debuggable.
257
+ * On both platforms you may use this method to alter the token refresh setting after startup.
258
+ * On iOS if you want to set a specific AppCheckProviderFactory (for instance to FIRAppCheckDebugProviderFactory or
259
+ * FIRAppAttestProvider) you must manually do that in your AppDelegate.m prior to calling [FIRApp configure]
260
+ *
261
+ * @deprecated use initializeAppCheck to gain access to all platform providers and firebase-js-sdk v9 compatibility
262
+ * @param siteKeyOrProvider - This is ignored, Android uses DebugProviderFactory if the app is debuggable (https://firebase.google.com/docs/app-check/android/debug-provider)
263
+ * Android uses PlayIntegrityProviderFactory for release builds.
264
+ * iOS uses DeviceCheckProviderFactory by default unless altered in AppDelegate.m manually
265
+ * @param isTokenAutoRefreshEnabled - If true, enables SDK to automatically
266
+ * refresh AppCheck token as needed. If undefined, the value will default
267
+ * to the value of `app.automaticDataCollectionEnabled`. That property
268
+ * defaults to false and can be set in the app config.
269
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
270
+ */
271
+ activate(siteKeyOrProvider: string | AppCheckProvider, isTokenAutoRefreshEnabled?: boolean): Promise<void>;
272
+ /**
273
+ * Alter the token auto refresh setting. By default it will take the value of automaticDataCollectionEnabled from Info.plist / AndroidManifest.xml
274
+ * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
275
+ * refreshes App Check tokens as needed. This overrides any value set
276
+ * during `activate()` or taken by default from automaticDataCollectionEnabled in plist / android manifest
277
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
278
+ */
279
+ setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void;
280
+ /**
281
+ * Requests Firebase App Check token.
282
+ * This method should only be used if you need to authorize requests to a non-Firebase backend.
283
+ * Requests to Firebase backend are authorized automatically if configured.
284
+ *
285
+ * @param forceRefresh - If true, a new Firebase App Check token is requested and the token cache is ignored.
286
+ * If false, the cached token is used if it exists and has not expired yet.
287
+ * In most cases, false should be used. True should only be used if the server explicitly returns an error, indicating a revoked token.
288
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
289
+ */
290
+ getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
291
+ /**
292
+ * Requests a Firebase App Check token. This method should be used only if you need to authorize requests
293
+ * to a non-Firebase backend. Returns limited-use tokens that are intended for use with your non-Firebase
294
+ * backend endpoints that are protected with Replay Protection (https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
295
+ * This method does not affect the token generation behavior of the getAppCheckToken() method.
296
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
297
+ */
298
+ getLimitedUseToken(): Promise<AppCheckTokenResult>;
299
+ /**
300
+ * Registers a listener to changes in the token state. There can be more
301
+ * than one listener registered at the same time for one or more
302
+ * App Check instances. The listeners call back on the UI thread whenever
303
+ * the current token associated with this App Check instance changes.
304
+ *
305
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
306
+ * @returns A function that unsubscribes this listener.
307
+ */
308
+ onTokenChanged(observer: PartialObserver<AppCheckListenerResult>): () => void;
309
+ /**
310
+ * Registers a listener to changes in the token state. There can be more
311
+ * than one listener registered at the same time for one or more
312
+ * App Check instances. The listeners call back on the UI thread whenever
313
+ * the current token associated with this App Check instance changes.
314
+ *
315
+ * Token listeners do not exist in the native SDK for iOS, no token change events will be emitted on that platform.
316
+ * This is not yet implemented on Android, no token change events will be emitted until implemented.
317
+ *
318
+ * NOTE: Although an `onError` callback can be provided, it will
319
+ * never be called, Android sdk code doesn't provide handling for onError function
320
+ *
321
+ * NOTE: Although an `onCompletion` callback can be provided, it will
322
+ * never be called because the token stream is never-ending.
323
+ *
324
+ * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
325
+ * @returns A function that unsubscribes this listener.
326
+ */
327
+ onTokenChanged(onNext: (tokenResult: AppCheckListenerResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): () => void;
328
+ }
329
+ export {};
330
+ }
331
+ type AppCheckNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseAppCheckTypes.Module, FirebaseAppCheckTypes.Statics> & {
332
+ appCheck: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseAppCheckTypes.Module, FirebaseAppCheckTypes.Statics>;
333
+ firebase: ReactNativeFirebase.Module;
334
+ app(name?: string): ReactNativeFirebase.FirebaseApp;
335
+ };
336
+ declare const defaultExport: AppCheckNamespace;
337
+ export declare const firebase: ReactNativeFirebase.Module & {
338
+ appCheck: typeof defaultExport;
339
+ app(name?: string): ReactNativeFirebase.FirebaseApp & {
340
+ appCheck(): FirebaseAppCheckTypes.Module;
341
+ };
342
+ };
343
+ export default defaultExport;
344
+ /**
345
+ * Attach namespace to `firebase.` and `FirebaseApp.`.
346
+ */
347
+ declare module '@react-native-firebase/app' {
348
+ namespace ReactNativeFirebase {
349
+ import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
350
+ interface Module {
351
+ appCheck: FirebaseModuleWithStaticsAndApp<FirebaseAppCheckTypes.Module, FirebaseAppCheckTypes.Statics>;
352
+ }
353
+ interface FirebaseApp {
354
+ appCheck(): FirebaseAppCheckTypes.Module;
355
+ }
356
+ }
357
+ }
358
+ //# sourceMappingURL=namespaced.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespaced.d.ts","sourceRoot":"","sources":["../../../../lib/types/namespaced.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,yBAAiB,qBAAqB,CAAC;IACrC,KAAK,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;IAEzD;;;;;OAKG;IACH,MAAM,WAAW,gBAAgB;QAC/B;;WAEG;QACH,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;KACpC;IAED;;;;OAIG;IACH,aAAqB,cAAe,YAAW,gBAAgB;oBACjD,qBAAqB,EAAE,qBAAqB;QACxD,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC;KACnC;IACD;;OAEG;IACH,MAAM,WAAW,qBAAqB;QACpC;;;WAGG;QACH,QAAQ,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;KACxC;IACD;;;OAGG;IACH,MAAM,WAAW,eAAe;QAC9B;;;WAGG;QACH,QAAQ,EAAE,cAAc,GAAG,mCAAmC,CAAC;QAE/D;;;;;WAKG;QACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;KACrC;IAED;;OAEG;IACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IA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qB,CAAC,OAAO,CAC9B,CAAC;SACH;QACD,UAAU,WAAW;YACnB,QAAQ,IAAI,qBAAqB,CAAC,MAAM,CAAC;SAC1C;KACF;CACF"}
@@ -1,2 +1,2 @@
1
- export declare const version = "24.1.1";
1
+ export declare const version = "25.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
- declare const module: Record<string, never>;
2
- export default module;
1
+ declare const noopNativeModule: Record<string, never>;
2
+ export default noopNativeModule;
3
3
  //# sourceMappingURL=RNFBAppCheckModule.android.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RNFBAppCheckModule.android.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBAppCheckModule.android.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,CAAC;AAEzC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"RNFBAppCheckModule.android.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBAppCheckModule.android.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,CAAC;AAEnD,eAAe,gBAAgB,CAAC"}
@@ -1,9 +1,9 @@
1
- import type { FirebaseAppCheckTypes } from '../types/appcheck';
1
+ import { type AppCheckOptions, type AppCheckTokenResult } from '@react-native-firebase/app/dist/module/internal/web/firebaseAppCheck';
2
2
  interface AppCheckModule {
3
- initializeAppCheck(appName: string, options: FirebaseAppCheckTypes.AppCheckOptions): Promise<void>;
3
+ initializeAppCheck(appName: string, options: AppCheckOptions): Promise<void>;
4
4
  setTokenAutoRefreshEnabled(appName: string, isTokenAutoRefreshEnabled: boolean): Promise<void>;
5
- getLimitedUseToken(appName: string): Promise<FirebaseAppCheckTypes.AppCheckTokenResult>;
6
- getToken(appName: string, forceRefresh: boolean): Promise<FirebaseAppCheckTypes.AppCheckTokenResult>;
5
+ getLimitedUseToken(appName: string): Promise<AppCheckTokenResult>;
6
+ getToken(appName: string, forceRefresh: boolean): Promise<AppCheckTokenResult>;
7
7
  addAppCheckListener(appName: string): Promise<void>;
8
8
  removeAppCheckListener(appName: string): Promise<void>;
9
9
  }
@@ -13,6 +13,6 @@ interface AppCheckModule {
13
13
  * the native android/ios modules e.g. `@ReactMethod` annotated
14
14
  * java methods on Android.
15
15
  */
16
- declare const module: AppCheckModule;
17
- export default module;
16
+ declare const appCheckWebModule: AppCheckModule;
17
+ export default appCheckWebModule;
18
18
  //# sourceMappingURL=RNFBAppCheckModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RNFBAppCheckModule.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBAppCheckModule.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAc/D,UAAU,cAAc;IACtB,kBAAkB,CAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,qBAAqB,CAAC,eAAe,GAC7C,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;IACxF,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;IACtD,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED;;;;;GAKG;AACH,QAAA,MAAM,MAAM,EAAE,cAkEb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"RNFBAppCheckModule.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBAppCheckModule.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACzB,MAAM,sEAAsE,CAAC;AAe9E,UAAU,cAAc;IACtB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/E,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,EAAE,cAkExB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,3 +1,3 @@
1
- declare const module: Record<string, never>;
2
- export default module;
1
+ declare const noopNativeModule: Record<string, never>;
2
+ export default noopNativeModule;
3
3
  //# sourceMappingURL=RNFBAppCheckModule.ios.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RNFBAppCheckModule.ios.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBAppCheckModule.ios.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,CAAC;AAEzC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"RNFBAppCheckModule.ios.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBAppCheckModule.ios.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,CAAC;AAEnD,eAAe,gBAAgB,CAAC"}
package/lib/index.ts CHANGED
@@ -16,31 +16,12 @@
16
16
  */
17
17
 
18
18
  // Export types from types/appcheck
19
- export type {
20
- AppCheckProvider,
21
- CustomProviderOptions,
22
- AppCheckOptions,
23
- AppCheckToken,
24
- AppCheckTokenResult,
25
- AppCheckListenerResult,
26
- PartialObserver,
27
- Observer,
28
- NextFn,
29
- ErrorFn,
30
- CompleteFn,
31
- Unsubscribe,
32
- ReactNativeFirebaseAppCheckProviderOptions,
33
- ReactNativeFirebaseAppCheckProviderWebOptions,
34
- ReactNativeFirebaseAppCheckProviderAppleOptions,
35
- ReactNativeFirebaseAppCheckProviderAndroidOptions,
36
- ReactNativeFirebaseAppCheckProvider,
37
- AppCheck,
38
- FirebaseAppCheckTypes,
39
- } from './types/appcheck';
19
+ export type * from './types/appcheck';
40
20
 
41
21
  // Export modular API functions
42
22
  export * from './modular';
43
23
 
44
24
  // Export namespaced API
25
+ export type { FirebaseAppCheckTypes } from './types/namespaced';
45
26
  export * from './namespaced';
46
27
  export { default } from './namespaced';
package/lib/modular.ts CHANGED
@@ -15,9 +15,8 @@
15
15
  *
16
16
  */
17
17
 
18
- import { getApp, type ReactNativeFirebase } from '@react-native-firebase/app';
18
+ import { getApp, type FirebaseApp } from '@react-native-firebase/app';
19
19
  import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
20
- import ReactNativeFirebaseAppCheckProvider from './ReactNativeFirebaseAppCheckProvider';
21
20
 
22
21
  import type {
23
22
  AppCheck,
@@ -25,8 +24,14 @@ import type {
25
24
  AppCheckTokenResult,
26
25
  PartialObserver,
27
26
  Unsubscribe,
28
- AppCheckListenerResult,
29
27
  } from './types/appcheck';
28
+ import type { AppCheckInternal } from './types/internal';
29
+
30
+ export { CustomProvider, ReactNativeFirebaseAppCheckProvider } from './providers';
31
+
32
+ type WithModularDeprecationArg<F> = F extends (...args: infer P) => infer R
33
+ ? (...args: [...P, typeof MODULAR_DEPRECATION_ARG]) => R
34
+ : never;
30
35
 
31
36
  /**
32
37
  * Activate App Check for the given app. Can be called only once per app.
@@ -35,20 +40,16 @@ import type {
35
40
  * @returns Promise<AppCheck>
36
41
  */
37
42
  export async function initializeAppCheck(
38
- app?: ReactNativeFirebase.FirebaseApp,
43
+ app?: FirebaseApp,
39
44
  options?: AppCheckOptions,
40
45
  ): Promise<AppCheck> {
41
- if (app) {
42
- const appInstance = getApp(app.name) as ReactNativeFirebase.FirebaseApp;
43
- const appCheck = appInstance.appCheck();
44
- // @ts-ignore - Extra arg used by deprecation proxy to detect modular calls
45
- await appCheck.initializeAppCheck.call(appCheck, options, MODULAR_DEPRECATION_ARG);
46
- return appCheck;
47
- }
48
- const appInstance = getApp() as ReactNativeFirebase.FirebaseApp;
46
+ const appInstance = app ? (getApp(app.name) as FirebaseApp) : (getApp() as FirebaseApp);
49
47
  const appCheck = appInstance.appCheck();
50
- // @ts-ignore - Extra arg used by deprecation proxy to detect modular calls
51
- await appCheck.initializeAppCheck.call(appCheck, options, MODULAR_DEPRECATION_ARG);
48
+ await (
49
+ (appCheck as AppCheckInternal).initializeAppCheck as WithModularDeprecationArg<
50
+ AppCheckInternal['initializeAppCheck']
51
+ >
52
+ ).call(appCheck, options as AppCheckOptions, MODULAR_DEPRECATION_ARG);
52
53
  return appCheck;
53
54
  }
54
55
 
@@ -63,12 +64,11 @@ export function getToken(
63
64
  appCheckInstance: AppCheck,
64
65
  forceRefresh?: boolean,
65
66
  ): Promise<AppCheckTokenResult> {
66
- return appCheckInstance.getToken.call(
67
- appCheckInstance,
68
- forceRefresh,
69
- // @ts-ignore - Extra arg used by deprecation proxy to detect modular calls
70
- MODULAR_DEPRECATION_ARG,
71
- ) as Promise<AppCheckTokenResult>;
67
+ return (
68
+ (appCheckInstance as AppCheckInternal).getToken as WithModularDeprecationArg<
69
+ AppCheckInternal['getToken']
70
+ >
71
+ ).call(appCheckInstance, forceRefresh, MODULAR_DEPRECATION_ARG) as Promise<AppCheckTokenResult>;
72
72
  }
73
73
 
74
74
  /**
@@ -78,11 +78,11 @@ export function getToken(
78
78
  * @returns Promise<AppCheckTokenResult>
79
79
  */
80
80
  export function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult> {
81
- return appCheckInstance.getLimitedUseToken.call(
82
- appCheckInstance,
83
- // @ts-ignore - Extra arg used by deprecation proxy to detect modular calls
84
- MODULAR_DEPRECATION_ARG,
85
- ) as Promise<AppCheckTokenResult>;
81
+ return (
82
+ (appCheckInstance as AppCheckInternal).getLimitedUseToken as WithModularDeprecationArg<
83
+ AppCheckInternal['getLimitedUseToken']
84
+ >
85
+ ).call(appCheckInstance, MODULAR_DEPRECATION_ARG) as Promise<AppCheckTokenResult>;
86
86
  }
87
87
 
88
88
  /**
@@ -94,12 +94,11 @@ export function setTokenAutoRefreshEnabled(
94
94
  appCheckInstance: AppCheck,
95
95
  isAutoRefreshEnabled: boolean,
96
96
  ): void {
97
- appCheckInstance.setTokenAutoRefreshEnabled.call(
98
- appCheckInstance,
99
- isAutoRefreshEnabled,
100
- // @ts-ignore - Extra arg used by deprecation proxy to detect modular calls
101
- MODULAR_DEPRECATION_ARG,
102
- );
97
+ (
98
+ (appCheckInstance as AppCheckInternal).setTokenAutoRefreshEnabled as WithModularDeprecationArg<
99
+ AppCheckInternal['setTokenAutoRefreshEnabled']
100
+ >
101
+ ).call(appCheckInstance, isAutoRefreshEnabled, MODULAR_DEPRECATION_ARG);
103
102
  }
104
103
 
105
104
  /**
@@ -109,12 +108,12 @@ export function setTokenAutoRefreshEnabled(
109
108
  * the current token associated with this App Check instance changes.
110
109
  *
111
110
  * @param appCheckInstance - The App Check instance.
112
- * @param listener - The listener to register.
111
+ * @param observer - The listener to register.
113
112
  * @returns Unsubscribe
114
113
  */
115
114
  export function onTokenChanged(
116
115
  appCheckInstance: AppCheck,
117
- listener: PartialObserver<AppCheckTokenResult>,
116
+ observer: PartialObserver<AppCheckTokenResult>,
118
117
  ): Unsubscribe;
119
118
 
120
119
  /**
@@ -131,7 +130,7 @@ export function onTokenChanged(
131
130
  */
132
131
  export function onTokenChanged(
133
132
  appCheckInstance: AppCheck,
134
- onNext: (tokenResult: AppCheckListenerResult) => void,
133
+ onNext: (tokenResult: AppCheckTokenResult) => void,
135
134
  onError?: (error: Error) => void,
136
135
  onCompletion?: () => void,
137
136
  ): Unsubscribe;
@@ -140,18 +139,19 @@ export function onTokenChanged(
140
139
  appCheckInstance: AppCheck,
141
140
  onNextOrObserver:
142
141
  | PartialObserver<AppCheckTokenResult>
143
- | ((tokenResult: AppCheckListenerResult) => void),
142
+ | ((tokenResult: AppCheckTokenResult) => void),
144
143
  onError?: (error: Error) => void,
145
144
  onCompletion?: () => void,
146
145
  ): Unsubscribe {
147
- return appCheckInstance.onTokenChanged.call(
146
+ return (
147
+ (appCheckInstance as AppCheckInternal).onTokenChanged as WithModularDeprecationArg<
148
+ AppCheckInternal['onTokenChanged']
149
+ >
150
+ ).call(
148
151
  appCheckInstance,
149
152
  onNextOrObserver,
150
153
  onError,
151
154
  onCompletion,
152
- // @ts-ignore - Extra arg used by deprecation proxy to detect modular calls
153
155
  MODULAR_DEPRECATION_ARG,
154
156
  ) as Unsubscribe;
155
157
  }
156
-
157
- export { ReactNativeFirebaseAppCheckProvider };