@react-native-firebase/auth 25.1.0 → 26.0.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 +24 -0
- package/RNFBAuth.podspec +14 -6
- package/android/build.gradle +23 -0
- package/android/src/main/java/io/invertase/firebase/auth/{ReactNativeFirebaseAuthModule.java → NativeRNFBTurboAuth.java} +122 -102
- package/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthPackage.java +1 -1
- package/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthSyncException.java +35 -0
- package/android/src/main/java/io/invertase/firebase/auth/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboAuthSpec.java +308 -0
- package/android/src/main/java/io/invertase/firebase/auth/generated/jni/CMakeLists.txt +36 -0
- package/android/src/main/java/io/invertase/firebase/auth/generated/jni/RNFBAuthTurboModules-generated.cpp +392 -0
- package/android/src/main/java/io/invertase/firebase/auth/generated/jni/RNFBAuthTurboModules.h +31 -0
- package/android/src/main/java/io/invertase/firebase/auth/generated/jni/react/renderer/components/RNFBAuthTurboModules/RNFBAuthTurboModulesJSI-generated.cpp +538 -0
- package/android/src/main/java/io/invertase/firebase/auth/generated/jni/react/renderer/components/RNFBAuthTurboModules/RNFBAuthTurboModulesJSI.h +611 -0
- package/app.plugin.js +1 -1
- package/dist/module/ConfirmationResult.js.map +1 -1
- package/dist/module/MultiFactorResolver.js.map +1 -1
- package/dist/module/PhoneAuthListener.js +3 -4
- package/dist/module/PhoneAuthListener.js.map +1 -1
- package/dist/module/TotpMultiFactorGenerator.js +1 -1
- package/dist/module/TotpMultiFactorGenerator.js.map +1 -1
- package/dist/module/TotpSecret.js +15 -9
- package/dist/module/TotpSecret.js.map +1 -1
- package/dist/module/User.js +1 -1
- package/dist/module/User.js.map +1 -1
- package/dist/module/getMultiFactorResolver.js +2 -2
- package/dist/module/getMultiFactorResolver.js.map +1 -1
- package/dist/module/index.js +1221 -6
- package/dist/module/index.js.map +1 -1
- package/dist/module/internal/syncNativeError.js +75 -0
- package/dist/module/internal/syncNativeError.js.map +1 -0
- package/dist/module/multiFactor.js +5 -3
- package/dist/module/multiFactor.js.map +1 -1
- package/dist/module/providers/PhoneAuthProvider.js +4 -4
- package/dist/module/providers/PhoneAuthProvider.js.map +1 -1
- package/dist/module/types/auth.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/web/RNFBAuthModule.js +13 -7
- package/dist/module/web/RNFBAuthModule.js.map +1 -1
- package/dist/typescript/lib/ConfirmationResult.d.ts +2 -2
- package/dist/typescript/lib/ConfirmationResult.d.ts.map +1 -1
- package/dist/typescript/lib/MultiFactorResolver.d.ts +6 -6
- package/dist/typescript/lib/MultiFactorResolver.d.ts.map +1 -1
- package/dist/typescript/lib/PhoneAuthListener.d.ts +1 -4
- package/dist/typescript/lib/PhoneAuthListener.d.ts.map +1 -1
- package/dist/typescript/lib/TotpSecret.d.ts +2 -4
- package/dist/typescript/lib/TotpSecret.d.ts.map +1 -1
- package/dist/typescript/lib/User.d.ts +13 -13
- package/dist/typescript/lib/User.d.ts.map +1 -1
- package/dist/typescript/lib/getMultiFactorResolver.d.ts +5 -5
- package/dist/typescript/lib/getMultiFactorResolver.d.ts.map +1 -1
- package/dist/typescript/lib/index.d.ts +377 -4
- package/dist/typescript/lib/index.d.ts.map +1 -1
- package/dist/typescript/lib/internal/syncNativeError.d.ts +6 -0
- package/dist/typescript/lib/internal/syncNativeError.d.ts.map +1 -0
- package/dist/typescript/lib/multiFactor.d.ts +9 -9
- package/dist/typescript/lib/multiFactor.d.ts.map +1 -1
- package/dist/typescript/lib/providers/PhoneAuthProvider.d.ts.map +1 -1
- package/dist/typescript/lib/types/auth.d.ts +13 -0
- package/dist/typescript/lib/types/auth.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +44 -47
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/dist/typescript/lib/web/RNFBAuthModule.d.ts +4 -4
- package/dist/typescript/lib/web/RNFBAuthModule.d.ts.map +1 -1
- package/ios/RNFBAuth/RNFBAuthModule.h +2 -2
- package/ios/RNFBAuth/{RNFBAuthModule.m → RNFBAuthModule.mm} +408 -297
- package/ios/RNFBAuth.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/RNFBAuthTurboModules/RNFBAuthTurboModules-generated.mm +459 -0
- package/ios/generated/RNFBAuthTurboModules/RNFBAuthTurboModules.h +341 -0
- package/ios/generated/RNFBAuthTurboModulesJSI-generated.cpp +538 -0
- package/ios/generated/RNFBAuthTurboModulesJSI.h +611 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/ConfirmationResult.ts +3 -6
- package/lib/MultiFactorResolver.ts +8 -8
- package/lib/PhoneAuthListener.ts +6 -10
- package/lib/TotpMultiFactorGenerator.ts +1 -1
- package/lib/TotpSecret.ts +22 -9
- package/lib/User.ts +27 -38
- package/lib/getMultiFactorResolver.ts +9 -11
- package/lib/index.ts +1836 -6
- package/lib/internal/syncNativeError.ts +89 -0
- package/lib/multiFactor.ts +25 -16
- package/lib/providers/PhoneAuthProvider.ts +9 -22
- package/lib/types/auth.ts +15 -0
- package/lib/types/internal.ts +54 -63
- package/lib/version.ts +1 -1
- package/lib/web/RNFBAuthModule.ts +13 -10
- package/package.json +30 -5
- package/plugin/build/app.plugin.d.ts +2 -0
- package/plugin/build/app.plugin.js +6 -0
- package/plugin/src/app.plugin.ts +3 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/react-native.config.js +9 -0
- package/specs/NativeRNFBTurboAuth.ts +143 -0
- package/typedoc.json +0 -1
- package/dist/module/modular.js +0 -793
- package/dist/module/modular.js.map +0 -1
- package/dist/module/namespaced.js +0 -522
- package/dist/module/namespaced.js.map +0 -1
- package/dist/module/types/namespaced.js +0 -62
- package/dist/module/types/namespaced.js.map +0 -1
- package/dist/typescript/lib/modular.d.ts +0 -370
- 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 -2185
- package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
- package/lib/modular.ts +0 -1166
- package/lib/namespaced.ts +0 -849
- package/lib/types/namespaced.ts +0 -2350
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type {
|
|
18
|
+
import type { UserCredential } from './types/auth';
|
|
19
19
|
import type { AuthInternal } from './types/internal';
|
|
20
20
|
|
|
21
21
|
export default class ConfirmationResult {
|
|
@@ -27,13 +27,10 @@ export default class ConfirmationResult {
|
|
|
27
27
|
this._verificationId = verificationId;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
confirm(verificationCode: string): Promise<
|
|
30
|
+
confirm(verificationCode: string): Promise<UserCredential | null> {
|
|
31
31
|
return this._auth.native
|
|
32
32
|
.confirmationResultConfirm(verificationCode)
|
|
33
|
-
.then(
|
|
34
|
-
userCredential =>
|
|
35
|
-
this._auth._setUserCredential(userCredential) as FirebaseAuthTypes.UserCredential,
|
|
36
|
-
);
|
|
33
|
+
.then(userCredential => this._auth._setUserCredential(userCredential) as UserCredential);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
get verificationId(): string {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Base class to facilitate multi-factor authentication.
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { MultiFactorInfo, MultiFactorSession, UserCredential } from './types/auth';
|
|
5
5
|
import type { AuthInternal } from './types/internal';
|
|
6
6
|
|
|
7
7
|
type ResolverLike = {
|
|
8
|
-
hints:
|
|
9
|
-
session:
|
|
8
|
+
hints: MultiFactorInfo[];
|
|
9
|
+
session: MultiFactorSession;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
type PhoneMultiFactorAssertion = {
|
|
@@ -17,8 +17,8 @@ type PhoneMultiFactorAssertion = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export default class MultiFactorResolver {
|
|
20
|
-
readonly hints:
|
|
21
|
-
readonly session:
|
|
20
|
+
readonly hints: MultiFactorInfo[];
|
|
21
|
+
readonly session: MultiFactorSession;
|
|
22
22
|
private readonly _auth: AuthInternal;
|
|
23
23
|
|
|
24
24
|
constructor(auth: AuthInternal, resolver: ResolverLike) {
|
|
@@ -27,7 +27,7 @@ export default class MultiFactorResolver {
|
|
|
27
27
|
this.session = resolver.session;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
resolveSignIn(assertion: PhoneMultiFactorAssertion): Promise<
|
|
30
|
+
resolveSignIn(assertion: PhoneMultiFactorAssertion): Promise<UserCredential> {
|
|
31
31
|
const { token, secret, uid, verificationCode } = assertion;
|
|
32
32
|
|
|
33
33
|
if (token && secret) {
|
|
@@ -35,7 +35,7 @@ export default class MultiFactorResolver {
|
|
|
35
35
|
this.session,
|
|
36
36
|
token,
|
|
37
37
|
secret,
|
|
38
|
-
) as Promise<
|
|
38
|
+
) as Promise<UserCredential>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (uid && verificationCode) {
|
|
@@ -43,7 +43,7 @@ export default class MultiFactorResolver {
|
|
|
43
43
|
this.session,
|
|
44
44
|
uid,
|
|
45
45
|
verificationCode,
|
|
46
|
-
) as Promise<
|
|
46
|
+
) as Promise<UserCredential>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
throw new Error('Invalid multi-factor assertion provided for sign-in resolution.');
|
package/lib/PhoneAuthListener.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from '@react-native-firebase/app/dist/module/common';
|
|
24
24
|
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
25
25
|
import NativeFirebaseError from '@react-native-firebase/app/dist/module/internal/NativeFirebaseError';
|
|
26
|
-
import type {
|
|
26
|
+
import type { PhoneAuthSnapshot, PhoneAuthError } from './types/auth';
|
|
27
27
|
import type {
|
|
28
28
|
AuthInternal,
|
|
29
29
|
NativePhoneAuthCredentialInternal,
|
|
@@ -38,8 +38,6 @@ type PhoneAuthInternalEventType =
|
|
|
38
38
|
|
|
39
39
|
type InternalEvents = Record<PhoneAuthInternalEventType, string>;
|
|
40
40
|
type PublicEvents = Record<'error' | 'event' | 'success', string>;
|
|
41
|
-
type PhoneAuthSnapshot = FirebaseAuthTypes.PhoneAuthSnapshot;
|
|
42
|
-
type PhoneAuthError = FirebaseAuthTypes.PhoneAuthError;
|
|
43
41
|
|
|
44
42
|
let REQUEST_ID = 0;
|
|
45
43
|
|
|
@@ -235,16 +233,14 @@ export default class PhoneAuthListener {
|
|
|
235
233
|
const snapshot: PhoneAuthSnapshot = {
|
|
236
234
|
verificationId: state.verificationId,
|
|
237
235
|
code: null,
|
|
238
|
-
error:
|
|
236
|
+
error: new NativeFirebaseError(
|
|
237
|
+
{ userInfo: state.error },
|
|
238
|
+
this._jsStack,
|
|
239
|
+
'auth',
|
|
240
|
+
) as ReactNativeFirebase.NativeFirebaseError,
|
|
239
241
|
state: 'error',
|
|
240
242
|
};
|
|
241
243
|
|
|
242
|
-
snapshot.error = new NativeFirebaseError(
|
|
243
|
-
{ userInfo: state.error },
|
|
244
|
-
this._jsStack,
|
|
245
|
-
'auth',
|
|
246
|
-
) as ReactNativeFirebase.NativeFirebaseError;
|
|
247
|
-
|
|
248
244
|
this._emitToObservers(snapshot);
|
|
249
245
|
this._emitToErrorCb(snapshot);
|
|
250
246
|
this._removeAllListeners();
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { isOther } from '@react-native-firebase/app/dist/module/common';
|
|
19
19
|
import { TotpSecret } from './TotpSecret';
|
|
20
|
-
import { getAuth } from './
|
|
20
|
+
import { getAuth } from './index';
|
|
21
21
|
import type { Auth, MultiFactorSession, TotpMultiFactorAssertion } from './types/auth';
|
|
22
22
|
import type { AuthInternal } from './types/internal';
|
|
23
23
|
|
package/lib/TotpSecret.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { isString } from '@react-native-firebase/app/dist/module/common';
|
|
18
|
+
import { rethrowAuthSyncNativeError } from './internal/syncNativeError';
|
|
18
19
|
import type { AuthInternal } from './types/internal';
|
|
19
20
|
|
|
20
21
|
export class TotpSecret {
|
|
@@ -41,17 +42,29 @@ export class TotpSecret {
|
|
|
41
42
|
*
|
|
42
43
|
* @param accountName the name of the account/app along with a user identifier.
|
|
43
44
|
* @param issuer issuer of the TOTP (likely the app name).
|
|
44
|
-
* @returns A
|
|
45
|
-
* return type, this method is async because QR code generation is performed through the React Native
|
|
46
|
-
* native auth bridge.
|
|
45
|
+
* @returns A QR code URL string.
|
|
47
46
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
generateQrCodeUrl(accountName?: string, issuer?: string): string {
|
|
48
|
+
let resolvedAccountName = accountName;
|
|
49
|
+
let resolvedIssuer = issuer;
|
|
50
|
+
|
|
51
|
+
if (!isString(resolvedAccountName) || resolvedAccountName === '') {
|
|
52
|
+
resolvedAccountName = this.auth.currentUser?.email ?? 'unknownuser';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!isString(resolvedIssuer) || resolvedIssuer === '') {
|
|
56
|
+
resolvedIssuer = this.auth.app.name;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
return this.auth.native.generateQrCodeUrl(
|
|
61
|
+
this.secretKey,
|
|
62
|
+
resolvedAccountName,
|
|
63
|
+
resolvedIssuer,
|
|
64
|
+
);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
rethrowAuthSyncNativeError(error);
|
|
53
67
|
}
|
|
54
|
-
return this.auth.native.generateQrCodeUrl(this.secretKey, accountName, issuer);
|
|
55
68
|
}
|
|
56
69
|
|
|
57
70
|
/**
|
package/lib/User.ts
CHANGED
|
@@ -22,10 +22,17 @@ import {
|
|
|
22
22
|
isBoolean,
|
|
23
23
|
} from '@react-native-firebase/app/dist/module/common';
|
|
24
24
|
import type { IdTokenResult, UserInfo, UserMetadata } from './types/auth';
|
|
25
|
-
import type {
|
|
25
|
+
import type {
|
|
26
|
+
AuthProvider,
|
|
27
|
+
AuthCredential,
|
|
28
|
+
ActionCodeSettings,
|
|
29
|
+
MultiFactor,
|
|
30
|
+
UpdateProfile,
|
|
31
|
+
UserCredential,
|
|
32
|
+
} from './types/auth';
|
|
26
33
|
import type { AuthInternal, NativeUserInternal } from './types/internal';
|
|
27
34
|
|
|
28
|
-
type AuthProviderWithObject =
|
|
35
|
+
type AuthProviderWithObject = AuthProvider & {
|
|
29
36
|
toObject(): Record<string, unknown>;
|
|
30
37
|
};
|
|
31
38
|
|
|
@@ -65,7 +72,7 @@ export default class User {
|
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
get multiFactor():
|
|
75
|
+
get multiFactor(): MultiFactor | null {
|
|
69
76
|
return this._user.multiFactor || null;
|
|
70
77
|
}
|
|
71
78
|
|
|
@@ -101,7 +108,7 @@ export default class User {
|
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
delete(): Promise<void> {
|
|
104
|
-
return this._auth.native.
|
|
111
|
+
return this._auth.native.deleteUser().then(() => {
|
|
105
112
|
this._auth._setUser(null);
|
|
106
113
|
});
|
|
107
114
|
}
|
|
@@ -114,52 +121,34 @@ export default class User {
|
|
|
114
121
|
return this._auth.native.getIdTokenResult(forceRefresh) as Promise<IdTokenResult>;
|
|
115
122
|
}
|
|
116
123
|
|
|
117
|
-
linkWithCredential(
|
|
118
|
-
credential: FirebaseAuthTypes.AuthCredential,
|
|
119
|
-
): Promise<FirebaseAuthTypes.UserCredential> {
|
|
124
|
+
linkWithCredential(credential: AuthCredential): Promise<UserCredential> {
|
|
120
125
|
return this._auth.native
|
|
121
126
|
.linkWithCredential(credential.providerId, credential.token, credential.secret)
|
|
122
|
-
.then(
|
|
123
|
-
userCredential =>
|
|
124
|
-
this._auth._setUserCredential(userCredential) as FirebaseAuthTypes.UserCredential,
|
|
125
|
-
);
|
|
127
|
+
.then(userCredential => this._auth._setUserCredential(userCredential) as UserCredential);
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
linkWithPopup(provider: AuthProviderWithObject): Promise<
|
|
130
|
+
linkWithPopup(provider: AuthProviderWithObject): Promise<UserCredential> {
|
|
129
131
|
// call through to linkWithRedirect for shared implementation
|
|
130
132
|
return this.linkWithRedirect(provider);
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
linkWithRedirect(provider: AuthProviderWithObject): Promise<
|
|
135
|
+
linkWithRedirect(provider: AuthProviderWithObject): Promise<UserCredential> {
|
|
134
136
|
return this._auth.native
|
|
135
137
|
.linkWithProvider(provider.toObject())
|
|
136
|
-
.then(
|
|
137
|
-
userCredential =>
|
|
138
|
-
this._auth._setUserCredential(userCredential) as FirebaseAuthTypes.UserCredential,
|
|
139
|
-
);
|
|
138
|
+
.then(userCredential => this._auth._setUserCredential(userCredential) as UserCredential);
|
|
140
139
|
}
|
|
141
140
|
|
|
142
|
-
reauthenticateWithCredential(
|
|
143
|
-
credential: FirebaseAuthTypes.AuthCredential,
|
|
144
|
-
): Promise<FirebaseAuthTypes.UserCredential> {
|
|
141
|
+
reauthenticateWithCredential(credential: AuthCredential): Promise<UserCredential> {
|
|
145
142
|
return this._auth.native
|
|
146
143
|
.reauthenticateWithCredential(credential.providerId, credential.token, credential.secret)
|
|
147
|
-
.then(
|
|
148
|
-
userCredential =>
|
|
149
|
-
this._auth._setUserCredential(userCredential) as FirebaseAuthTypes.UserCredential,
|
|
150
|
-
);
|
|
144
|
+
.then(userCredential => this._auth._setUserCredential(userCredential) as UserCredential);
|
|
151
145
|
}
|
|
152
146
|
|
|
153
|
-
reauthenticateWithPopup(
|
|
154
|
-
provider: AuthProviderWithObject,
|
|
155
|
-
): Promise<FirebaseAuthTypes.UserCredential> {
|
|
147
|
+
reauthenticateWithPopup(provider: AuthProviderWithObject): Promise<UserCredential> {
|
|
156
148
|
// call through to reauthenticateWithRedirect for shared implementation
|
|
157
149
|
return this._auth.native
|
|
158
150
|
.reauthenticateWithProvider(provider.toObject())
|
|
159
|
-
.then(
|
|
160
|
-
userCredential =>
|
|
161
|
-
this._auth._setUserCredential(userCredential) as FirebaseAuthTypes.UserCredential,
|
|
162
|
-
);
|
|
151
|
+
.then(userCredential => this._auth._setUserCredential(userCredential) as UserCredential);
|
|
163
152
|
}
|
|
164
153
|
|
|
165
154
|
reauthenticateWithRedirect(provider: AuthProviderWithObject): Promise<void> {
|
|
@@ -176,9 +165,9 @@ export default class User {
|
|
|
176
165
|
});
|
|
177
166
|
}
|
|
178
167
|
|
|
179
|
-
sendEmailVerification(actionCodeSettings?:
|
|
168
|
+
sendEmailVerification(actionCodeSettings?: ActionCodeSettings): Promise<void> {
|
|
180
169
|
if (isObject(actionCodeSettings)) {
|
|
181
|
-
const settings = actionCodeSettings as
|
|
170
|
+
const settings = actionCodeSettings as ActionCodeSettings;
|
|
182
171
|
|
|
183
172
|
if (!isString(settings.url)) {
|
|
184
173
|
throw new Error(
|
|
@@ -249,7 +238,7 @@ export default class User {
|
|
|
249
238
|
return Object.assign({}, this._user);
|
|
250
239
|
}
|
|
251
240
|
|
|
252
|
-
unlink(providerId: string): Promise<
|
|
241
|
+
unlink(providerId: string): Promise<import('./types/auth').User> {
|
|
253
242
|
return this._auth.native.unlink(providerId).then(user => {
|
|
254
243
|
const updatedUser = this._auth._setUser(user);
|
|
255
244
|
if (!updatedUser) {
|
|
@@ -271,7 +260,7 @@ export default class User {
|
|
|
271
260
|
});
|
|
272
261
|
}
|
|
273
262
|
|
|
274
|
-
updatePhoneNumber(credential:
|
|
263
|
+
updatePhoneNumber(credential: AuthCredential): Promise<void> {
|
|
275
264
|
return this._auth.native
|
|
276
265
|
.updatePhoneNumber(credential.providerId, credential.token, credential.secret)
|
|
277
266
|
.then(user => {
|
|
@@ -279,7 +268,7 @@ export default class User {
|
|
|
279
268
|
});
|
|
280
269
|
}
|
|
281
270
|
|
|
282
|
-
updateProfile(updates:
|
|
271
|
+
updateProfile(updates: UpdateProfile): Promise<void> {
|
|
283
272
|
return this._auth.native.updateProfile(updates).then(user => {
|
|
284
273
|
this._auth._setUser(user);
|
|
285
274
|
});
|
|
@@ -287,7 +276,7 @@ export default class User {
|
|
|
287
276
|
|
|
288
277
|
verifyBeforeUpdateEmail(
|
|
289
278
|
newEmail: string,
|
|
290
|
-
actionCodeSettings?:
|
|
279
|
+
actionCodeSettings?: ActionCodeSettings,
|
|
291
280
|
): Promise<void> {
|
|
292
281
|
if (!isString(newEmail)) {
|
|
293
282
|
throw new Error(
|
|
@@ -296,7 +285,7 @@ export default class User {
|
|
|
296
285
|
}
|
|
297
286
|
|
|
298
287
|
if (isObject(actionCodeSettings)) {
|
|
299
|
-
const settings = actionCodeSettings as
|
|
288
|
+
const settings = actionCodeSettings as ActionCodeSettings;
|
|
300
289
|
|
|
301
290
|
if (!isString(settings.url)) {
|
|
302
291
|
throw new Error(
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { isOther } from '@react-native-firebase/app/dist/module/common';
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
2
|
+
import MultiFactorResolverClass from './MultiFactorResolver';
|
|
3
|
+
import type { MultiFactorError, MultiFactorResolver } from './types/auth';
|
|
4
4
|
import type { AuthInternal } from './types/internal';
|
|
5
5
|
|
|
6
|
-
type ErrorWithResolver =
|
|
6
|
+
type ErrorWithResolver = MultiFactorError & {
|
|
7
7
|
userInfo?: {
|
|
8
8
|
resolver?: {
|
|
9
|
-
hints:
|
|
10
|
-
session:
|
|
9
|
+
hints: MultiFactorResolver['hints'];
|
|
10
|
+
session: MultiFactorResolver['session'];
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
};
|
|
@@ -21,21 +21,19 @@ type ErrorWithResolver = FirebaseAuthTypes.MultiFactorError & {
|
|
|
21
21
|
export function getMultiFactorResolver(
|
|
22
22
|
auth: AuthInternal,
|
|
23
23
|
error: ErrorWithResolver,
|
|
24
|
-
):
|
|
24
|
+
): MultiFactorResolver | null {
|
|
25
25
|
if (isOther) {
|
|
26
|
-
return auth.native.getMultiFactorResolver(
|
|
27
|
-
error,
|
|
28
|
-
) as FirebaseAuthTypes.MultiFactorResolver | null;
|
|
26
|
+
return auth.native.getMultiFactorResolver(error) as MultiFactorResolver | null;
|
|
29
27
|
}
|
|
30
28
|
if (
|
|
31
29
|
error.hasOwnProperty('userInfo') &&
|
|
32
30
|
error.userInfo?.hasOwnProperty('resolver') &&
|
|
33
31
|
error.userInfo.resolver
|
|
34
32
|
) {
|
|
35
|
-
return new
|
|
33
|
+
return new MultiFactorResolverClass(
|
|
36
34
|
auth,
|
|
37
35
|
error.userInfo.resolver,
|
|
38
|
-
) as unknown as
|
|
36
|
+
) as unknown as MultiFactorResolver;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
return null;
|