@@ -35,6 +35,7 @@ export interface User extends UserInfo {
35
35
linkWithPopup ( provider : AuthProvider ) : Promise < UserCredential > ;
36
36
linkWithRedirect ( provider : AuthProvider ) : Promise < void > ;
37
37
metadata : UserMetadata ;
38
+ multiFactor : MultiFactorUser ;
38
39
phoneNumber : string | null ;
39
40
providerData : ( UserInfo | null ) [ ] ;
40
41
reauthenticateAndRetrieveDataWithCredential (
@@ -64,6 +65,10 @@ export interface User extends UserInfo {
64
65
displayName ?: string | null ;
65
66
photoURL ?: string | null ;
66
67
} ) : Promise < void > ;
68
+ verifyBeforeUpdateEmail (
69
+ newEmail : string ,
70
+ actionCodeSettings ?: ActionCodeSettings | null
71
+ ) : Promise < void > ;
67
72
}
68
73
69
74
export interface UserInfo {
@@ -75,17 +80,31 @@ export interface UserInfo {
75
80
uid : string ;
76
81
}
77
82
83
+ export interface MultiFactorUser {
84
+ enrolledFactors : MultiFactorInfo [ ] ;
85
+ enroll (
86
+ assertion : MultiFactorAssertion ,
87
+ displayName ?: string | null
88
+ ) : Promise < void > ;
89
+ getSession ( ) : Promise < MultiFactorSession > ;
90
+ unenroll ( option : MultiFactorInfo | string ) : Promise < void > ;
91
+ }
92
+
78
93
export class ActionCodeInfo {
79
94
private constructor ( ) ;
80
95
data : {
81
96
email ?: string | null ;
82
97
fromEmail ?: string | null ;
98
+ multiFactorInfo ?: MultiFactorInfo | null ;
99
+ previousEmail ?: string | null ;
83
100
} ;
84
101
operation : string ;
85
102
static Operation : {
86
103
PASSWORD_RESET : Operation ;
87
104
RECOVER_EMAIL : Operation ;
88
105
EMAIL_SIGNIN : Operation ;
106
+ REVERT_SECOND_FACTOR_ADDITION : Operation ;
107
+ VERIFY_AND_CHANGE_EMAIL : Operation ;
89
108
VERIFY_EMAIL : Operation ;
90
109
} ;
91
110
}
@@ -164,6 +183,10 @@ export interface AuthError extends Error {
164
183
tenantId ?: string ;
165
184
}
166
185
186
+ export interface MultiFactorError extends AuthError {
187
+ resolver : MultiFactorResolver ;
188
+ }
189
+
167
190
export class FacebookAuthProvider extends FacebookAuthProvider_Instance {
168
191
static PROVIDER_ID : string ;
169
192
static FACEBOOK_SIGN_IN_METHOD : string ;
@@ -206,6 +229,7 @@ export interface IdTokenResult {
206
229
authTime : string ;
207
230
issuedAtTime : string ;
208
231
signInProvider : string | null ;
232
+ signInSecondFactor : string | null ;
209
233
claims : {
210
234
[ key : string ] : any ;
211
235
} ;
@@ -239,11 +263,31 @@ export class PhoneAuthProvider_Instance implements AuthProvider {
239
263
constructor ( auth ?: FirebaseAuth | null ) ;
240
264
providerId : string ;
241
265
verifyPhoneNumber (
242
- phoneNumber : string ,
266
+ phoneInfoOptions : PhoneInfoOptions | string ,
243
267
applicationVerifier : ApplicationVerifier
244
268
) : Promise < string > ;
245
269
}
246
270
271
+ export type PhoneInfoOptions =
272
+ | PhoneSingleFactorInfoOptions
273
+ | PhoneMultiFactorEnrollInfoOptions
274
+ | PhoneMultiFactorSignInInfoOptions ;
275
+
276
+ export interface PhoneSingleFactorInfoOptions {
277
+ phoneNumber : string ;
278
+ }
279
+
280
+ export interface PhoneMultiFactorEnrollInfoOptions {
281
+ phoneNumber : string ;
282
+ session : MultiFactorSession ;
283
+ }
284
+
285
+ export interface PhoneMultiFactorSignInInfoOptions {
286
+ multiFactorHint ?: MultiFactorInfo ;
287
+ multiFactorUid ?: string ;
288
+ session : MultiFactorSession ;
289
+ }
290
+
247
291
export class RecaptchaVerifier extends RecaptchaVerifier_Instance { }
248
292
export class RecaptchaVerifier_Instance implements ApplicationVerifier {
249
293
constructor (
@@ -296,10 +340,53 @@ export interface OAuthCredentialOptions {
296
340
rawNonce ?: string ;
297
341
}
298
342
343
+ export class PhoneAuthCredential extends AuthCredential {
344
+ private constructor ( ) ;
345
+ }
346
+
299
347
export interface AuthSettings {
300
348
appVerificationDisabledForTesting : boolean ;
301
349
}
302
350
351
+ export class MultiFactorSession {
352
+ private constructor ( ) ;
353
+ }
354
+
355
+ export abstract class MultiFactorAssertion {
356
+ factorId : string ;
357
+ }
358
+
359
+ export class MultiFactorResolver {
360
+ private constructor ( ) ;
361
+ auth : FirebaseAuth ;
362
+ session : MultiFactorSession ;
363
+ hints : MultiFactorInfo [ ] ;
364
+ resolveSignIn ( assertion : MultiFactorAssertion ) : Promise < UserCredential > ;
365
+ }
366
+
367
+ export interface MultiFactorInfo {
368
+ uid : string ;
369
+ displayName ?: string | null ;
370
+ enrollmentTime : string ;
371
+ factorId : string ;
372
+ }
373
+
374
+ export interface PhoneMultiFactorInfo extends MultiFactorInfo {
375
+ phoneNumber : string ;
376
+ }
377
+
378
+ export class PhoneMultiFactorAssertion extends MultiFactorAssertion {
379
+ private constructor ( ) ;
380
+ }
381
+
382
+ export class PhoneMultiFactorGenerator {
383
+ private constructor ( ) ;
384
+ static FACTOR_ID : string ;
385
+ static assertion (
386
+ phoneAuthCredential : PhoneAuthCredential
387
+ ) : PhoneMultiFactorAssertion ;
388
+ }
389
+
303
390
export class FirebaseAuth {
304
391
private constructor ( ) ;
305
392
@@ -386,6 +473,7 @@ declare module '@firebase/app-types' {
386
473
SAMLAuthProvider : typeof SAMLAuthProvider ;
387
474
PhoneAuthProvider : typeof PhoneAuthProvider ;
388
475
PhoneAuthProvider_Instance : typeof PhoneAuthProvider_Instance ;
476
+ PhoneMultiFactorGenerator : typeof PhoneMultiFactorGenerator ;
389
477
RecaptchaVerifier : typeof RecaptchaVerifier ;
390
478
RecaptchaVerifier_Instance : typeof RecaptchaVerifier_Instance ;
391
479
TwitterAuthProvider : typeof TwitterAuthProvider ;
0 commit comments