1515 * limitations under the License.
1616 */
1717
18- import { appCheck } from './index' ;
18+ import { App } from '../app' ;
19+ import { FirebaseApp } from '../app/firebase-app' ;
1920import {
2021 HttpRequestConfig , HttpClient , HttpError , AuthorizedHttpClient , HttpResponse
2122} from '../utils/api-request' ;
22- import { FirebaseApp } from '../app/firebase-app' ;
2323import { PrefixedFirebaseError } from '../utils/error' ;
24-
2524import * as utils from '../utils/index' ;
2625import * as validator from '../utils/validator' ;
27-
28- import AppCheckToken = appCheck . AppCheckToken ;
26+ import { AppCheckToken } from './app-check-api'
2927
3028// App Check backend constants
3129const FIREBASE_APP_CHECK_V1_API_URL_FORMAT = 'https://firebaseappcheck.googleapis.com/v1beta/projects/{projectId}/apps/{appId}:exchangeCustomToken' ;
@@ -43,21 +41,21 @@ export class AppCheckApiClient {
4341 private readonly httpClient : HttpClient ;
4442 private projectId ?: string ;
4543
46- constructor ( private readonly app : FirebaseApp ) {
44+ constructor ( private readonly app : App ) {
4745 if ( ! validator . isNonNullObject ( app ) || ! ( 'options' in app ) ) {
4846 throw new FirebaseAppCheckError (
4947 'invalid-argument' ,
5048 'First argument passed to admin.appCheck() must be a valid Firebase app instance.' ) ;
5149 }
52- this . httpClient = new AuthorizedHttpClient ( app ) ;
50+ this . httpClient = new AuthorizedHttpClient ( app as FirebaseApp ) ;
5351 }
5452
5553 /**
5654 * Exchange a signed custom token to App Check token
5755 *
5856 * @param customToken The custom token to be exchanged.
5957 * @param appId The mobile App ID.
60- * @return A promise that fulfills with a `AppCheckToken`.
58+ * @returns A promise that fulfills with a `AppCheckToken`.
6159 */
6260 public exchangeToken ( customToken : string , appId : string ) : Promise < AppCheckToken > {
6361 if ( ! validator . isNonEmptyString ( appId ) ) {
@@ -143,7 +141,7 @@ export class AppCheckApiClient {
143141 * Creates an AppCheckToken from the API response.
144142 *
145143 * @param resp API response object.
146- * @return An AppCheckToken instance.
144+ * @returns An AppCheckToken instance.
147145 */
148146 private toAppCheckToken ( resp : HttpResponse ) : AppCheckToken {
149147 const token = resp . data . attestationToken ;
@@ -164,7 +162,7 @@ export class AppCheckApiClient {
164162 * is expressed as "3s", while 3 seconds and 1 nanosecond is expressed as "3.000000001s",
165163 * and 3 seconds and 1 microsecond is expressed as "3.000001s".
166164 *
167- * @return The duration in milliseconds.
165+ * @returns The duration in milliseconds.
168166 */
169167 private stringToMilliseconds ( duration : string ) : number {
170168 if ( ! validator . isNonEmptyString ( duration ) || ! duration . endsWith ( 's' ) ) {
@@ -211,8 +209,8 @@ export type AppCheckErrorCode =
211209/**
212210 * Firebase App Check error code structure. This extends PrefixedFirebaseError.
213211 *
214- * @param { AppCheckErrorCode } code The error code.
215- * @param { string } message The error message.
212+ * @param code The error code.
213+ * @param message The error message.
216214 * @constructor
217215 */
218216export class FirebaseAppCheckError extends PrefixedFirebaseError {
0 commit comments