UNPKG

2.2 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2020 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa';
18import { SignInWithPhoneNumberRequest } from '../../api/authentication/sms';
19import { AuthInternal } from '../../model/auth';
20import { IdTokenResponse } from '../../model/id_token';
21import { AuthCredential } from './auth_credential';
22export interface PhoneAuthCredentialParameters {
23 verificationId?: string;
24 verificationCode?: string;
25 phoneNumber?: string;
26 temporaryProof?: string;
27}
28/**
29 * Represents the credentials returned by {@link PhoneAuthProvider}.
30 *
31 * @public
32 */
33export declare class PhoneAuthCredential extends AuthCredential {
34 private readonly params;
35 private constructor();
36 /** @internal */
37 static _fromVerification(verificationId: string, verificationCode: string): PhoneAuthCredential;
38 /** @internal */
39 static _fromTokenResponse(phoneNumber: string, temporaryProof: string): PhoneAuthCredential;
40 /** @internal */
41 _getIdTokenResponse(auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>;
42 /** @internal */
43 _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>;
44 /** @internal */
45 _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>;
46 /** @internal */
47 _makeVerificationRequest(): SignInWithPhoneNumberRequest;
48 /** {@inheritdoc AuthCredential.toJSON} */
49 toJSON(): object;
50 /** Generates a phone credential based on a plain object or a JSON string. */
51 static fromJSON(json: object | string): PhoneAuthCredential | null;
52}