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 Jan 14, 2024
1 parent 3e8330d commit 326e070
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion packages/auth/ios/RNFBAuth/RNFBAuthModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,8 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
@"uid" : hint.UID,
@"factorId" : hint.factorID == nil ? [NSNull null] : [self getJSFactorId:(hint.factorID)],
@"displayName" : hint.displayName == nil ? [NSNull null] : hint.displayName,
@"enrollmentDate" : enrollmentDate,
@"enrollmentTime" : enrollmentDate,
@"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 326e070

Please sign in to comment.