Skip to content

Commit 326e070

Browse files
committed
fix: improve types and apply to ios
1 parent 3e8330d commit 326e070

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

packages/auth/ios/RNFBAuth/RNFBAuthModule.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,8 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
16671667
@"uid" : hint.UID,
16681668
@"factorId" : hint.factorID == nil ? [NSNull null] : [self getJSFactorId:(hint.factorID)],
16691669
@"displayName" : hint.displayName == nil ? [NSNull null] : hint.displayName,
1670-
@"enrollmentDate" : enrollmentDate,
1670+
@"enrollmentTime" : enrollmentDate,
1671+
@"phoneNumber" : hint.phoneNumber
16711672
}];
16721673
}
16731674
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)