@react-native-firebase/app-check 14.2.2 → 14.3.1
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 +21 -0
- package/android/build.gradle +3 -0
- package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java +22 -1
- package/ios/RNFBAppCheck/RNFBAppCheckModule.m +4 -1
- package/lib/index.js +20 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [14.3.1](https://github.com/invertase/react-native-firebase/compare/v14.3.0...v14.3.1) (2022-02-07)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **app-check, activate:** correctly check activate parameters ([a583494](https://github.com/invertase/react-native-firebase/commit/a583494d645fe74b043b0dedcf5f2e334e020edf)), closes [#5981](https://github.com/invertase/react-native-firebase/issues/5981)
|
|
11
|
+
- **app-check, activate:** return Promise(void) on ios not void ([0f23441](https://github.com/invertase/react-native-firebase/commit/0f234413542907cd29fb72ccaf6138ff15844443)), closes [#6052](https://github.com/invertase/react-native-firebase/issues/6052)
|
|
12
|
+
|
|
13
|
+
# [14.3.0](https://github.com/invertase/react-native-firebase/compare/v14.2.4...v14.3.0) (2022-01-26)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- **app-check:** android debug token argument for app-check ([#6026](https://github.com/invertase/react-native-firebase/issues/6026)) ([6f67503](https://github.com/invertase/react-native-firebase/commit/6f6750309cc6b275772cb9c1bac7e67c2eb7d4ba))
|
|
18
|
+
|
|
19
|
+
## [14.2.4](https://github.com/invertase/react-native-firebase/compare/v14.2.3...v14.2.4) (2022-01-24)
|
|
20
|
+
|
|
21
|
+
**Note:** Version bump only for package @react-native-firebase/app-check
|
|
22
|
+
|
|
23
|
+
## [14.2.3](https://github.com/invertase/react-native-firebase/compare/v14.2.2...v14.2.3) (2022-01-20)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @react-native-firebase/app-check
|
|
26
|
+
|
|
6
27
|
## [14.2.2](https://github.com/invertase/react-native-firebase/compare/v14.2.1...v14.2.2) (2022-01-06)
|
|
7
28
|
|
|
8
29
|
**Note:** Version bump only for package @react-native-firebase/app-check
|
package/android/build.gradle
CHANGED
|
@@ -66,6 +66,9 @@ project.ext {
|
|
|
66
66
|
android {
|
|
67
67
|
defaultConfig {
|
|
68
68
|
multiDexEnabled true
|
|
69
|
+
// Here we add a build config field to allow devs to provide a
|
|
70
|
+
// FIREBASE_APP_CHECK_DEBUG_TOKEN to be used in debug mode.
|
|
71
|
+
buildConfigField "String", "FIREBASE_APP_CHECK_DEBUG_TOKEN", "\"${System.env.FIREBASE_APP_CHECK_DEBUG_TOKEN}\""
|
|
69
72
|
}
|
|
70
73
|
lintOptions {
|
|
71
74
|
disable 'GradleCompatible'
|
package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java
CHANGED
|
@@ -23,10 +23,12 @@ import android.util.Log;
|
|
|
23
23
|
import com.facebook.react.bridge.*;
|
|
24
24
|
import com.google.android.gms.tasks.Tasks;
|
|
25
25
|
import com.google.firebase.FirebaseApp;
|
|
26
|
+
import com.google.firebase.appcheck.AppCheckProviderFactory;
|
|
26
27
|
import com.google.firebase.appcheck.FirebaseAppCheck;
|
|
27
28
|
import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory;
|
|
28
29
|
import com.google.firebase.appcheck.safetynet.SafetyNetAppCheckProviderFactory;
|
|
29
30
|
import io.invertase.firebase.common.ReactNativeFirebaseModule;
|
|
31
|
+
import java.lang.reflect.*;
|
|
30
32
|
|
|
31
33
|
public class ReactNativeFirebaseAppCheckModule extends ReactNativeFirebaseModule {
|
|
32
34
|
private static final String TAG = "AppCheck";
|
|
@@ -51,7 +53,26 @@ public class ReactNativeFirebaseAppCheckModule extends ReactNativeFirebaseModule
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
if (isDebuggable) {
|
|
54
|
-
|
|
56
|
+
|
|
57
|
+
if (BuildConfig.FIREBASE_APP_CHECK_DEBUG_TOKEN != "null") {
|
|
58
|
+
// Get DebugAppCheckProviderFactory class
|
|
59
|
+
Class<DebugAppCheckProviderFactory> debugACFactoryClass =
|
|
60
|
+
DebugAppCheckProviderFactory.class;
|
|
61
|
+
|
|
62
|
+
// Get the (undocumented) constructor accepting a debug token as string
|
|
63
|
+
Class<?>[] argType = {String.class};
|
|
64
|
+
Constructor c = debugACFactoryClass.getDeclaredConstructor(argType);
|
|
65
|
+
|
|
66
|
+
// Create a object containing the constructor arguments
|
|
67
|
+
// and initialize a new instance.
|
|
68
|
+
Object[] cArgs = {BuildConfig.FIREBASE_APP_CHECK_DEBUG_TOKEN};
|
|
69
|
+
firebaseAppCheck.installAppCheckProviderFactory(
|
|
70
|
+
(AppCheckProviderFactory) c.newInstance(cArgs));
|
|
71
|
+
} else {
|
|
72
|
+
firebaseAppCheck.installAppCheckProviderFactory(
|
|
73
|
+
DebugAppCheckProviderFactory.getInstance());
|
|
74
|
+
}
|
|
75
|
+
|
|
55
76
|
} else {
|
|
56
77
|
firebaseAppCheck.installAppCheckProviderFactory(
|
|
57
78
|
SafetyNetAppCheckProviderFactory.getInstance());
|
|
@@ -39,7 +39,9 @@ RCT_EXPORT_MODULE();
|
|
|
39
39
|
RCT_EXPORT_METHOD(activate
|
|
40
40
|
: (FIRApp *)firebaseApp
|
|
41
41
|
: (nonnull NSString *)siteKeyOrProvider
|
|
42
|
-
: (BOOL)isTokenAutoRefreshEnabled
|
|
42
|
+
: (BOOL)isTokenAutoRefreshEnabled
|
|
43
|
+
: (RCTPromiseResolveBlock)resolve rejecter
|
|
44
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
43
45
|
// From SDK docs:
|
|
44
46
|
// NOTE: Make sure to call this method before FirebaseApp.configure().
|
|
45
47
|
// If this method is called after configuring Firebase, the changes will not take effect.
|
|
@@ -49,6 +51,7 @@ RCT_EXPORT_METHOD(activate
|
|
|
49
51
|
|
|
50
52
|
FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp];
|
|
51
53
|
appCheck.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;
|
|
54
|
+
resolve([NSNull null]);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
RCT_EXPORT_METHOD(setTokenAutoRefreshEnabled
|
package/lib/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { isIOS } from '@react-native-firebase/app/lib/common';
|
|
18
|
+
import { isBoolean, isIOS, isString } from '@react-native-firebase/app/lib/common';
|
|
19
19
|
import {
|
|
20
20
|
createModuleNamespace,
|
|
21
21
|
FirebaseModule,
|
|
@@ -32,6 +32,25 @@ const nativeModuleName = 'RNFBAppCheckModule';
|
|
|
32
32
|
|
|
33
33
|
class FirebaseAppCheckModule extends FirebaseModule {
|
|
34
34
|
activate(siteKeyOrProvider, isTokenAutoRefreshEnabled) {
|
|
35
|
+
if (!isString(siteKeyOrProvider)) {
|
|
36
|
+
throw new Error('siteKeyOrProvider must be a string value to match firebase-js-sdk API');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// If the caller did not specify token refresh, attempt to use app-check specific setting:
|
|
40
|
+
if (!isBoolean(isTokenAutoRefreshEnabled)) {
|
|
41
|
+
isTokenAutoRefreshEnabled = this.firebaseJson.app_check_token_auto_refresh;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// If that was not defined, attempt to use app-wide data collection setting per docs:
|
|
45
|
+
if (!isBoolean(isTokenAutoRefreshEnabled)) {
|
|
46
|
+
isTokenAutoRefreshEnabled = this.firebaseJson.app_data_collection_default_enabled;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// If that also was not defined, the default is documented as true.
|
|
50
|
+
if (!isBoolean(isTokenAutoRefreshEnabled)) {
|
|
51
|
+
isTokenAutoRefreshEnabled = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
35
54
|
return this.native.activate(siteKeyOrProvider, isTokenAutoRefreshEnabled);
|
|
36
55
|
}
|
|
37
56
|
|
package/lib/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
module.exports = '14.
|
|
2
|
+
module.exports = '14.3.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/app-check",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.1",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Firebase - App Check",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"appCheck"
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@react-native-firebase/app": "14.
|
|
26
|
+
"@react-native-firebase/app": "14.3.1"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "211b7531b731a1fd7feb11ee1d1822470a31eac2"
|
|
32
32
|
}
|