Skip to content

Commit 30fb0e3

Browse files
authored
Merge 6692ec6 into 2d04af9
2 parents 2d04af9 + 6692ec6 commit 30fb0e3

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

common/api-review/auth.api.md

Lines changed: 5 additions & 0 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 9 additions & 0 deletions
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)