UNPKG

1.89 kBTypeScriptView Raw
1/*! firebase-admin v10.0.0 */
2/*!
3 * @license
4 * Copyright 2021 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18import { App } from '../app';
19import { AppCheckToken, AppCheckTokenOptions, VerifyAppCheckTokenResponse } from './app-check-api';
20/**
21 * The Firebase `AppCheck` service interface.
22 */
23export declare class AppCheck {
24 readonly app: App;
25 private readonly client;
26 private readonly tokenGenerator;
27 private readonly appCheckTokenVerifier;
28 /**
29 * Creates a new {@link AppCheckToken} that can be sent
30 * back to a client.
31 *
32 * @param appId - The app ID to use as the JWT app_id.
33 * @param options - Optional options object when creating a new App Check Token.
34 *
35 * @returns A promise that fulfills with a `AppCheckToken`.
36 */
37 createToken(appId: string, options?: AppCheckTokenOptions): Promise<AppCheckToken>;
38 /**
39 * Verifies a Firebase App Check token (JWT). If the token is valid, the promise is
40 * fulfilled with the token's decoded claims; otherwise, the promise is
41 * rejected.
42 *
43 * @param appCheckToken - The App Check token to verify.
44 *
45 * @returns A promise fulfilled with the token's decoded claims
46 * if the App Check token is valid; otherwise, a rejected promise.
47 */
48 verifyToken(appCheckToken: string): Promise<VerifyAppCheckTokenResponse>;
49}