@react-native-firebase/app-check 25.0.1 → 26.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 (67) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/RNFBAppCheck.podspec +18 -6
  3. package/android/build.gradle +19 -0
  4. package/android/src/main/java/io/invertase/firebase/appcheck/{ReactNativeFirebaseAppCheckModule.java → NativeRNFBTurboAppCheck.java} +46 -34
  5. package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckPackage.java +1 -1
  6. package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckProvider.java +9 -0
  7. package/android/src/main/java/io/invertase/firebase/appcheck/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboAppCheckSpec.java +67 -0
  8. package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/CMakeLists.txt +36 -0
  9. package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/RNFBAppCheckTurboModules-generated.cpp +74 -0
  10. package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/RNFBAppCheckTurboModules.h +31 -0
  11. package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/react/renderer/components/RNFBAppCheckTurboModules/RNFBAppCheckTurboModulesJSI-generated.cpp +85 -0
  12. package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/react/renderer/components/RNFBAppCheckTurboModules/RNFBAppCheckTurboModulesJSI.h +174 -0
  13. package/app.plugin.js +1 -1
  14. package/dist/module/index.js +210 -6
  15. package/dist/module/index.js.map +1 -1
  16. package/dist/module/version.js +1 -1
  17. package/dist/typescript/lib/index.d.ts +19 -4
  18. package/dist/typescript/lib/index.d.ts.map +1 -1
  19. package/dist/typescript/lib/types/appcheck.d.ts +5 -0
  20. package/dist/typescript/lib/types/appcheck.d.ts.map +1 -1
  21. package/dist/typescript/lib/types/internal.d.ts +1 -1
  22. package/dist/typescript/lib/types/internal.d.ts.map +1 -1
  23. package/dist/typescript/lib/version.d.ts +1 -1
  24. package/ios/RNFBAppCheck/RNFBAppCheckModule.h +3 -8
  25. package/ios/RNFBAppCheck/{RNFBAppCheckModule.m → RNFBAppCheckModule.mm} +66 -43
  26. package/ios/RNFBAppCheck/RNFBAppCheckProvider.m +11 -1
  27. package/ios/RNFBAppCheck.xcodeproj/project.pbxproj +8 -8
  28. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  29. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  30. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  31. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  32. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  33. package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  34. package/ios/generated/RNFBAppCheckTurboModules/RNFBAppCheckTurboModules-generated.mm +88 -0
  35. package/ios/generated/RNFBAppCheckTurboModules/RNFBAppCheckTurboModules.h +85 -0
  36. package/ios/generated/RNFBAppCheckTurboModulesJSI-generated.cpp +85 -0
  37. package/ios/generated/RNFBAppCheckTurboModulesJSI.h +174 -0
  38. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  39. package/lib/index.ts +335 -8
  40. package/lib/types/appcheck.ts +6 -0
  41. package/lib/types/internal.ts +1 -1
  42. package/lib/version.ts +1 -1
  43. package/package.json +30 -5
  44. package/plugin/build/app.plugin.d.ts +2 -0
  45. package/plugin/build/app.plugin.js +6 -0
  46. package/plugin/build/ios/appDelegate.js +18 -4
  47. package/plugin/src/app.plugin.ts +3 -0
  48. package/plugin/src/ios/appDelegate.ts +23 -4
  49. package/plugin/tsconfig.tsbuildinfo +1 -1
  50. package/react-native.config.js +10 -0
  51. package/specs/NativeRNFBTurboAppCheck.ts +27 -0
  52. package/typedoc.json +1 -1
  53. package/dist/module/modular.js +0 -93
  54. package/dist/module/modular.js.map +0 -1
  55. package/dist/module/namespaced.js +0 -194
  56. package/dist/module/namespaced.js.map +0 -1
  57. package/dist/module/types/namespaced.js +0 -60
  58. package/dist/module/types/namespaced.js.map +0 -1
  59. package/dist/typescript/lib/modular.d.ts +0 -56
  60. package/dist/typescript/lib/modular.d.ts.map +0 -1
  61. package/dist/typescript/lib/namespaced.d.ts +0 -12
  62. package/dist/typescript/lib/namespaced.d.ts.map +0 -1
  63. package/dist/typescript/lib/types/namespaced.d.ts +0 -358
  64. package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
  65. package/lib/modular.ts +0 -157
  66. package/lib/namespaced.ts +0 -286
  67. package/lib/types/namespaced.ts +0 -422
