Skip to content

Commit 993c696

Browse files
committed
fix: improve types and apply to ios
1 parent bcea81e commit 993c696

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

packages/auth/ios/RNFBAuth/RNFBAuthModule.m

+1
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,7 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
16951695
@"enrollmentTime" : enrollmentTime,
16961696
// @deprecated enrollmentDate kept for backwards compatibility, please use enrollmentTime
16971697
@"enrollmentDate" : enrollmentTime,
1698+
@"phoneNumber" : hint.phoneNumber,
16981699
}];
16991700
}
17001701
return enrolledFactors;

packages/auth/lib/index.d.ts

+15-10
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,21 @@ export namespace FirebaseAuthTypes {
472472
/**
473473
* Contains information about a second factor.
474474
*/
475-
export interface MultiFactorInfo {
475+
export type MultiFactorInfo = PhoneMultiFactorInfo | TotpMultiFactorInfo;
476+
477+
export interface PhoneMultiFactorInfo extends MultiFactorInfoCommon {
478+
factorId: 'phone';
479+
/**
480+
* The phone number used for this factor.
481+
*/
482+
phoneNumber: string;
483+
}
484+
485+
export interface TotpMultiFactorInfo extends MultiFactorInfoCommon {
486+
factorId: 'totp';
487+
}
488+
489+
export interface MultiFactorInfoCommon {
476490
/**
477491
* User friendly name for this factor.
478492
*/
@@ -481,21 +495,12 @@ export namespace FirebaseAuthTypes {
481495
* Time the second factor was enrolled, in UTC.
482496
*/
483497
enrollmentTime: string;
484-
/**
485-
* Type of factor.
486-
*/
487-
factorId: FactorId;
488498
/**
489499
* Unique id for this factor.
490500
*/
491501
uid: string;
492502
}
493503

494-
export interface PhoneMultiFactorInfo extends MultiFactorInfo {
495-
factorId: "phone";
496-
phoneNumber: string;
497-
}
498-
499504
export interface MultiFactorAssertion {
500505
token: string;
501506
secret: string;

0 commit comments

Comments
 (0)