123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- import { FirebaseApp } from '@firebase/app';
- import { PartialObserver } from '@firebase/util';
- import { Unsubscribe } from '@firebase/util';
- export declare interface AppCheck {
-
- app: FirebaseApp;
- }
- export declare interface AppCheckOptions {
-
- provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
-
- isTokenAutoRefreshEnabled?: boolean;
- }
- declare interface AppCheckProvider {
-
-
- }
- export declare interface AppCheckToken {
- readonly token: string;
-
- readonly expireTimeMillis: number;
- }
- declare interface AppCheckTokenInternal extends AppCheckToken {
- issuedAtTimeMillis: number;
- }
- export declare type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
- export declare interface AppCheckTokenResult {
-
- readonly token: string;
- }
- export declare class CustomProvider implements AppCheckProvider {
- private _customProviderOptions;
- private _app?;
- constructor(_customProviderOptions: CustomProviderOptions);
- /* Excluded from this release type: getToken */
- /* Excluded from this release type: initialize */
- /* Excluded from this release type: isEqual */
- }
- /**
- * Options when creating a {@link CustomProvider}.
- * @public
- */
- export declare interface CustomProviderOptions {
- /**
- * Function to get an App Check token through a custom provider
- * service.
- */
- getToken: () => Promise<AppCheckToken>;
- }
- /**
- * Requests a Firebase App Check token. This method should be used
- * only if you need to authorize requests to a non-Firebase backend.
- *
- * Returns limited-use tokens that are intended for use with your
- * non-Firebase backend endpoints that are protected with
- * <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
- * Replay Protection</a>. This method
- * does not affect the token generation behavior of the
- * #getAppCheckToken() method.
- *
- * @param appCheckInstance - The App Check service instance.
- * @returns The limited use token.
- * @public
- */
- export declare function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;
- export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
- export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
- export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;
- export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
- export { PartialObserver }
- export declare class ReCaptchaEnterpriseProvider implements AppCheckProvider {
- private _siteKey;
- private _app?;
- private _heartbeatServiceProvider?;
-
- private _throttleData;
-
- constructor(_siteKey: string);
- /* Excluded from this release type: getToken */
- /* Excluded from this release type: initialize */
- /* Excluded from this release type: isEqual */
- }
- /**
- * App Check provider that can obtain a reCAPTCHA V3 token and exchange it
- * for an App Check token.
- *
- * @public
- */
- export declare class ReCaptchaV3Provider implements AppCheckProvider {
- private _siteKey;
- private _app?;
- private _heartbeatServiceProvider?;
-
- private _throttleData;
-
- constructor(_siteKey: string);
- /* Excluded from this release type: getToken */
- /* Excluded from this release type: initialize */
- /* Excluded from this release type: isEqual */
- }
- /**
- * Set whether App Check will automatically refresh tokens as needed.
- *
- * @param appCheckInstance - The App Check service instance.
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
- * refreshes App Check tokens as needed. This overrides any value set
- * during `initializeAppCheck()`.
- * @public
- */
- export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isTokenAutoRefreshEnabled: boolean): void;
- export { Unsubscribe }
- export { }
|