app-check.d.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*! firebase-admin v12.1.1 */
  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. */
  18. import { App } from '../app';
  19. import { AppCheckToken, AppCheckTokenOptions, VerifyAppCheckTokenOptions, VerifyAppCheckTokenResponse } from './app-check-api';
  20. /**
  21. * The Firebase `AppCheck` service interface.
  22. */
  23. export 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. * @param options - Optional {@link VerifyAppCheckTokenOptions} object when verifying an App Check Token.
  45. *
  46. * @returns A promise fulfilled with the token's decoded claims
  47. * if the App Check token is valid; otherwise, a rejected promise.
  48. */
  49. verifyToken(appCheckToken: string, options?: VerifyAppCheckTokenOptions): Promise<VerifyAppCheckTokenResponse>;
  50. private validateVerifyAppCheckTokenOptions;
  51. }