@react-native-firebase/auth 16.4.3 → 16.4.5

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,16 @@
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
+ ### [16.4.5](https://github.com/invertase/react-native-firebase/compare/v16.4.4...v16.4.5) (2022-11-16)
7
+
8
+ **Note:** Version bump only for package @react-native-firebase/auth
9
+
10
+ ### [16.4.4](https://github.com/invertase/react-native-firebase/compare/v16.4.3...v16.4.4) (2022-11-14)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **auth, multifactor:** put multiFactor and getMultiFactorResolver on auth() ([357094e](https://github.com/invertase/react-native-firebase/commit/357094e4b7504165081ffda0c4105569480f5b79))
15
+
6
16
  ### [16.4.3](https://github.com/invertase/react-native-firebase/compare/v16.4.2...v16.4.3) (2022-11-06)
7
17
 
8
18
  ### Bug Fixes
package/lib/index.d.ts CHANGED
@@ -1871,6 +1871,19 @@ export namespace FirebaseAuthTypes {
1871
1871
  * @param url: emulator URL, must have host and port (eg, 'http://localhost:9099')
1872
1872
  */
1873
1873
  useEmulator(url: string): void;
1874
+ /**
1875
+ * Provides a MultiFactorResolver suitable for completion of a multi-factor flow.
1876
+ *
1877
+ * @param error: The MultiFactorError raised during a sign-in, or reauthentication operation.
1878
+ */
1879
+ getMultiFactorResolver(error: MultiFactorError): MultiFactorResolver;
1880
+ /**
1881
+ * The MultiFactorUser corresponding to the user.
1882
+ *
1883
+ * This is used to access all multi-factor properties and operations related to the user.
1884
+ * @param user The user.
1885
+ */
1886
+ multiFactor(user: User): MultiFactorUser;
1874
1887
  }
1875
1888
  }
1876
1889
 
package/lib/index.js CHANGED
@@ -42,7 +42,7 @@ import Settings from './Settings';
42
42
  import User from './User';
43
43
  import version from './version';
44
44
  import { getMultiFactorResolver } from './getMultiFactorResolver';
45
- import { multiFactor } from './multiFactor';
45
+ import { multiFactor, MultiFactorUser } from './multiFactor';
46
46
 
47
47
  const statics = {
48
48
  AppleAuthProvider,
@@ -414,6 +414,17 @@ class FirebaseAuthModule extends FirebaseModule {
414
414
  this.native.useEmulator(host, port);
415
415
  return [host, port]; // undocumented return, useful for unit testing
416
416
  }
417
+
418
+ getMultiFactorResolver(error) {
419
+ return getMultiFactorResolver(this, error);
420
+ }
421
+
422
+ multiFactor(user) {
423
+ if (user.userId !== this.currentUser.userId) {
424
+ throw new Error('firebase.auth().multiFactor() only operates on currentUser');
425
+ }
426
+ return new MultiFactorUser(this, user);
427
+ }
417
428
  }
418
429
 
419
430
  // import { SDK_VERSION } from '@react-native-firebase/auth';
@@ -2,14 +2,19 @@
2
2
  * Return a MultiFactorUser instance the gateway to multi-factor operations.
3
3
  */
4
4
  export function multiFactor(auth) {
5
+ // eslint-disable-next-line no-console
6
+ console.warn('This method is deprecated. Please use auth().multiFactor(user) instead');
5
7
  return new MultiFactorUser(auth);
6
8
  }
7
9
 
8
10
  export class MultiFactorUser {
9
- constructor(auth) {
11
+ constructor(auth, user) {
10
12
  this._auth = auth;
11
- this._user = auth.currentUser;
12
- this.enrolledFactor = auth.currentUser.multiFactor.enrolledFactors;
13
+ if (user === undefined) {
14
+ user = auth.currentUser;
15
+ }
16
+ this._user = user;
17
+ this.enrolledFactor = user.multiFactor.enrolledFactors;
13
18
  }
14
19
 
15
20
  getSession() {
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '16.4.3';
2
+ module.exports = '16.4.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/auth",
3
- "version": "16.4.3",
3
+ "version": "16.4.5",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - The authentication module provides an easy-to-use API to integrate an authentication workflow into new and existing applications. React Native Firebase provides access to all Firebase authentication methods and identity providers.",
6
6
  "main": "lib/index.js",
@@ -24,11 +24,11 @@
24
24
  "auth"
25
25
  ],
26
26
  "dependencies": {
27
- "@expo/config-plugins": "^5.0.1",
27
+ "@expo/config-plugins": "^5.0.4",
28
28
  "plist": "^3.0.5"
29
29
  },
30
30
  "peerDependencies": {
31
- "@react-native-firebase/app": "16.4.3"
31
+ "@react-native-firebase/app": "16.4.5"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
@@ -36,5 +36,5 @@
36
36
  "devDependencies": {
37
37
  "@types/plist": "^3.0.2"
38
38
  },
39
- "gitHead": "fe9e40480d70b0eb6b2a9d4c2c117688c9abcafd"
39
+ "gitHead": "1dc3b30b6a8d84d9356a090fe9166b38e26735eb"
40
40
  }