@@ -1,422 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- import type { ReactNativeFirebase } from '@react-native-firebase/app';
19
-
20
- /**
21
- * Firebase App Check package for React Native.
22
- *
23
- * #### Example 1
24
- *
25
- * Access the firebase export from the `appCheck` package:
26
- *
27
- * ```js
28
- * import { firebase } from '@react-native-firebase/app-check';
29
- *
30
- * // firebase.appCheck().X
31
- * ```
32
- *
33
- * #### Example 2
34
- *
35
- * Using the default export from the `appCheck` package:
36
- *
37
- * ```js
38
- * import appCheck from '@react-native-firebase/app-check';
39
- *
40
- * // appCheck().X
41
- * ```
42
- *
43
- * #### Example 3
44
- *
45
- * Using the default export from the `app` package:
46
- *
47
- * ```js
48
- * import firebase from '@react-native-firebase/app';
49
- * import '@react-native-firebase/app-check';
50
- *
51
- * // firebase.appCheck().X
52
- * ```
53
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
54
- * @firebase app-check
55
- */
56
- /* eslint-disable @typescript-eslint/no-namespace */
57
- export namespace FirebaseAppCheckTypes {
58
- type FirebaseModule = ReactNativeFirebase.FirebaseModule;
59
-
60
- /**
61
- * An App Check provider. This can be either the built-in reCAPTCHA provider
62
- * or a custom provider. For more on custom providers, see
63
- * https://firebase.google.com/docs/app-check/web-custom-provider
64
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
65
- */
66
- export interface AppCheckProvider {
67
- /**
68
- * Returns an AppCheck token.
69
- */
70
- getToken(): Promise<AppCheckToken>;
71
- }
72
-
73
- /**
74
- * Custom provider class.
75
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
76
- * @public
77
- */
78
- export declare class CustomProvider implements AppCheckProvider {
79
- constructor(customProviderOptions: CustomProviderOptions);
80
- getToken(): Promise<AppCheckToken>;
81
- }
82
- /**
83
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
84
- */
85
- export interface CustomProviderOptions {
86
- /**
87
- * Function to get an App Check token through a custom provider
88
- * service.
89
- */
90
- getToken: () => Promise<AppCheckToken>;
91
- }
92
- /**
93
- * Options for App Check initialization.
94
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
95
- */
96
- export interface AppCheckOptions {
97
- /**
98
- * The App Check provider to use. This can be either the built-in reCAPTCHA provider
99
- * or a custom provider.
100
- */
101
- provider: CustomProvider | ReactNativeFirebaseAppCheckProvider;
102
-
103
- /**
104
- * If true, enables SDK to automatically
105
- * refresh AppCheck token as needed. If undefined, the value will default
106
- * to the value of `app.automaticDataCollectionEnabled`. That property
107
- * defaults to false and can be set in the app config.
108
- */
109
- isTokenAutoRefreshEnabled?: boolean;
110
- }
111
-
112
- /**
113
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
114
- */
115
- export type NextFn<T> = (value: T) => void;
116
- export type ErrorFn = (error: Error) => void;
117
- export type CompleteFn = () => void;
118
-
119
- /**
120
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
121
- */
122
- export interface Observer<T> {
123
- next: NextFn<T>;
124
- error: ErrorFn;
125
- complete: CompleteFn;
126
- }
127
-
128
- /**
129
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
130
- */
131
- export type PartialObserver<T> = Partial<Observer<T>>;
132
-
133
- /**
134
- * A function that unsubscribes from token changes.
135
- */
136
- export type Unsubscribe = () => void;
137
-
138
- /**
139
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
140
- */
141
- export interface ReactNativeFirebaseAppCheckProviderOptions {
142
- /**
143
- * debug token to use, if any. Defaults to undefined, pre-configure tokens in firebase web console if needed
144
- */
145
- debugToken?: string;
146
- }
147
-
148
- /**
149
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
150
- */
151
- export interface ReactNativeFirebaseAppCheckProviderWebOptions extends ReactNativeFirebaseAppCheckProviderOptions {
152
- /**
153
- * The web provider to use, either `reCaptchaV3` or `reCaptchaEnterprise`, defaults to `reCaptchaV3`
154
- */
155
- provider?: 'debug' | 'reCaptchaV3' | 'reCaptchaEnterprise';
156
-
157
- /**
158
- * siteKey for use in web queries, defaults to `none`
159
- */
160
- siteKey?: string;
161
- }
162
-
163
- /**
164
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
165
- */
166
- export interface ReactNativeFirebaseAppCheckProviderAppleOptions extends ReactNativeFirebaseAppCheckProviderOptions {
167
- /**
168
- * The apple provider to use, either `deviceCheck` or `appAttest`, or `appAttestWithDeviceCheckFallback`,
169
- * defaults to `DeviceCheck`. `appAttest` requires iOS 14+ or will fail, `appAttestWithDeviceCheckFallback`
170
- * will use `appAttest` for iOS14+ and fallback to `deviceCheck` on devices with ios13 and lower
171
- */
172
- provider?: 'debug' | 'deviceCheck' | 'appAttest' | 'appAttestWithDeviceCheckFallback';
173
- }
174
-
175
- /**
176
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
177
- */
178
- export interface ReactNativeFirebaseAppCheckProviderAndroidOptions extends ReactNativeFirebaseAppCheckProviderOptions {
179
- /**
180
- * The android provider to use, either `debug` or `playIntegrity`. default is `playIntegrity`.
181
- */
182
- provider?: 'debug' | 'playIntegrity';
183
- }
184
-
185
- /**
186
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
187
- */
188
- export interface ReactNativeFirebaseAppCheckProvider extends AppCheckProvider {
189
- /**
190
- * Specify how the app check provider should be configured. The new configuration is
191
- * in effect when this call returns. You must call `getToken()`
192
- * after this call to get a token using the new configuration.
193
- * This custom provider allows for delayed configuration and re-configuration on all platforms
194
- * so AppCheck has the same experience across all platforms, with the only difference being the native
195
- * providers you choose to use on each platform.
196
- */
197
- configure(options: {
198
- web?: ReactNativeFirebaseAppCheckProviderWebOptions;
199
- android?: ReactNativeFirebaseAppCheckProviderAndroidOptions;
200
- apple?: ReactNativeFirebaseAppCheckProviderAppleOptions;
201
- isTokenAutoRefreshEnabled?: boolean;
202
- }): void;
203
- }
204
-
205
- /**
206
- * Result returned by `getToken()`.
207
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
208
- */
209
- export interface AppCheckTokenResult {
210
- /**
211
- * The token string in JWT format.
212
- */
213
- readonly token: string;
214
- }
215
- /**
216
- * The token returned from an `AppCheckProvider`.
217
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
218
- */
219
- export interface AppCheckToken {
220
- /**
221
- * The token string in JWT format.
222
- */
223
- readonly token: string;
224
- /**
225
- * The local timestamp after which the token will expire.
226
- */
227
- readonly expireTimeMillis: number;
228
- }
229
- /**
230
- * The result return from `onTokenChanged`
231
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
232
- */
233
- export type AppCheckListenerResult = AppCheckToken & { readonly appName: string };
234
-
235
- /**
236
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
237
- */
238
- export interface Statics {
239
- // firebase.appCheck.* static props go here
240
- CustomProvider: typeof CustomProvider;
241
- SDK_VERSION: string;
242
- }
243
-
244
- /**
245
- * The Firebase App Check service is available for the default app or a given app.
246
- *
247
- * #### Example 1
248
- *
249
- * Get the appCheck instance for the **default app**:
250
- *
251
- * ```js
252
- * const appCheckForDefaultApp = firebase.appCheck();
253
- * ```
254
- *
255
- * #### Example 2
256
- *
257
- * Get the appCheck instance for a **secondary app**:
258
- *˚
259
- * ```js
260
- * const otherApp = firebase.app('otherApp');
261
- * const appCheckForOtherApp = firebase.appCheck(otherApp);
262
- * ```
263
- *
264
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
265
- */
266
- export interface Module extends FirebaseModule {
267
- /**
268
- * The current `FirebaseApp` instance for this Firebase service.
269
- */
270
- app: ReactNativeFirebase.FirebaseApp;
271
-
272
- /**
273
- * Create a ReactNativeFirebaseAppCheckProvider option for use in react-native-firebase
274
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
275
- */
276
- newReactNativeFirebaseAppCheckProvider(): ReactNativeFirebaseAppCheckProvider;
277
-
278
- /**
279
- * Initialize the AppCheck module. Note that in react-native-firebase AppCheckOptions must always
280
- * be an object with a `provider` member containing `ReactNativeFirebaseAppCheckProvider` that has returned successfully
281
- * from a call to the `configure` method, with sub-providers for the various platforms configured to meet your project
282
- * requirements. This must be called prior to interacting with any firebase services protected by AppCheck
283
- *
284
- * @param options an AppCheckOptions with a configured ReactNativeFirebaseAppCheckProvider as the provider
285
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
286
- */
287
- // TODO wrong types
288
- initializeAppCheck(options: AppCheckOptions): Promise<void>;
289
-
290
- /**
291
- * Activate App Check
292
- * On iOS App Check is activated with DeviceCheck provider simply by including the module, using the token auto refresh default or
293
- * the specific value (if configured) in firebase.json, but calling this does no harm.
294
- * On Android if you call this it will install the PlayIntegrity provider in release builds, the Debug provider if debuggable.
295
- * On both platforms you may use this method to alter the token refresh setting after startup.
296
- * On iOS if you want to set a specific AppCheckProviderFactory (for instance to FIRAppCheckDebugProviderFactory or
297
- * FIRAppAttestProvider) you must manually do that in your AppDelegate.m prior to calling [FIRApp configure]
298
- *
299
- * @deprecated use initializeAppCheck to gain access to all platform providers and firebase-js-sdk v9 compatibility
300
- * @param siteKeyOrProvider - This is ignored, Android uses DebugProviderFactory if the app is debuggable (https://firebase.google.com/docs/app-check/android/debug-provider)
301
- * Android uses PlayIntegrityProviderFactory for release builds.
302
- * iOS uses DeviceCheckProviderFactory by default unless altered in AppDelegate.m manually
303
- * @param isTokenAutoRefreshEnabled - If true, enables SDK to automatically
304
- * refresh AppCheck token as needed. If undefined, the value will default
305
- * to the value of `app.automaticDataCollectionEnabled`. That property
306
- * defaults to false and can be set in the app config.
307
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
308
- */
309
- activate(
310
- siteKeyOrProvider: string | AppCheckProvider,
311
- isTokenAutoRefreshEnabled?: boolean,
312
- ): Promise<void>;
313
-
314
- /**
315
- * Alter the token auto refresh setting. By default it will take the value of automaticDataCollectionEnabled from Info.plist / AndroidManifest.xml
316
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
317
- * refreshes App Check tokens as needed. This overrides any value set
318
- * during `activate()` or taken by default from automaticDataCollectionEnabled in plist / android manifest
319
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
320
- */
321
- setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void;
322
-
323
- /**
324
- * Requests Firebase App Check token.
325
- * This method should only be used if you need to authorize requests to a non-Firebase backend.
326
- * Requests to Firebase backend are authorized automatically if configured.
327
- *
328
- * @param forceRefresh - If true, a new Firebase App Check token is requested and the token cache is ignored.
329
- * If false, the cached token is used if it exists and has not expired yet.
330
- * In most cases, false should be used. True should only be used if the server explicitly returns an error, indicating a revoked token.
331
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
332
- */
333
- getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
334
-
335
- /**
336
- * Requests a Firebase App Check token. This method should be used only if you need to authorize requests
337
- * to a non-Firebase backend. Returns limited-use tokens that are intended for use with your non-Firebase
338
- * backend endpoints that are protected with Replay Protection (https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
339
- * This method does not affect the token generation behavior of the getAppCheckToken() method.
340
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
341
- */
342
- getLimitedUseToken(): Promise<AppCheckTokenResult>;
343
-
344
- /**
345
- * Registers a listener to changes in the token state. There can be more
346
- * than one listener registered at the same time for one or more
347
- * App Check instances. The listeners call back on the UI thread whenever
348
- * the current token associated with this App Check instance changes.
349
- *
350
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
351
- * @returns A function that unsubscribes this listener.
352
- */
353
- // TODO wrong types
354
- onTokenChanged(observer: PartialObserver<AppCheckListenerResult>): () => void;
355
-
356
- /**
357
- * Registers a listener to changes in the token state. There can be more
358
- * than one listener registered at the same time for one or more
359
- * App Check instances. The listeners call back on the UI thread whenever
360
- * the current token associated with this App Check instance changes.
361
- *
362
- * Token listeners do not exist in the native SDK for iOS, no token change events will be emitted on that platform.
363
- * This is not yet implemented on Android, no token change events will be emitted until implemented.
364
- *
365
- * NOTE: Although an `onError` callback can be provided, it will
366
- * never be called, Android sdk code doesn't provide handling for onError function
367
- *
368
- * NOTE: Although an `onCompletion` callback can be provided, it will
369
- * never be called because the token stream is never-ending.
370
- *
371
- * @deprecated Use the exported types directly instead. FirebaseAppCheckTypes namespace is kept for backwards compatibility.
372
- * @returns A function that unsubscribes this listener.
373
- */
374
- // TODO wrong types
375
- onTokenChanged(
376
- onNext: (tokenResult: AppCheckListenerResult) => void,
377
- onError?: (error: Error) => void,
378
- onCompletion?: () => void,
379
- ): () => void;
380
- }
381
- }
382
-
383
- type AppCheckNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
384
- FirebaseAppCheckTypes.Module,
385
- FirebaseAppCheckTypes.Statics
386
- > & {
387
- appCheck: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
388
- FirebaseAppCheckTypes.Module,
389
- FirebaseAppCheckTypes.Statics
390
- >;
391
- firebase: ReactNativeFirebase.Module;
392
- app(name?: string): ReactNativeFirebase.FirebaseApp;
393
- };
394
-
395
- declare const defaultExport: AppCheckNamespace;
396
-
397
- export declare const firebase: ReactNativeFirebase.Module & {
398
- appCheck: typeof defaultExport;
399
- app(
400
- name?: string,
401
- ): ReactNativeFirebase.FirebaseApp & { appCheck(): FirebaseAppCheckTypes.Module };
402
- };
403
-
404
- export default defaultExport;
405
-
406
- /**
407
- * Attach namespace to `firebase.` and `FirebaseApp.`.
408
- */
409
- declare module '@react-native-firebase/app' {
410
- namespace ReactNativeFirebase {
411
- import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
412
- interface Module {
413
- appCheck: FirebaseModuleWithStaticsAndApp<
414
- FirebaseAppCheckTypes.Module,
415
- FirebaseAppCheckTypes.Statics
416
- >;
417
- }
418
- interface FirebaseApp {
419
- appCheck(): FirebaseAppCheckTypes.Module;
420
- }
421
- }
422
- }