@react-native-firebase/app-check 25.1.0 → 26.1.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.
- package/CHANGELOG.md +38 -0
- package/RNFBAppCheck.podspec +20 -7
- package/android/build.gradle +19 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/{ReactNativeFirebaseAppCheckModule.java → NativeRNFBTurboAppCheck.java} +46 -34
- package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckPackage.java +1 -1
- package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckProvider.java +9 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboAppCheckSpec.java +67 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/CMakeLists.txt +36 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/RNFBAppCheckTurboModules-generated.cpp +74 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/RNFBAppCheckTurboModules.h +31 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/react/renderer/components/RNFBAppCheckTurboModules/RNFBAppCheckTurboModulesJSI-generated.cpp +85 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/generated/jni/react/renderer/components/RNFBAppCheckTurboModules/RNFBAppCheckTurboModulesJSI.h +174 -0
- package/app.plugin.js +1 -1
- package/dist/module/index.js +210 -6
- package/dist/module/index.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/lib/index.d.ts +19 -4
- package/dist/typescript/lib/index.d.ts.map +1 -1
- package/dist/typescript/lib/types/appcheck.d.ts +5 -0
- package/dist/typescript/lib/types/appcheck.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +1 -1
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/ios/RNFBAppCheck/RNFBAppCheckModule.h +3 -8
- package/ios/RNFBAppCheck/{RNFBAppCheckModule.m → RNFBAppCheckModule.mm} +75 -45
- package/ios/RNFBAppCheck/RNFBAppCheckProvider.h +8 -1
- package/ios/RNFBAppCheck/RNFBAppCheckProvider.m +11 -1
- package/ios/RNFBAppCheck.xcodeproj/project.pbxproj +8 -8
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNFBAppCheckTurboModules/RNFBAppCheckTurboModules-generated.mm +88 -0
- package/ios/generated/RNFBAppCheckTurboModules/RNFBAppCheckTurboModules.h +85 -0
- package/ios/generated/RNFBAppCheckTurboModulesJSI-generated.cpp +85 -0
- package/ios/generated/RNFBAppCheckTurboModulesJSI.h +174 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/index.ts +335 -8
- package/lib/types/appcheck.ts +6 -0
- package/lib/types/internal.ts +1 -1
- package/lib/version.ts +1 -1
- package/package.json +30 -5
- package/plugin/build/app.plugin.d.ts +2 -0
- package/plugin/build/app.plugin.js +6 -0
- package/plugin/build/ios/appDelegate.js +18 -4
- package/plugin/src/app.plugin.ts +3 -0
- package/plugin/src/ios/appDelegate.ts +23 -4
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/react-native.config.js +10 -0
- package/specs/NativeRNFBTurboAppCheck.ts +27 -0
- package/typedoc.json +1 -1
- package/dist/module/modular.js +0 -93
- package/dist/module/modular.js.map +0 -1
- package/dist/module/namespaced.js +0 -194
- package/dist/module/namespaced.js.map +0 -1
- package/dist/module/types/namespaced.js +0 -60
- package/dist/module/types/namespaced.js.map +0 -1
- package/dist/typescript/lib/modular.d.ts +0 -56
- package/dist/typescript/lib/modular.d.ts.map +0 -1
- package/dist/typescript/lib/namespaced.d.ts +0 -12
- package/dist/typescript/lib/namespaced.d.ts.map +0 -1
- package/dist/typescript/lib/types/namespaced.d.ts +0 -358
- package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
- package/lib/modular.ts +0 -157
- package/lib/namespaced.ts +0 -286
- package/lib/types/namespaced.ts +0 -422
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type FirebaseApp } from '@react-native-firebase/app';
|
|
2
|
-
import type { AppCheck, AppCheckOptions, AppCheckTokenResult, PartialObserver, Unsubscribe } from './types/appcheck';
|
|
3
|
-
export { CustomProvider, ReactNativeFirebaseAppCheckProvider } from './providers';
|
|
4
|
-
/**
|
|
5
|
-
* Activate App Check for the given app. Can be called only once per app.
|
|
6
|
-
* @param app - The app to initialize App Check for. Optional.
|
|
7
|
-
* @param options - App Check options.
|
|
8
|
-
* @returns Promise<AppCheck>
|
|
9
|
-
*/
|
|
10
|
-
export declare function initializeAppCheck(app?: FirebaseApp, options?: AppCheckOptions): Promise<AppCheck>;
|
|
11
|
-
/**
|
|
12
|
-
* Get the current App Check token. Attaches to the most recent in-flight request if one is present.
|
|
13
|
-
* Returns null if no token is present and no token requests are in-flight.
|
|
14
|
-
* @param appCheckInstance - The App Check instance.
|
|
15
|
-
* @param forceRefresh - Whether to force refresh the token. Optional
|
|
16
|
-
* @returns Promise<AppCheckTokenResult>
|
|
17
|
-
*/
|
|
18
|
-
export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
|
|
19
|
-
/**
|
|
20
|
-
* Get a limited-use (consumable) App Check token.
|
|
21
|
-
* For use with server calls to firebase functions or custom backends using the firebase admin SDK.
|
|
22
|
-
* @param appCheckInstance - The App Check instance.
|
|
23
|
-
* @returns Promise<AppCheckTokenResult>
|
|
24
|
-
*/
|
|
25
|
-
export declare function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;
|
|
26
|
-
/**
|
|
27
|
-
* Set whether App Check will automatically refresh tokens as needed.
|
|
28
|
-
* @param appCheckInstance - The App Check instance.
|
|
29
|
-
* @param isAutoRefreshEnabled - Whether to enable auto-refresh.
|
|
30
|
-
*/
|
|
31
|
-
export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isAutoRefreshEnabled: boolean): void;
|
|
32
|
-
/**
|
|
33
|
-
* Registers a listener to changes in the token state. There can be more
|
|
34
|
-
* than one listener registered at the same time for one or more
|
|
35
|
-
* App Check instances. The listeners call back on the UI thread whenever
|
|
36
|
-
* the current token associated with this App Check instance changes.
|
|
37
|
-
*
|
|
38
|
-
* @param appCheckInstance - The App Check instance.
|
|
39
|
-
* @param observer - The listener to register.
|
|
40
|
-
* @returns Unsubscribe
|
|
41
|
-
*/
|
|
42
|
-
export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;
|
|
43
|
-
/**
|
|
44
|
-
* Registers a listener to changes in the token state. There can be more
|
|
45
|
-
* than one listener registered at the same time for one or more
|
|
46
|
-
* App Check instances. The listeners call back on the UI thread whenever
|
|
47
|
-
* the current token associated with this App Check instance changes.
|
|
48
|
-
*
|
|
49
|
-
* @param appCheckInstance - The App Check instance.
|
|
50
|
-
* @param onNext - The callback function for token changes.
|
|
51
|
-
* @param onError - Optional error callback.
|
|
52
|
-
* @param onCompletion - Optional completion callback.
|
|
53
|
-
* @returns Unsubscribe
|
|
54
|
-
*/
|
|
55
|
-
export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
|
|
56
|
-
//# sourceMappingURL=modular.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modular.d.ts","sourceRoot":"","sources":["../../../lib/modular.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,mCAAmC,EAAE,MAAM,aAAa,CAAC;AAMlF;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,CAAC,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,QAAQ,CAAC,CASnB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,gBAAgB,EAAE,QAAQ,EAC1B,YAAY,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAM9B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAM3F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,gBAAgB,EAAE,QAAQ,EAC1B,oBAAoB,EAAE,OAAO,GAC5B,IAAI,CAMN;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,QAAQ,EAC1B,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,GAC7C,WAAW,CAAC;AAEf;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,QAAQ,EAC1B,MAAM,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,IAAI,EAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAChC,YAAY,CAAC,EAAE,MAAM,IAAI,GACxB,WAAW,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { FirebaseAppCheckTypes } from './types/namespaced';
|
|
2
|
-
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
3
|
-
export declare const SDK_VERSION = "25.1.0";
|
|
4
|
-
type AppCheckNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseAppCheckTypes.Module, FirebaseAppCheckTypes.Statics> & {
|
|
5
|
-
appCheck: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseAppCheckTypes.Module, FirebaseAppCheckTypes.Statics>;
|
|
6
|
-
firebase: ReactNativeFirebase.Module;
|
|
7
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
8
|
-
};
|
|
9
|
-
declare const _default: AppCheckNamespace;
|
|
10
|
-
export default _default;
|
|
11
|
-
export declare const firebase: ReactNativeFirebase.FirebaseNamespacedExport<"appCheck", FirebaseAppCheckTypes.Module, FirebaseAppCheckTypes.Statics, false>;
|
|
12
|
-
//# sourceMappingURL=namespaced.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"namespaced.d.ts","sourceRoot":"","sources":["../../../lib/namespaced.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAwMtE,eAAO,MAAM,WAAW,WAAU,CAAC;AAanC,KAAK,iBAAiB,GAAG,mBAAmB,CAAC,+BAA+B,CAC1E,qBAAqB,CAAC,MAAM,EAC5B,qBAAqB,CAAC,OAAO,CAC9B,GAAG;IACF,QAAQ,EAAE,mBAAmB,CAAC,+BAA+B,CAC3D,qBAAqB,CAAC,MAAM,EAC5B,qBAAqB,CAAC,OAAO,CAC9B,CAAC;IACF,QAAQ,EAAE,mBAAmB,CAAC,MAAM,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC,WAAW,CAAC;CACrD,CAAC;wBAI6C,iBAAiB;AAAhE,wBAAiE;AAKjE,eAAO,MAAM,QAAQ,EACa,mBAAmB,CAAC,wBAAwB,CAC1E,UAAU,EACV,qBAAqB,CAAC,MAAM,EAC5B,qBAAqB,CAAC,OAAO,EAC7B,KAAK,CACN,CAAC"}
|
|
@@ -1,358 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;;O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MAAM,GACZ,mBAAmB,CAAC,WAAW,GAAG;QAAE,QAAQ,IAAI,qBAAqB,CAAC,MAAM,CAAA;KAAE,CAAC;CACnF,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B;;GAEG;AACH,OAAO,QAAQ,4BAA4B,CAAC;IAC1C,UAAU,mBAAmB,CAAC;QAC5B,OAAO,+BAA+B,GAAG,mBAAmB,CAAC,+BAA+B,CAAC;QAC7F,UAAU,MAAM;YACd,QAAQ,EAAE,+BAA+B,CACvC,qBAAqB,CAAC,MAAM,EAC5B,qBAAqB,CAAC,OAAO,CAC9B,CAAC;SACH;QACD,UAAU,WAAW;YACnB,QAAQ,IAAI,qBAAqB,CAAC,MAAM,CAAC;SAC1C;KACF;CACF"}
|
package/lib/modular.ts
DELETED
|
@@ -1,157 +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 { getApp, type FirebaseApp } from '@react-native-firebase/app';
|
|
19
|
-
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
20
|
-
|
|
21
|
-
import type {
|
|
22
|
-
AppCheck,
|
|
23
|
-
AppCheckOptions,
|
|
24
|
-
AppCheckTokenResult,
|
|
25
|
-
PartialObserver,
|
|
26
|
-
Unsubscribe,
|
|
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;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Activate App Check for the given app. Can be called only once per app.
|
|
38
|
-
* @param app - The app to initialize App Check for. Optional.
|
|
39
|
-
* @param options - App Check options.
|
|
40
|
-
* @returns Promise<AppCheck>
|
|
41
|
-
*/
|
|
42
|
-
export async function initializeAppCheck(
|
|
43
|
-
app?: FirebaseApp,
|
|
44
|
-
options?: AppCheckOptions,
|
|
45
|
-
): Promise<AppCheck> {
|
|
46
|
-
const appInstance = app ? (getApp(app.name) as FirebaseApp) : (getApp() as FirebaseApp);
|
|
47
|
-
const appCheck = appInstance.appCheck();
|
|
48
|
-
await (
|
|
49
|
-
(appCheck as AppCheckInternal).initializeAppCheck as WithModularDeprecationArg<
|
|
50
|
-
AppCheckInternal['initializeAppCheck']
|
|
51
|
-
>
|
|
52
|
-
).call(appCheck, options as AppCheckOptions, MODULAR_DEPRECATION_ARG);
|
|
53
|
-
return appCheck;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Get the current App Check token. Attaches to the most recent in-flight request if one is present.
|
|
58
|
-
* Returns null if no token is present and no token requests are in-flight.
|
|
59
|
-
* @param appCheckInstance - The App Check instance.
|
|
60
|
-
* @param forceRefresh - Whether to force refresh the token. Optional
|
|
61
|
-
* @returns Promise<AppCheckTokenResult>
|
|
62
|
-
*/
|
|
63
|
-
export function getToken(
|
|
64
|
-
appCheckInstance: AppCheck,
|
|
65
|
-
forceRefresh?: boolean,
|
|
66
|
-
): 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
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Get a limited-use (consumable) App Check token.
|
|
76
|
-
* For use with server calls to firebase functions or custom backends using the firebase admin SDK.
|
|
77
|
-
* @param appCheckInstance - The App Check instance.
|
|
78
|
-
* @returns Promise<AppCheckTokenResult>
|
|
79
|
-
*/
|
|
80
|
-
export function getLimitedUseToken(appCheckInstance: AppCheck): 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
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Set whether App Check will automatically refresh tokens as needed.
|
|
90
|
-
* @param appCheckInstance - The App Check instance.
|
|
91
|
-
* @param isAutoRefreshEnabled - Whether to enable auto-refresh.
|
|
92
|
-
*/
|
|
93
|
-
export function setTokenAutoRefreshEnabled(
|
|
94
|
-
appCheckInstance: AppCheck,
|
|
95
|
-
isAutoRefreshEnabled: boolean,
|
|
96
|
-
): void {
|
|
97
|
-
(
|
|
98
|
-
(appCheckInstance as AppCheckInternal).setTokenAutoRefreshEnabled as WithModularDeprecationArg<
|
|
99
|
-
AppCheckInternal['setTokenAutoRefreshEnabled']
|
|
100
|
-
>
|
|
101
|
-
).call(appCheckInstance, isAutoRefreshEnabled, MODULAR_DEPRECATION_ARG);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Registers a listener to changes in the token state. There can be more
|
|
106
|
-
* than one listener registered at the same time for one or more
|
|
107
|
-
* App Check instances. The listeners call back on the UI thread whenever
|
|
108
|
-
* the current token associated with this App Check instance changes.
|
|
109
|
-
*
|
|
110
|
-
* @param appCheckInstance - The App Check instance.
|
|
111
|
-
* @param observer - The listener to register.
|
|
112
|
-
* @returns Unsubscribe
|
|
113
|
-
*/
|
|
114
|
-
export function onTokenChanged(
|
|
115
|
-
appCheckInstance: AppCheck,
|
|
116
|
-
observer: PartialObserver<AppCheckTokenResult>,
|
|
117
|
-
): Unsubscribe;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Registers a listener to changes in the token state. There can be more
|
|
121
|
-
* than one listener registered at the same time for one or more
|
|
122
|
-
* App Check instances. The listeners call back on the UI thread whenever
|
|
123
|
-
* the current token associated with this App Check instance changes.
|
|
124
|
-
*
|
|
125
|
-
* @param appCheckInstance - The App Check instance.
|
|
126
|
-
* @param onNext - The callback function for token changes.
|
|
127
|
-
* @param onError - Optional error callback.
|
|
128
|
-
* @param onCompletion - Optional completion callback.
|
|
129
|
-
* @returns Unsubscribe
|
|
130
|
-
*/
|
|
131
|
-
export function onTokenChanged(
|
|
132
|
-
appCheckInstance: AppCheck,
|
|
133
|
-
onNext: (tokenResult: AppCheckTokenResult) => void,
|
|
134
|
-
onError?: (error: Error) => void,
|
|
135
|
-
onCompletion?: () => void,
|
|
136
|
-
): Unsubscribe;
|
|
137
|
-
|
|
138
|
-
export function onTokenChanged(
|
|
139
|
-
appCheckInstance: AppCheck,
|
|
140
|
-
onNextOrObserver:
|
|
141
|
-
| PartialObserver<AppCheckTokenResult>
|
|
142
|
-
| ((tokenResult: AppCheckTokenResult) => void),
|
|
143
|
-
onError?: (error: Error) => void,
|
|
144
|
-
onCompletion?: () => void,
|
|
145
|
-
): Unsubscribe {
|
|
146
|
-
return (
|
|
147
|
-
(appCheckInstance as AppCheckInternal).onTokenChanged as WithModularDeprecationArg<
|
|
148
|
-
AppCheckInternal['onTokenChanged']
|
|
149
|
-
>
|
|
150
|
-
).call(
|
|
151
|
-
appCheckInstance,
|
|
152
|
-
onNextOrObserver,
|
|
153
|
-
onError,
|
|
154
|
-
onCompletion,
|
|
155
|
-
MODULAR_DEPRECATION_ARG,
|
|
156
|
-
) as Unsubscribe;
|
|
157
|
-
}
|