@react-native-firebase/app-check 24.1.0 → 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 +29 -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,19 @@
1
+ import type { AppCheckProvider, AppCheckToken, CustomProviderOptions, ReactNativeFirebaseAppCheckProviderOptionsMap as ProviderOptions } from './types/appcheck';
2
+ /**
3
+ * @public Use this to configure providers for android, iOS and "other" platforms.
4
+ */
5
+ export declare class ReactNativeFirebaseAppCheckProvider implements AppCheckProvider {
6
+ providerOptions?: ProviderOptions;
7
+ constructor(options?: ProviderOptions);
8
+ configure(options: ProviderOptions): void;
9
+ getToken(): Promise<AppCheckToken>;
10
+ }
11
+ /**
12
+ * @public Use this to configure a Custom Provider on "other" platform. This will not work on iOS and android.
13
+ */
14
+ export declare class CustomProvider implements AppCheckProvider {
15
+ private _customProviderOptions;
16
+ constructor(_customProviderOptions: CustomProviderOptions);
17
+ getToken(): Promise<AppCheckToken>;
18
+ }
19
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../lib/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,6CAA6C,IAAI,eAAe,EACjE,MAAM,kBAAkB,CAAC;AAG1B;;GAEG;AACH,qBAAa,mCAAoC,YAAW,gBAAgB;IAC1E,eAAe,CAAC,EAAE,eAAe,CAAC;gBAEtB,OAAO,CAAC,EAAE,eAAe;IAIrC,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAInC,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC;CAKzC;AAED;;GAEG;AACH,qBAAa,cAAe,YAAW,gBAAgB;IACrD,OAAO,CAAC,sBAAsB,CAAwB;gBAE1C,sBAAsB,EAAE,qBAAqB;IAUnD,QAAQ;CAGf"}
@@ -1,31 +1,34 @@
1
- import type { ReactNativeFirebase } from '@react-native-firebase/app';
1
+ import type { FirebaseApp } from '@react-native-firebase/app';
2
+ import type { CustomProvider, ReactNativeFirebaseAppCheckProvider } from '../providers';
3
+ export type { Unsubscribe, PartialObserver, } from '@react-native-firebase/app/dist/module/types/common';
2
4
  /**
3
- * An App Check provider. This can be either the built-in reCAPTCHA provider
4
- * or a custom provider. For more on custom providers, see
5
- * https://firebase.google.com/docs/app-check/web-custom-provider
5
+ * The Firebase App Check service interface.
6
+ *
7
+ * @public
6
8
  */
