@react-native-firebase/app-check 17.2.0 → 17.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 CHANGED
@@ -3,6 +3,20 @@
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
+ ### [17.3.1](https://github.com/invertase/react-native-firebase/compare/v17.3.0...v17.3.1) (2023-02-23)
7
+
8
+ **Note:** Version bump only for package @react-native-firebase/app-check
9
+
10
+ ## [17.3.0](https://github.com/invertase/react-native-firebase/compare/v17.2.0...v17.3.0) (2023-02-15)
11
+
12
+ ### Features
13
+
14
+ - **app-check:** Expose modular API that matches the Firebase web JS SDK v9 API ([#6912](https://github.com/invertase/react-native-firebase/issues/6912)) ([bf02676](https://github.com/invertase/react-native-firebase/commit/bf0267609251a5b8e4245c300678fe7d7ea53d92))
15
+
16
+ ### Bug Fixes
17
+
18
+ - **app-check, types:** Correct ReactNativeFirebaseAppCheckProvider options type ([#6911](https://github.com/invertase/react-native-firebase/issues/6911)) ([5d7241b](https://github.com/invertase/react-native-firebase/commit/5d7241b124dc283852efb4c549f6888005101ecd))
19
+
6
20
  ## [17.2.0](https://github.com/invertase/react-native-firebase/compare/v17.1.0...v17.2.0) (2023-02-15)
7
21
 
8
22
  ### Features
package/lib/index.d.ts CHANGED
@@ -135,12 +135,12 @@ export namespace FirebaseAppCheckTypes {
135
135
  * so AppCheck has the same experience across all platforms, with the only difference being the native
136
136
  * providers you choose to use on each platform.
137
137
  */
138
- configure(
139
- web?: ReactNativeFirebaseAppCheckProviderWebOptions,
140
- android?: ReactNativeFirebaseAppCheckProviderAndroidOptions,
141
- apple?: ReactNativeFirebaseAppCheckProviderAppleOptions,
142
- isTokenAutoRefreshEnabled?: boolean,
143
- ): Promise<void>;
138
+ configure(options: {
139
+ web?: ReactNativeFirebaseAppCheckProviderWebOptions;
140
+ android?: ReactNativeFirebaseAppCheckProviderAndroidOptions;
141
+ apple?: ReactNativeFirebaseAppCheckProviderAppleOptions;
142
+ isTokenAutoRefreshEnabled?: boolean;
143
+ }): Promise<void>;
144
144
  }
145
145
 
146
146
  /**
package/lib/index.js CHANGED
@@ -26,6 +26,13 @@ import ReactNativeFirebaseAppCheckProvider from './ReactNativeFirebaseAppCheckPr
26
26
 
27
27
  import version from './version';
28
28
 
29
+ export {
30
+ addTokenListener,
31
+ getToken,
32
+ initializeAppCheck,
33
+ setTokenAutoRefreshEnabled,
34
+ } from './modular/index';
35
+
29
36
  const statics = {};
30
37
 
31
38
  const namespace = 'appCheck';
@@ -0,0 +1,70 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ /*
3
+ * Copyright (c) 2016-present Invertase Limited & Contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this library except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ import { firebase } from '..';
20
+
21
+ /**
22
+ * Activate App Check for the given app. Can be called only once per app.
23
+ * @param app - FirebaseApp. Optional.
24
+ * @param options - AppCheckOptions
25
+ * @returns {AppCheck}
26
+ */
27
+ export async function initializeAppCheck(app, options) {
28
+ if (app) {
29
+ await firebase.app(app.name).appCheck().initializeAppCheck(options);
30
+ return { app: firebase.app(app.name) };
31
+ }
32
+
33
+ await firebase.app().appCheck().initializeAppCheck(options);
34
+ return { app: firebase.app() };
35
+ }
36
+
37
+ /**
38
+ * Get the current App Check token. Attaches to the most recent in-flight request if one is present.
39
+ * Returns null if no token is present and no token requests are in-flight.
40
+ * @param appCheckInstance - AppCheck
41
+ * @param forceRefresh - boolean
42
+ * @returns {Promise<AppCheckTokenResult>}
43
+ */
44
+ export function getToken(appCheckInstance, forceRefresh) {
45
+ return appCheckInstance.app.appCheck().getToken(forceRefresh);
46
+ }
47
+
48
+ /**
49
+ * Registers a listener to changes in the token state.
50
+ * There can be more than one listener registered at the same time for one or more App Check instances.
51
+ * The listeners call back on the UI thread whenever the current
52
+ * token associated with this App Check instance changes.
53
+ * @param appCheckInstance - AppCheck
54
+ * @param listener - PartialObserver<AppCheckTokenResult>
55
+ * @returns {Unsubscribe}
56
+ */
57
+ export function addTokenListener(appCheckInstance, listener) {
58
+ // Not implemented on React Native
59
+ // See packages/app-check/lib/index.js:127
60
+ throw new Error('addTokenListener is not implemented on React Native');
61
+ }
62
+
63
+ /**
64
+ * Set whether App Check will automatically refresh tokens as needed.
65
+ * @param appCheckInstance - AppCheck
66
+ * @param isAutoRefreshEnabled - boolean
67
+ */
68
+ export function setTokenAutoRefreshEnabled(appCheckInstance, isAutoRefreshEnabled) {
69
+ return appCheckInstance.app.appCheck().setTokenAutoRefreshEnabled(isAutoRefreshEnabled);
70
+ }
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '17.2.0';
2
+ module.exports = '17.3.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/app-check",
3
- "version": "17.2.0",
3
+ "version": "17.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": "17.2.0"
26
+ "@react-native-firebase/app": "17.3.1"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "57666670bd7fa4121a6598c639c4b2a24b9d181c"
31
+ "gitHead": "8c57bbb3d9c397fc472b78e9853b671ed41e30ca"
32
32
  }