@firebase/app-check-types
Advanced tools
Comparing version 0.1.0-canary.96a47097f to 0.1.0-canary.ca857526b
@@ -18,3 +18,9 @@ /** | ||
import { PartialObserver, Unsubscribe } from '@firebase/util'; | ||
import { FirebaseApp } from '@firebase/app-types'; | ||
export interface FirebaseAppCheck { | ||
/** The `FirebaseApp` associated with this instance. */ | ||
app: FirebaseApp; | ||
/** | ||
@@ -40,2 +46,36 @@ * Activate AppCheck | ||
setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void; | ||
/** | ||
* Get the current App Check token. Attaches to the most recent | ||
* in-flight request if one is present. Returns null if no token | ||
* is present and no token requests are in flight. | ||
* | ||
* @param forceRefresh - If true, will always try to fetch a fresh token. | ||
* If false, will use a cached token if found in storage. | ||
*/ | ||
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>; | ||
/** | ||
* Registers a listener to changes in the token state. There can be more | ||
* than one listener registered at the same time for one or more | ||
* App Check instances. The listeners call back on the UI thread whenever | ||
* the current token associated with this App Check instance changes. | ||
* | ||
* @returns A function that unsubscribes this listener. | ||
*/ | ||
onTokenChanged(observer: PartialObserver<AppCheckTokenResult>): Unsubscribe; | ||
/** | ||
* Registers a listener to changes in the token state. There can be more | ||
* than one listener registered at the same time for one or more | ||
* App Check instances. The listeners call back on the UI thread whenever | ||
* the current token associated with this App Check instance changes. | ||
* | ||
* @returns A function that unsubscribes this listener. | ||
*/ | ||
onTokenChanged( | ||
onNext: (tokenResult: AppCheckTokenResult) => void, | ||
onError?: (error: Error) => void, | ||
onCompletion?: () => void | ||
): Unsubscribe; | ||
} | ||
@@ -69,2 +109,12 @@ | ||
/** | ||
* Result returned by `getToken()`. | ||
*/ | ||
interface AppCheckTokenResult { | ||
/** | ||
* The token string in JWT format. | ||
*/ | ||
readonly token: string; | ||
} | ||
export type AppCheckComponentName = 'appCheck'; | ||
@@ -71,0 +121,0 @@ declare module '@firebase/component' { |
{ | ||
"name": "@firebase/app-check-types", | ||
"version": "0.1.0-canary.96a47097f", | ||
"version": "0.1.0-canary.ca857526b", | ||
"description": "@firebase/app-check Types", | ||
@@ -5,0 +5,0 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5009
111