@react-native-firebase/auth 16.4.2 → 16.4.4
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 +12 -0
- package/lib/index.d.ts +50 -5
- package/lib/index.js +12 -1
- package/lib/multiFactor.js +8 -3
- package/lib/version.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
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.4](https://github.com/invertase/react-native-firebase/compare/v16.4.3...v16.4.4) (2022-11-14)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **auth, multifactor:** put multiFactor and getMultiFactorResolver on auth() ([357094e](https://github.com/invertase/react-native-firebase/commit/357094e4b7504165081ffda0c4105569480f5b79))
|
11
|
+
|
12
|
+
### [16.4.3](https://github.com/invertase/react-native-firebase/compare/v16.4.2...v16.4.3) (2022-11-06)
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
- **auth, types:** augment multi-factor auth types ([5f183c4](https://github.com/invertase/react-native-firebase/commit/5f183c45301c0a5727a45688e69d0944c04e102a))
|
17
|
+
|
6
18
|
### [16.4.2](https://github.com/invertase/react-native-firebase/compare/v16.4.1...v16.4.2) (2022-11-04)
|
7
19
|
|
8
20
|
**Note:** Version bump only for package @react-native-firebase/auth
|
package/lib/index.d.ts
CHANGED
@@ -194,6 +194,11 @@ export namespace FirebaseAuthTypes {
|
|
194
194
|
ERROR: 'error';
|
195
195
|
}
|
196
196
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
198
|
+
export interface MultiFactorSession {
|
199
|
+
// this is has no documented contents, it is simply returned from some APIs and passed to others
|
200
|
+
}
|
201
|
+
|
197
202
|
export interface PhoneMultiFactorGenerator {
|
198
203
|
/**
|
199
204
|
* Identifies second factors of type phone.
|
@@ -417,6 +422,22 @@ export namespace FirebaseAuthTypes {
|
|
417
422
|
secret: string;
|
418
423
|
}
|
419
424
|
|
425
|
+
export interface PhoneMultiFactorEnrollInfoOptions {
|
426
|
+
phoneNumber: string;
|
427
|
+
session: MultiFactorSession;
|
428
|
+
}
|
429
|
+
|
430
|
+
export interface PhoneMultiFactorSignInInfoOptions {
|
431
|
+
multiFactorHint?: MultiFactorInfo;
|
432
|
+
|
433
|
+
/**
|
434
|
+
* Unused in react-native-firebase ipmlementation
|
435
|
+
*/
|
436
|
+
multiFactorUid?: string;
|
437
|
+
|
438
|
+
session: MultiFactorSession;
|
439
|
+
}
|
440
|
+
|
420
441
|
/**
|
421
442
|
* Facilitates the recovery when a user needs to provide a second factor to sign-in.
|
422
443
|
*/
|
@@ -428,12 +449,12 @@ export namespace FirebaseAuthTypes {
|
|
428
449
|
/**
|
429
450
|
* Serialized session this resolver belongs to.
|
430
451
|
*/
|
431
|
-
session:
|
452
|
+
session: MultiFactorSession;
|
432
453
|
|
433
454
|
/**
|
434
455
|
* For testing purposes only
|
435
456
|
*/
|
436
|
-
_auth
|
457
|
+
_auth?: FirebaseAuthTypes.Module;
|
437
458
|
|
438
459
|
/**
|
439
460
|
* Resolve the multi factor flow.
|
@@ -473,9 +494,9 @@ export namespace FirebaseAuthTypes {
|
|
473
494
|
enrolledFactors: MultiFactorInfo[];
|
474
495
|
|
475
496
|
/**
|
476
|
-
* Return the session
|
497
|
+
* Return the session for this user.
|
477
498
|
*/
|
478
|
-
getSession(): Promise<
|
499
|
+
getSession(): Promise<MultiFactorSession>;
|
479
500
|
|
480
501
|
/**
|
481
502
|
* Enroll an additional factor. Provide an optional display name that can be shown to the user.
|
@@ -1566,7 +1587,18 @@ export namespace FirebaseAuthTypes {
|
|
1566
1587
|
/**
|
1567
1588
|
* Obtain a verification id to complete the multi-factor sign-in flow.
|
1568
1589
|
*/
|
1569
|
-
verifyPhoneNumberWithMultiFactorInfo(
|
1590
|
+
verifyPhoneNumberWithMultiFactorInfo(
|
1591
|
+
hint: MultiFactorInfo,
|
1592
|
+
session: MultiFactorSession,
|
1593
|
+
): Promise<string>;
|
1594
|
+
|
1595
|
+
/**
|
1596
|
+
* Send an SMS to the user for verification of second factor
|
1597
|
+
* @param phoneInfoOptions the phone number and session to use during enrollment
|
1598
|
+
*/
|
1599
|
+
verifyPhoneNumberForMultiFactor(
|
1600
|
+
phoneInfoOptions: PhoneMultiFactorEnrollInfoOptions,
|
1601
|
+
): Promise<string>;
|
1570
1602
|
|
1571
1603
|
/**
|
1572
1604
|
* Creates a new user with an email and password.
|
@@ -1839,6 +1871,19 @@ export namespace FirebaseAuthTypes {
|
|
1839
1871
|
* @param url: emulator URL, must have host and port (eg, 'http://localhost:9099')
|
1840
1872
|
*/
|
1841
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;
|
1842
1887
|
}
|
1843
1888
|
}
|
1844
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';
|
package/lib/multiFactor.js
CHANGED
@@ -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
|
-
|
12
|
-
|
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.
|
2
|
+
module.exports = '16.4.4';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/auth",
|
3
|
-
"version": "16.4.
|
3
|
+
"version": "16.4.4",
|
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.
|
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.
|
31
|
+
"@react-native-firebase/app": "16.4.4"
|
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": "
|
39
|
+
"gitHead": "09c047ac956a44696199df0c52665c0b4446e463"
|
40
40
|
}
|