Skip to content

Commit e04b745

Browse files
authored
[Auth] Add missing PhoneMultiFactorInfo public interface (#5924)
* Add missing PhoneMultiFactorInfo public interface * Fix missing closing paren * Changeset
1 parent 4983f4d commit e04b745

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

.changeset/tame-timers-visit.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/auth": patch
3+
---
4+
5+
Add missing PhoneMultiFactorInfo public interface

common/api-review/auth.api.md

+5
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ export class PhoneMultiFactorGenerator {
601601
static FACTOR_ID: string;
602602
}
603603

604+
// @public
605+
export interface PhoneMultiFactorInfo extends MultiFactorInfo {
606+
readonly phoneNumber: string;
607+
}
608+
604609
// @public
605610
export interface PhoneMultiFactorSignInInfoOptions {
606611
multiFactorHint?: MultiFactorInfo;

packages/auth/src/mfa/mfa_info.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { FactorId, MultiFactorInfo } from '../model/public_types';
18+
import { FactorId, MultiFactorInfo, PhoneMultiFactorInfo } from '../model/public_types';
1919
import {
2020
PhoneMfaEnrollment,
2121
MfaEnrollment
@@ -40,13 +40,13 @@ export abstract class MultiFactorInfoImpl implements MultiFactorInfo {
4040
enrollment: MfaEnrollment
4141
): MultiFactorInfoImpl {
4242
if ('phoneInfo' in enrollment) {
43-
return PhoneMultiFactorInfo._fromServerResponse(auth, enrollment);
43+
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
4444
}
4545
return _fail(auth, AuthErrorCode.INTERNAL_ERROR);
4646
}
4747
}
4848

49-
export class PhoneMultiFactorInfo extends MultiFactorInfoImpl {
49+
export class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl implements PhoneMultiFactorInfo {
5050
readonly phoneNumber: string;
5151

5252
private constructor(response: PhoneMfaEnrollment) {
@@ -57,7 +57,7 @@ export class PhoneMultiFactorInfo extends MultiFactorInfoImpl {
5757
static _fromServerResponse(
5858
_auth: AuthInternal,
5959
enrollment: MfaEnrollment
60-
): PhoneMultiFactorInfo {
61-
return new PhoneMultiFactorInfo(enrollment);
60+
): PhoneMultiFactorInfoImpl {
61+
return new PhoneMultiFactorInfoImpl(enrollment);
6262
}
6363
}

packages/auth/src/model/public_types.ts

+9
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,15 @@ export interface MultiFactorInfo {
628628
readonly factorId: typeof FactorIdMap[keyof typeof FactorIdMap];
629629
}
630630

631+
/**
632+
* The subclass of the {@link MultiFactorInfo} interface for phone number
633+
* second factors. The factorId of this second factor is {@link FactorId.PHONE}.
634+
*/
635+
export interface PhoneMultiFactorInfo extends MultiFactorInfo {
636+
/** The phone number associated with the current second factor. */
637+
readonly phoneNumber: string;
638+
}
639+
631640
/**
632641
* The class used to facilitate recovery from {@link MultiFactorError} when a user needs to
633642
* provide a second factor to sign in.

0 commit comments

Comments
 (0)