Skip to content

Commit

Permalink
fix: improve types and apply to ios
Browse files Browse the repository at this point in the history
  • Loading branch information
mnahkies committed Apr 20, 2024
1 parent bcea81e commit 993c696
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/auth/ios/RNFBAuth/RNFBAuthModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
@"enrollmentTime" : enrollmentTime,
// @deprecated enrollmentDate kept for backwards compatibility, please use enrollmentTime
@"enrollmentDate" : enrollmentTime,
@"phoneNumber" : hint.phoneNumber,
}];
}
return enrolledFactors;
Expand Down
25 changes: 15 additions & 10 deletions packages/auth/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,21 @@ export namespace FirebaseAuthTypes {
/**
* Contains information about a second factor.
*/
export interface MultiFactorInfo {
export type MultiFactorInfo = PhoneMultiFactorInfo | TotpMultiFactorInfo;

export interface PhoneMultiFactorInfo extends MultiFactorInfoCommon {
factorId: 'phone';
/**
* The phone number used for this factor.
*/
phoneNumber: string;
}

export interface TotpMultiFactorInfo extends MultiFactorInfoCommon {
factorId: 'totp';
}

export interface MultiFactorInfoCommon {
/**
* User friendly name for this factor.
*/
Expand All @@ -481,21 +495,12 @@ export namespace FirebaseAuthTypes {
* Time the second factor was enrolled, in UTC.
*/
enrollmentTime: string;
/**
* Type of factor.
*/
factorId: FactorId;
/**
* Unique id for this factor.
*/
uid: string;
}

export interface PhoneMultiFactorInfo extends MultiFactorInfo {
factorId: "phone";
phoneNumber: string;
}

export interface MultiFactorAssertion {
token: string;
secret: string;
Expand Down

0 comments on commit 993c696

Please sign in to comment.