@@ -35,6 +35,7 @@ export interface User extends UserInfo {
3535 linkWithPopup ( provider : AuthProvider ) : Promise < UserCredential > ;
3636 linkWithRedirect ( provider : AuthProvider ) : Promise < void > ;
3737 metadata : UserMetadata ;
38+ multiFactor : MultiFactorUser ;
3839 phoneNumber : string | null ;
3940 providerData : ( UserInfo | null ) [ ] ;
4041 reauthenticateAndRetrieveDataWithCredential (
@@ -64,6 +65,10 @@ export interface User extends UserInfo {
6465 displayName ?: string | null ;
6566 photoURL ?: string | null ;
6667 } ) : Promise < void > ;
68+ verifyBeforeUpdateEmail (
69+ newEmail : string ,
70+ actionCodeSettings ?: ActionCodeSettings | null
71+ ) : Promise < void > ;
6772}
6873
6974export interface UserInfo {
@@ -75,17 +80,31 @@ export interface UserInfo {
7580 uid : string ;
7681}
7782
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+
7893export class ActionCodeInfo {
7994 private constructor ( ) ;
8095 data : {
8196 email ?: string | null ;
8297 fromEmail ?: string | null ;
98+ multiFactorInfo ?: MultiFactorInfo | null ;
99+ previousEmail ?: string | null ;
83100 } ;
84101 operation : string ;
85102 static Operation : {
86103 PASSWORD_RESET : Operation ;
87104 RECOVER_EMAIL : Operation ;
88105 EMAIL_SIGNIN : Operation ;
106+ REVERT_SECOND_FACTOR_ADDITION : Operation ;
107+ VERIFY_AND_CHANGE_EMAIL : Operation ;
89108 VERIFY_EMAIL : Operation ;
90109 } ;
91110}
@@ -164,6 +183,10 @@ export interface AuthError extends Error {
164183 tenantId ?: string ;
165184}
166185
186+ export interface MultiFactorError extends AuthError {
187+ resolver : MultiFactorResolver ;
188+ }
189+
167190export class FacebookAuthProvider extends FacebookAuthProvider_Instance {
168191 static PROVIDER_ID : string ;
169192 static FACEBOOK_SIGN_IN_METHOD : string ;
@@ -206,6 +229,7 @@ export interface IdTokenResult {
206229 authTime : string ;
207230 issuedAtTime : string ;
208231 signInProvider : string | null ;
232+ signInSecondFactor : string | null ;
209233 claims : {
210234 [ key : string ] : any ;
211235 } ;
@@ -239,11 +263,31 @@ export class PhoneAuthProvider_Instance implements AuthProvider {
239263 constructor ( auth ?: FirebaseAuth | null ) ;
240264 providerId : string ;
241265 verifyPhoneNumber (
242- phoneNumber : string ,
266+ phoneInfoOptions : PhoneInfoOptions | string ,
243267 applicationVerifier : ApplicationVerifier
244268 ) : Promise < string > ;
245269}
246270
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+
247291export class RecaptchaVerifier extends RecaptchaVerifier_Instance { }
248292export class RecaptchaVerifier_Instance implements ApplicationVerifier {
249293 constructor (
@@ -296,10 +340,53 @@ export interface OAuthCredentialOptions {
296340 rawNonce ?: string ;
297341}
298342
343+ export class PhoneAuthCredential extends AuthCredential {
344+ private constructor ( ) ;
345+ }
346+
299347export interface AuthSettings {
300348 appVerificationDisabledForTesting : boolean ;
301349}
302350
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+
303390export class FirebaseAuth {
304391 private constructor ( ) ;
305392
@@ -386,6 +473,7 @@ declare module '@firebase/app-types' {
386473 SAMLAuthProvider : typeof SAMLAuthProvider ;
387474 PhoneAuthProvider : typeof PhoneAuthProvider ;
388475 PhoneAuthProvider_Instance : typeof PhoneAuthProvider_Instance ;
476+ PhoneMultiFactorGenerator : typeof PhoneMultiFactorGenerator ;
389477 RecaptchaVerifier : typeof RecaptchaVerifier ;
390478 RecaptchaVerifier_Instance : typeof RecaptchaVerifier_Instance ;
391479 TwitterAuthProvider : typeof TwitterAuthProvider ;
0 commit comments