7
- export interface AppCheckProvider {
9
+ export interface AppCheck {
8
10
  /**
9
- * Returns an AppCheck token.
11
+ * this `AppCheck` instance is associated with this FirebaseApp.
10
12
  */
11
- getToken(): Promise<AppCheckToken>;
12
- }
13
- /**
14
- * Function to get an App Check token through a custom provider service.
15
- */
16
- export interface CustomProviderOptions {
17
- getToken: () => Promise<AppCheckToken>;
13
+ app: FirebaseApp;
18
14
  }
19
15
  /**
20
- * Custom provider class.
16
+ * The token returned from an `AppCheckProvider`.
21
17
  * @public
22
18
  */
23
- export declare class CustomProvider implements AppCheckProvider {
24
- constructor(customProviderOptions: CustomProviderOptions);
25
- getToken(): Promise<AppCheckToken>;
19
+ export interface AppCheckToken {
20
+ /**
21
+ * The token string in JWT format.
22
+ */
23
+ readonly token: string;
24
+ /**
25
+ * The local timestamp after which the token will expire.
26
+ */
27
+ readonly expireTimeMillis: number;
26
28
  }
27
29
  /**
28
30
  * Options for App Check initialization.
31
+ * @public
29
32
  */
30
33
  export interface AppCheckOptions {
31
34
  /**
@@ -43,20 +46,20 @@ export interface AppCheckOptions {
43
46
  isTokenAutoRefreshEnabled?: boolean;
44
47
  }
45
48
  /**
46
- * The token returned from an `AppCheckProvider`.
49
+ * Function to get an App Check token through a custom provider service. This is for
50
+ * "other" platform only, this is not supported on iOS and android.
51
+ * @public
47
52
  */
48
- export interface AppCheckToken {
49
- /**
50
- * The token string in JWT format.
51
- */
52
- readonly token: string;
53
+ export interface CustomProviderOptions {
53
54
  /**
54
- * The local timestamp after which the token will expire.
55
+ * Function to get an App Check token through a custom provider
56
+ * service.
55
57
  */
56
- readonly expireTimeMillis: number;
58
+ getToken: () => Promise<AppCheckToken>;
57
59
  }
58
60
  /**
59
61
  * Result returned by `getToken()`.
62
+ * @public
60
63
  */
61
64
  export interface AppCheckTokenResult {
62
65
  /**
@@ -65,30 +68,31 @@ export interface AppCheckTokenResult {
65
68
  readonly token: string;
66
69
  }
67
70
  /**
68
- * The result return from `onTokenChanged`
71
+ * An App Check provider. This can be either the built-in reCAPTCHA provider
72
+ * or a custom provider. For more on custom providers, see
73
+ * https://firebase.google.com/docs/app-check/web-custom-provider
74
+ * @public
69
75
  */
70
- export type AppCheckListenerResult = AppCheckToken & {
71
- readonly appName: string;
72
- };
73
- export type NextFn<T> = (value: T) => void;
74
- export type ErrorFn = (error: Error) => void;
75
- export type CompleteFn = () => void;
76
- export interface Observer<T> {
77
- next: NextFn<T>;
78
- error: ErrorFn;
79
- complete: CompleteFn;
76
+ export interface AppCheckProvider {
77
+ /**
78
+ * Returns an AppCheck token.
79
+ */
80
+ getToken(): Promise<AppCheckToken>;
80
81
  }
81
- export type PartialObserver<T> = Partial<Observer<T>>;
82
82
  /**
83
- * A function that unsubscribes from token changes.
83
+ * Options for ReactNativeFirebaseAppCheckProvider.
84
+ * @public
84
85
  */
85
- export type Unsubscribe = () => void;
86
86
  export interface ReactNativeFirebaseAppCheckProviderOptions {
87
87
  /**
88
88
  * debug token to use, if any. Defaults to undefined, pre-configure tokens in firebase web console if needed
89
89
  */
90
90
  debugToken?: string;
91
91
  }
92
+ /**
93
+ * Options for ReactNativeFirebaseAppCheckProvider on web.
94
+ * @public
95
+ */
92
96
  export interface ReactNativeFirebaseAppCheckProviderWebOptions extends ReactNativeFirebaseAppCheckProviderOptions {
93
97
  /**
94
98
  * The web provider to use, either `reCaptchaV3` or `reCaptchaEnterprise`, defaults to `reCaptchaV3`
@@ -99,6 +103,10 @@ export interface ReactNativeFirebaseAppCheckProviderWebOptions extends ReactNati
99
103
  */
100
104
  siteKey?: string;
101
105
  }
106
+ /**
107
+ * Options for ReactNativeFirebaseAppCheckProvider on apple.
108
+ * @public
109
+ */
102
110
  export interface ReactNativeFirebaseAppCheckProviderAppleOptions extends ReactNativeFirebaseAppCheckProviderOptions {
103
111
  /**
104
112
  * The apple provider to use, either `deviceCheck` or `appAttest`, or `appAttestWithDeviceCheckFallback`,
@@ -107,6 +115,10 @@ export interface ReactNativeFirebaseAppCheckProviderAppleOptions extends ReactNa
107
115
  */
108
116
  provider?: 'debug' | 'deviceCheck' | 'appAttest' | 'appAttestWithDeviceCheckFallback';
109
117
  }
118
+ /**
119
+ * Options for ReactNativeFirebaseAppCheckProvider on android.
120
+ * @public
121
+ */
110
122
  export interface ReactNativeFirebaseAppCheckProviderAndroidOptions extends ReactNativeFirebaseAppCheckProviderOptions {
111
123
  /**
112
124
  * The android provider to use, either `debug` or `playIntegrity`. default is `playIntegrity`.
@@ -115,6 +127,7 @@ export interface ReactNativeFirebaseAppCheckProviderAndroidOptions extends React
115
127
  }
116
128
  /**
117
129
  * Platform-specific provider options configuration.
130
+ * @public
118
131
  */
119
132
  export type ReactNativeFirebaseAppCheckProviderOptionsMap = {
120
133
  web?: ReactNativeFirebaseAppCheckProviderWebOptions;
@@ -127,173 +140,9 @@ export type ReactNativeFirebaseAppCheckProviderOptionsMap = {
127
140
  * that can be passed directly with providerOptions (for convenience in initialization).
128
141
  * The runtime accepts objects with providerOptions even if they don't have
129
142
  * getToken() and configure() methods.
143
+ * @public
130
144
  */
131
145
  export interface ReactNativeFirebaseAppCheckProviderConfig {
132
146
  providerOptions: ReactNativeFirebaseAppCheckProviderOptionsMap;
133
147
  }
134
- export interface ReactNativeFirebaseAppCheckProvider extends AppCheckProvider {
135
- /**
136
- * Provider options for platform-specific configuration.
137
- * This is set when configure() is called.
138
- */
139
- providerOptions?: ReactNativeFirebaseAppCheckProviderOptionsMap;
140
- /**
141
- * Specify how the app check provider should be configured. The new configuration is
142
- * in effect when this call returns. You must call `getToken()`
143
- * after this call to get a token using the new configuration.
144
- * This custom provider allows for delayed configuration and re-configuration on all platforms
145
- * so AppCheck has the same experience across all platforms, with the only difference being the native
146
- * providers you choose to use on each platform.
147
- */
148
- configure(options: ReactNativeFirebaseAppCheckProviderOptionsMap): void;
149
- }
150
- /**
151
- * Type representing providers that have providerOptions.
152
- * Used for type narrowing in runtime code.
153
- */
154
- export type ProviderWithOptions = ReactNativeFirebaseAppCheckProvider | ReactNativeFirebaseAppCheckProviderConfig;
155
- /**
156
- * App Check module instance - returned from firebase.appCheck() or firebase.app().appCheck()
157
- */
158
- export interface AppCheck extends ReactNativeFirebase.FirebaseModule {
159
- /** The FirebaseApp this module is associated with */
160
- app: ReactNativeFirebase.FirebaseApp;
161
- /**
162
- * Create a ReactNativeFirebaseAppCheckProvider option for use in react-native-firebase
163
- */
164
- newReactNativeFirebaseAppCheckProvider(): ReactNativeFirebaseAppCheckProvider;
165
- /**
166
- * Initialize the AppCheck module. Note that in react-native-firebase AppCheckOptions must always
167
- * be an object with a `provider` member containing `ReactNativeFirebaseAppCheckProvider` that has returned successfully
168
- * from a call to the `configure` method, with sub-providers for the various platforms configured to meet your project
169
- * requirements. This must be called prior to interacting with any firebase services protected by AppCheck
170
- *
171
- * @param options an AppCheckOptions with a configured ReactNativeFirebaseAppCheckProvider as the provider
172
- */
173
- initializeAppCheck(options: AppCheckOptions): Promise<void>;
174
- /**
175
- * Activate App Check
176
- * On iOS App Check is activated with DeviceCheck provider simply by including the module, using the token auto refresh default or
177
- * the specific value (if configured) in firebase.json, but calling this does no harm.
178
- * On Android if you call this it will install the PlayIntegrity provider in release builds, the Debug provider if debuggable.
179
- * On both platforms you may use this method to alter the token refresh setting after startup.
180
- * On iOS if you want to set a specific AppCheckProviderFactory (for instance to FIRAppCheckDebugProviderFactory or
181
- * FIRAppAttestProvider) you must manually do that in your AppDelegate.m prior to calling [FIRApp configure]
182
- *
183
- * @deprecated use initializeAppCheck to gain access to all platform providers and firebase-js-sdk v9 compatibility
184
- * @param siteKeyOrProvider - This is ignored, Android uses DebugProviderFactory if the app is debuggable (https://firebase.google.com/docs/app-check/android/debug-provider)
185
- * Android uses PlayIntegrityProviderFactory for release builds.
186
- * iOS uses DeviceCheckProviderFactory by default unless altered in AppDelegate.m manually
187
- * @param isTokenAutoRefreshEnabled - If true, enables SDK to automatically
188
- * refresh AppCheck token as needed. If undefined, the value will default
189
- * to the value of `app.automaticDataCollectionEnabled`. That property
190
- * defaults to false and can be set in the app config.
191
- */
192
- activate(siteKeyOrProvider: string | AppCheckProvider, isTokenAutoRefreshEnabled?: boolean): Promise<void>;
193
- /**
194
- * Alter the token auto refresh setting. By default it will take the value of automaticDataCollectionEnabled from Info.plist / AndroidManifest.xml
195
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
196
- * refreshes App Check tokens as needed. This overrides any value set
197
- * during `activate()` or taken by default from automaticDataCollectionEnabled in plist / android manifest
198
- */
199
- setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void;
200
- /**
201
- * Requests Firebase App Check token.
202
- * This method should only be used if you need to authorize requests to a non-Firebase backend.
203
- * Requests to Firebase backend are authorized automatically if configured.
204
- *
205
- * @param forceRefresh - If true, a new Firebase App Check token is requested and the token cache is ignored.
206
- * If false, the cached token is used if it exists and has not expired yet.
207
- * In most cases, false should be used. True should only be used if the server explicitly returns an error, indicating a revoked token.
208
- */
209
- getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
210
- /**
211
- * Requests a Firebase App Check token. This method should be used only if you need to authorize requests
212
- * to a non-Firebase backend. Returns limited-use tokens that are intended for use with your non-Firebase
213
- * backend endpoints that are protected with Replay Protection (https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
214
- * This method does not affect the token generation behavior of the getAppCheckToken() method.
215
- */
216
- getLimitedUseToken(): Promise<AppCheckTokenResult>;
217
- /**
218
- * Registers a listener to changes in the token state. There can be more
219
- * than one listener registered at the same time for one or more
220
- * App Check instances. The listeners call back on the UI thread whenever
221
- * the current token associated with this App Check instance changes.
222
- *
223
- * @returns A function that unsubscribes this listener.
224
- */
225
- onTokenChanged(observer: PartialObserver<AppCheckListenerResult>): () => void;
226
- /**
227
- * Registers a listener to changes in the token state. There can be more
228
- * than one listener registered at the same time for one or more
229
- * App Check instances. The listeners call back on the UI thread whenever
230
- * the current token associated with this App Check instance changes.
231
- *
232
- * Token listeners do not exist in the native SDK for iOS, no token change events will be emitted on that platform.
233
- * This is not yet implemented on Android, no token change events will be emitted until implemented.
234
- *
235
- * NOTE: Although an `onError` callback can be provided, it will
236
- * never be called, Android sdk code doesn't provide handling for onError function
237
- *
238
- * NOTE: Although an `onCompletion` callback can be provided, it will
239
- * never be called because the token stream is never-ending.
240
- *
241
- * @returns A function that unsubscribes this listener.
242
- */
243
- onTokenChanged(onNext: (tokenResult: AppCheckListenerResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): () => void;
244
- }
245
- /**
246
- * Static properties available on firebase.appCheck
247
- */
248
- export interface AppCheckStatics {
249
- CustomProvider: new (customProviderOptions: CustomProviderOptions) => CustomProvider;
250
- SDK_VERSION: string;
251
- }
252
- /**
253
- * FirebaseApp type with appCheck() method.
254
- * @deprecated Import FirebaseApp from '@react-native-firebase/app' instead.
255
- * The appCheck() method is added via module augmentation.
256
- */
257
- export type FirebaseApp = ReactNativeFirebase.FirebaseApp;
258
- declare module '@react-native-firebase/app' {
259
- namespace ReactNativeFirebase {
260
- interface Module {
261
- appCheck: FirebaseModuleWithStaticsAndApp<AppCheck, AppCheckStatics>;
262
- }
263
- interface FirebaseApp {
264
- appCheck(): AppCheck;
265
- }
266
- }
267
- }
268
- type _AppCheckProvider = AppCheckProvider;
269
- type _CustomProviderOptions = CustomProviderOptions;
270
- type _AppCheckOptions = AppCheckOptions;
271
- type _AppCheckToken = AppCheckToken;
272
- type _AppCheckTokenResult = AppCheckTokenResult;
273
- type _AppCheckListenerResult = AppCheckListenerResult;
274
- type _AppCheck = AppCheck;
275
- type _AppCheckStatics = AppCheckStatics;
276
- /**
277
- * @deprecated Use the exported types directly instead.
278
- * FirebaseAppCheckTypes namespace is kept for backwards compatibility.
279
- */
280
- export declare namespace FirebaseAppCheckTypes {
281
- type Provider = AppCheckProvider;
282
- type ProviderOptions = CustomProviderOptions;
283
- type Options = AppCheckOptions;
284
- type Token = AppCheckToken;
285
- type TokenResult = AppCheckTokenResult;
286
- type ListenerResult = AppCheckListenerResult;
287
- type Statics = AppCheckStatics;
288
- type Module = AppCheck;
289
- type AppCheckProvider = _AppCheckProvider;
290
- type CustomProviderOptions = _CustomProviderOptions;
291
- type AppCheckOptions = _AppCheckOptions;
292
- type AppCheckToken = _AppCheckToken;
293
- type AppCheckTokenResult = _AppCheckTokenResult;
294
- type AppCheckListenerResult = _AppCheckListenerResult;
295
- type AppCheck = _AppCheck;
296
- type AppCheckStatics = _AppCheckStatics;
297
- }
298
- export {};
299
148
  //# sourceMappingURL=appcheck.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appcheck.d.ts","sourceRoot":"","sources":["../../../../lib/types/appcheck.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;CACxC;AAID;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,gBAAgB;gBACjD,qBAAqB,EAAE,qBAAqB;IACxD,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,EACJ,cAAc,GACd,mCAAmC,GACnC,yCAAyC,CAAC;IAE9C;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,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AM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,0CAA0C;IACzD;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,6CAA8C,SAAQ,0CAA0C;IAC/G;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,aAAa,GAAG,qBAAqB,CAAC;IAE3D;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,+CAAgD,SAAQ,0CAA0C;IACjH;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,kCAAkC,CAAC;CACvF;AAED;;;GAGG;AACH,MAAM,WAAW,iDAAkD,SAAQ,0CAA0C;IACnH;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,GAAG,CAAC,EAAE,6CAA6C,CAAC;IACpD,OAAO,CAAC,EAAE,iDAAiD,CAAC;IAC5D,KAAK,CAAC,EAAE,+CAA+C,CAAC;IACxD,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,yCAAyC;IACxD,eAAe,EAAE,6CAA6C,CAAC;CAChE"}
@@ -0,0 +1,125 @@
1
+ import type { FirebaseApp } from '@react-native-firebase/app';
2
+ import type { AppCheck, AppCheckOptions, AppCheckProvider, AppCheckTokenResult, PartialObserver, ReactNativeFirebaseAppCheckProviderConfig, Unsubscribe } from './appcheck';
3
+ import type { ReactNativeFirebaseAppCheckProvider } from '../providers';
4
+ type AppCheckListenerResult = AppCheckTokenResult & {
5
+ readonly appName: string;
6
+ };
7
+ export type AppCheckInternal = AppCheck & {
8
+ /** The FirebaseApp this module is associated with */
9
+ app: FirebaseApp;
10
+ /**
11
+ * Create a ReactNativeFirebaseAppCheckProvider option for use in react-native-firebase
12
+ */
13
+ newReactNativeFirebaseAppCheckProvider(): ReactNativeFirebaseAppCheckProvider;
14
+ /**
15
+ * Initialize the AppCheck module. Note that in react-native-firebase AppCheckOptions must always
16
+ * be an object with a `provider` member containing `ReactNativeFirebaseAppCheckProvider` that has returned successfully
17
+ * from a call to the `configure` method, with sub-providers for the various platforms configured to meet your project
18
+ * requirements. This must be called prior to interacting with any firebase services protected by AppCheck
19
+ *
20
+ * @param options an AppCheckOptions with a configured ReactNativeFirebaseAppCheckProvider as the provider
21
+ */
22
+ initializeAppCheck(options: AppCheckOptions): Promise<void>;
23
+ /**
24
+ * Activate App Check
25
+ * On iOS App Check is activated with DeviceCheck provider simply by including the module, using the token auto refresh default or
26
+ * the specific value (if configured) in firebase.json, but calling this does no harm.
27
+ * On Android if you call this it will install the PlayIntegrity provider in release builds, the Debug provider if debuggable.
28
+ * On both platforms you may use this method to alter the token refresh setting after startup.
29
+ * On iOS if you want to set a specific AppCheckProviderFactory (for instance to FIRAppCheckDebugProviderFactory or
30
+ * FIRAppAttestProvider) you must manually do that in your AppDelegate.m prior to calling [FIRApp configure]
31
+ *
32
+ * @deprecated use initializeAppCheck to gain access to all platform providers and firebase-js-sdk v9 compatibility
33
+ * @param siteKeyOrProvider - This is ignored, Android uses DebugProviderFactory if the app is debuggable (https://firebase.google.com/docs/app-check/android/debug-provider)
34
+ * Android uses PlayIntegrityProviderFactory for release builds.
35
+ * iOS uses DeviceCheckProviderFactory by default unless altered in AppDelegate.m manually
36
+ * @param isTokenAutoRefreshEnabled - If true, enables SDK to automatically
37
+ * refresh AppCheck token as needed. If undefined, the value will default
38
+ * to the value of `app.automaticDataCollectionEnabled`. That property
39
+ * defaults to false and can be set in the app config.
40
+ */
41
+ activate(siteKeyOrProvider: string | AppCheckProvider, isTokenAutoRefreshEnabled?: boolean): Promise<void>;
42
+ /**
43
+ * Alter the token auto refresh setting. By default it will take the value of automaticDataCollectionEnabled from Info.plist / AndroidManifest.xml
44
+ * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
45
+ * refreshes App Check tokens as needed. This overrides any value set
46
+ * during `activate()` or taken by default from automaticDataCollectionEnabled in plist / android manifest
47
+ */
48
+ setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void;
49
+ /**
50
+ * Requests Firebase App Check token.
51
+ * This method should only be used if you need to authorize requests to a non-Firebase backend.
52
+ * Requests to Firebase backend are authorized automatically if configured.
53
+ *
54
+ * @param forceRefresh - If true, a new Firebase App Check token is requested and the token cache is ignored.
55
+ * If false, the cached token is used if it exists and has not expired yet.
56
+ * In most cases, false should be used. True should only be used if the server explicitly returns an error, indicating a revoked token.
57
+ */
58
+ getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
59
+ /**
60
+ * Requests a Firebase App Check token. This method should be used only if you need to authorize requests
61
+ * to a non-Firebase backend. Returns limited-use tokens that are intended for use with your non-Firebase
62
+ * backend endpoints that are protected with Replay Protection (https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
63
+ * This method does not affect the token generation behavior of the getAppCheckToken() method.
64
+ */
65
+ getLimitedUseToken(): Promise<AppCheckTokenResult>;
66
+ /**
67
+ * Registers a listener to changes in the token state. There can be more
68
+ * than one listener registered at the same time for one or more
69
+ * App Check instances. The listeners call back on the UI thread whenever
70
+ * the current token associated with this App Check instance changes.
71
+ *
72
+ * @returns A function that unsubscribes this listener.
73
+ */
74
+ onTokenChanged(observer: PartialObserver<AppCheckListenerResult>): () => void;
75
+ /**
76
+ * Registers a listener to changes in the token state. There can be more
77
+ * than one listener registered at the same time for one or more
78
+ * App Check instances. The listeners call back on the UI thread whenever
79
+ * the current token associated with this App Check instance changes.
80
+ *
81
+ * Token listeners do not exist in the native SDK for iOS, no token change events will be emitted on that platform.
82
+ * This is not yet implemented on Android, no token change events will be emitted until implemented.
83
+ *
84
+ * NOTE: Although an `onError` callback can be provided, it will
85
+ * never be called, Android sdk code doesn't provide handling for onError function
86
+ *
87
+ * NOTE: Although an `onCompletion` callback can be provided, it will
88
+ * never be called because the token stream is never-ending.
89
+ *
90
+ * @returns A function that unsubscribes this listener.
91
+ */
92
+ onTokenChanged(onNext: (tokenResult: AppCheckListenerResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
93
+ /**
94
+ * Implementation signature used by modular wrappers.
95
+ */
96
+ onTokenChanged(onNextOrObserver: PartialObserver<AppCheckTokenResult> | ((tokenResult: AppCheckTokenResult) => void), onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
97
+ };
98
+ /**
99
+ * Type representing providers that have providerOptions.
100
+ * Used for type narrowing in runtime code.
101
+ */
102
+ export type ProviderWithOptions = ReactNativeFirebaseAppCheckProvider | ReactNativeFirebaseAppCheckProviderConfig;
103
+ /**
104
+ * Wrapped native module interface for App Check.
105
+ *
106
+ * Note: React Native Firebase internally wraps native methods and auto-prepends the app name
107
+ * when `hasMultiAppSupport` is enabled. This interface represents the *wrapped* module shape
108
+ * that is exposed as `this.native` within FirebaseModule subclasses.
109
+ */
110
+ export interface RNFBAppCheckModule {
111
+ initializeAppCheck(options: AppCheckOptions): Promise<void>;
112
+ setTokenAutoRefreshEnabled(enabled: boolean): void | Promise<void>;
113
+ configureProvider(provider: string, debugToken?: string): Promise<void>;
114
+ getToken(forceRefresh: boolean): Promise<AppCheckTokenResult>;
115
+ getLimitedUseToken(): Promise<AppCheckTokenResult>;
116
+ addAppCheckListener(): void | Promise<void>;
117
+ removeAppCheckListener(): void | Promise<void>;
118
+ }
119
+ declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
120
+ interface ReactNativeFirebaseNativeModules {
121
+ RNFBAppCheckModule: RNFBAppCheckModule;
122
+ }
123
+ }
124
+ export {};
125
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../lib/types/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,yCAAyC,EACzC,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,cAAc,CAAC;AAExE,KAAK,sBAAsB,GAAG,mBAAmB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACxC,qDAAqD;IACrD,GAAG,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,sCAAsC,IAAI,mCAAmC,CAAC;IAE9E;;;;;;;OAOG;IACH,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CACN,iBAAiB,EAAE,MAAM,GAAG,gBAAgB,EAC5C,yBAAyB,CAAC,EAAE,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;OAKG;IACH,0BAA0B,CAAC,yBAAyB,EAAE,OAAO,GAAG,IAAI,CAAC;IAErE;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE/D;;;;;OAKG;IACH,kBAAkB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEnD;;;;;;;OAOG;IACH,cAAc,CAAC,QAAQ,EAAE,eAAe,CAAC,sBAAsB,CAAC,GAAG,MAAM,IAAI,CAAC;IAE9E;;;;;;;;;;;;;;;;O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