@firebase/app-check 0.5.7 → 0.5.8-canary.142f03ae6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @firebase/app-check
2
2
 
3
+ ## 0.5.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`9c5c9c36d`](https://github.com/firebase/firebase-js-sdk/commit/9c5c9c36da80b98b73cfd60ef2e2965087e9f801)]:
8
+ - @firebase/util@1.6.0
9
+ - @firebase/component@0.5.14
10
+
3
11
  ## 0.5.7
4
12
 
5
13
  ### Patch Changes
@@ -1,224 +1,224 @@
1
- /**
2
- * Firebase App Check
3
- *
4
- * @packageDocumentation
5
- */
6
-
7
- import { FirebaseApp } from '@firebase/app';
8
- import { PartialObserver } from '@firebase/util';
9
- import { Unsubscribe } from '@firebase/util';
10
-
11
- /**
12
- * The Firebase App Check service interface.
13
- *
14
- * @public
15
- */
16
- export declare interface AppCheck {
17
- /**
18
- * The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
19
- */
20
- app: FirebaseApp;
21
- }
22
-
23
- /* Excluded from this release type: _AppCheckComponentName */
24
-
25
- /* Excluded from this release type: _AppCheckInternalComponentName */
26
-
27
- /**
28
- * Options for App Check initialization.
29
- * @public
30
- */
31
- export declare interface AppCheckOptions {
32
- /**
33
- * A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
34
- */
35
- provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
36
- /**
37
- * If set to true, enables automatic background refresh of App Check token.
38
- */
39
- isTokenAutoRefreshEnabled?: boolean;
40
- }
41
-
42
- declare interface AppCheckProvider {
43
- /* Excluded from this release type: getToken */
44
- /* Excluded from this release type: initialize */
45
- }
46
-
47
- /**
48
- * The token returned from an App Check provider.
49
- * @public
50
- */
51
- export declare interface AppCheckToken {
52
- readonly token: string;
53
- /**
54
- * The local timestamp after which the token will expire.
55
- */
56
- readonly expireTimeMillis: number;
57
- }
58
-
59
- declare interface AppCheckTokenInternal extends AppCheckToken {
60
- issuedAtTimeMillis: number;
61
- }
62
-
63
- /**
64
- * A listener that is called whenever the App Check token changes.
65
- * @public
66
- */
67
- export declare type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
68
-
69
- /**
70
- * Result returned by `getToken()`.
71
- * @public
72
- */
73
- export declare interface AppCheckTokenResult {
74
- /**
75
- * The token string in JWT format.
76
- */
77
- readonly token: string;
78
- }
79
-
80
- /**
81
- * Custom provider class.
82
- * @public
83
- */
84
- export declare class CustomProvider implements AppCheckProvider {
85
- private _customProviderOptions;
86
- private _app?;
87
- constructor(_customProviderOptions: CustomProviderOptions);
88
- /* Excluded from this release type: getToken */
89
- /* Excluded from this release type: initialize */
90
- /* Excluded from this release type: isEqual */
91
- }
92
-
93
- /**
94
- * Options when creating a {@link CustomProvider}.
95
- * @public
96
- */
97
- export declare interface CustomProviderOptions {
98
- /**
99
- * Function to get an App Check token through a custom provider
100
- * service.
101
- */
102
- getToken: () => Promise<AppCheckToken>;
103
- }
104
-
105
- /**
106
- * Get the current App Check token. Attaches to the most recent
107
- * in-flight request if one is present. Returns null if no token
108
- * is present and no token requests are in-flight.
109
- *
110
- * @param appCheckInstance - The App Check service instance.
111
- * @param forceRefresh - If true, will always try to fetch a fresh token.
112
- * If false, will use a cached token if found in storage.
113
- * @public
114
- */
115
- export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
116
-
117
- /**
118
- * Activate App Check for the given app. Can be called only once per app.
119
- * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for
120
- * @param options - App Check initialization options
121
- * @public
122
- */
123
- export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
124
-
125
- /**
126
- * Registers a listener to changes in the token state. There can be more
127
- * than one listener registered at the same time for one or more
128
- * App Check instances. The listeners call back on the UI thread whenever
129
- * the current token associated with this App Check instance changes.
130
- *
131
- * @param appCheckInstance - The App Check service instance.
132
- * @param observer - An object with `next`, `error`, and `complete`
133
- * properties. `next` is called with an
134
- * {@link AppCheckTokenResult}
135
- * whenever the token changes. `error` is optional and is called if an
136
- * error is thrown by the listener (the `next` function). `complete`
137
- * is unused, as the token stream is unending.
138
- *
139
- * @returns A function that unsubscribes this listener.
140
- * @public
141
- */
142
- export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;
143
-
144
- /**
145
- * Registers a listener to changes in the token state. There can be more
146
- * than one listener registered at the same time for one or more
147
- * App Check instances. The listeners call back on the UI thread whenever
148
- * the current token associated with this App Check instance changes.
149
- *
150
- * @param appCheckInstance - The App Check service instance.
151
- * @param onNext - When the token changes, this function is called with aa
152
- * {@link AppCheckTokenResult}.
153
- * @param onError - Optional. Called if there is an error thrown by the
154
- * listener (the `onNext` function).
155
- * @param onCompletion - Currently unused, as the token stream is unending.
156
- * @returns A function that unsubscribes this listener.
157
- * @public
158
- */
159
- export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
160
- export { PartialObserver }
161
-
162
- /**
163
- * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it
164
- * for an App Check token.
165
- *
166
- * @public
167
- */
168
- export declare class ReCaptchaEnterpriseProvider implements AppCheckProvider {
169
- private _siteKey;
170
- private _app?;
171
- private _heartbeatServiceProvider?;
172
- /**
173
- * Throttle requests on certain error codes to prevent too many retries
174
- * in a short time.
175
- */
176
- private _throttleData;
177
- /**
178
- * Create a ReCaptchaEnterpriseProvider instance.
179
- * @param siteKey - reCAPTCHA Enterprise score-based site key.
180
- */
181
- constructor(_siteKey: string);
182
- /* Excluded from this release type: getToken */
183
- /* Excluded from this release type: initialize */
184
- /* Excluded from this release type: isEqual */
185
- }
186
-
187
- /**
188
- * App Check provider that can obtain a reCAPTCHA V3 token and exchange it
189
- * for an App Check token.
190
- *
191
- * @public
192
- */
193
- export declare class ReCaptchaV3Provider implements AppCheckProvider {
194
- private _siteKey;
195
- private _app?;
196
- private _heartbeatServiceProvider?;
197
- /**
198
- * Throttle requests on certain error codes to prevent too many retries
199
- * in a short time.
200
- */
201
- private _throttleData;
202
- /**
203
- * Create a ReCaptchaV3Provider instance.
204
- * @param siteKey - ReCAPTCHA V3 siteKey.
205
- */
206
- constructor(_siteKey: string);
207
- /* Excluded from this release type: getToken */
208
- /* Excluded from this release type: initialize */
209
- /* Excluded from this release type: isEqual */
210
- }
211
-
212
- /**
213
- * Set whether App Check will automatically refresh tokens as needed.
214
- *
215
- * @param appCheckInstance - The App Check service instance.
216
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
217
- * refreshes App Check tokens as needed. This overrides any value set
218
- * during `initializeAppCheck()`.
219
- * @public
220
- */
221
- export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isTokenAutoRefreshEnabled: boolean): void;
222
- export { Unsubscribe }
223
-
224
- export { }
1
+ /**
2
+ * Firebase App Check
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { FirebaseApp } from '@firebase/app';
8
+ import { PartialObserver } from '@firebase/util';
9
+ import { Unsubscribe } from '@firebase/util';
10
+
11
+ /**
12
+ * The Firebase App Check service interface.
13
+ *
14
+ * @public
15
+ */
16
+ export declare interface AppCheck {
17
+ /**
18
+ * The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
19
+ */
20
+ app: FirebaseApp;
21
+ }
22
+
23
+ /* Excluded from this release type: _AppCheckComponentName */
24
+
25
+ /* Excluded from this release type: _AppCheckInternalComponentName */
26
+
27
+ /**
28
+ * Options for App Check initialization.
29
+ * @public
30
+ */
31
+ export declare interface AppCheckOptions {
32
+ /**
33
+ * A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
34
+ */
35
+ provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
36
+ /**
37
+ * If set to true, enables automatic background refresh of App Check token.
38
+ */
39
+ isTokenAutoRefreshEnabled?: boolean;
40
+ }
41
+
42
+ declare interface AppCheckProvider {
43
+ /* Excluded from this release type: getToken */
44
+ /* Excluded from this release type: initialize */
45
+ }
46
+
47
+ /**
48
+ * The token returned from an App Check provider.
49
+ * @public
50
+ */
51
+ export declare interface AppCheckToken {
52
+ readonly token: string;
53
+ /**
54
+ * The local timestamp after which the token will expire.
55
+ */
56
+ readonly expireTimeMillis: number;
57
+ }
58
+
59
+ declare interface AppCheckTokenInternal extends AppCheckToken {
60
+ issuedAtTimeMillis: number;
61
+ }
62
+
63
+ /**
64
+ * A listener that is called whenever the App Check token changes.
65
+ * @public
66
+ */
67
+ export declare type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
68
+
69
+ /**
70
+ * Result returned by `getToken()`.
71
+ * @public
72
+ */
73
+ export declare interface AppCheckTokenResult {
74
+ /**
75
+ * The token string in JWT format.
76
+ */
77
+ readonly token: string;
78
+ }
79
+
80
+ /**
81
+ * Custom provider class.
82
+ * @public
83
+ */
84
+ export declare class CustomProvider implements AppCheckProvider {
85
+ private _customProviderOptions;
86
+ private _app?;
87
+ constructor(_customProviderOptions: CustomProviderOptions);
88
+ /* Excluded from this release type: getToken */
89
+ /* Excluded from this release type: initialize */
90
+ /* Excluded from this release type: isEqual */
91
+ }
92
+
93
+ /**
94
+ * Options when creating a {@link CustomProvider}.
95
+ * @public
96
+ */
97
+ export declare interface CustomProviderOptions {
98
+ /**
99
+ * Function to get an App Check token through a custom provider
100
+ * service.
101
+ */
102
+ getToken: () => Promise<AppCheckToken>;
103
+ }
104
+
105
+ /**
106
+ * Get the current App Check token. Attaches to the most recent
107
+ * in-flight request if one is present. Returns null if no token
108
+ * is present and no token requests are in-flight.
109
+ *
110
+ * @param appCheckInstance - The App Check service instance.
111
+ * @param forceRefresh - If true, will always try to fetch a fresh token.
112
+ * If false, will use a cached token if found in storage.
113
+ * @public
114
+ */
115
+ export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
116
+
117
+ /**
118
+ * Activate App Check for the given app. Can be called only once per app.
119
+ * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for
120
+ * @param options - App Check initialization options
121
+ * @public
122
+ */
123
+ export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
124
+
125
+ /**
126
+ * Registers a listener to changes in the token state. There can be more
127
+ * than one listener registered at the same time for one or more
128
+ * App Check instances. The listeners call back on the UI thread whenever
129
+ * the current token associated with this App Check instance changes.
130
+ *
131
+ * @param appCheckInstance - The App Check service instance.
132
+ * @param observer - An object with `next`, `error`, and `complete`
133
+ * properties. `next` is called with an
134
+ * {@link AppCheckTokenResult}
135
+ * whenever the token changes. `error` is optional and is called if an
136
+ * error is thrown by the listener (the `next` function). `complete`
137
+ * is unused, as the token stream is unending.
138
+ *
139
+ * @returns A function that unsubscribes this listener.
140
+ * @public
141
+ */
142
+ export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;
143
+
144
+ /**
145
+ * Registers a listener to changes in the token state. There can be more
146
+ * than one listener registered at the same time for one or more
147
+ * App Check instances. The listeners call back on the UI thread whenever
148
+ * the current token associated with this App Check instance changes.
149
+ *
150
+ * @param appCheckInstance - The App Check service instance.
151
+ * @param onNext - When the token changes, this function is called with aa
152
+ * {@link AppCheckTokenResult}.
153
+ * @param onError - Optional. Called if there is an error thrown by the
154
+ * listener (the `onNext` function).
155
+ * @param onCompletion - Currently unused, as the token stream is unending.
156
+ * @returns A function that unsubscribes this listener.
157
+ * @public
158
+ */
159
+ export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
160
+ export { PartialObserver }
161
+
162
+ /**
163
+ * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it
164
+ * for an App Check token.
165
+ *
166
+ * @public
167
+ */
168
+ export declare class ReCaptchaEnterpriseProvider implements AppCheckProvider {
169
+ private _siteKey;
170
+ private _app?;
171
+ private _heartbeatServiceProvider?;
172
+ /**
173
+ * Throttle requests on certain error codes to prevent too many retries
174
+ * in a short time.
175
+ */
176
+ private _throttleData;
177
+ /**
178
+ * Create a ReCaptchaEnterpriseProvider instance.
179
+ * @param siteKey - reCAPTCHA Enterprise score-based site key.
180
+ */
181
+ constructor(_siteKey: string);
182
+ /* Excluded from this release type: getToken */
183
+ /* Excluded from this release type: initialize */
184
+ /* Excluded from this release type: isEqual */
185
+ }
186
+
187
+ /**
188
+ * App Check provider that can obtain a reCAPTCHA V3 token and exchange it
189
+ * for an App Check token.
190
+ *
191
+ * @public
192
+ */
193
+ export declare class ReCaptchaV3Provider implements AppCheckProvider {
194
+ private _siteKey;
195
+ private _app?;
196
+ private _heartbeatServiceProvider?;
197
+ /**
198
+ * Throttle requests on certain error codes to prevent too many retries
199
+ * in a short time.
200
+ */
201
+ private _throttleData;
202
+ /**
203
+ * Create a ReCaptchaV3Provider instance.
204
+ * @param siteKey - ReCAPTCHA V3 siteKey.
205
+ */
206
+ constructor(_siteKey: string);
207
+ /* Excluded from this release type: getToken */
208
+ /* Excluded from this release type: initialize */
209
+ /* Excluded from this release type: isEqual */
210
+ }
211
+
212
+ /**
213
+ * Set whether App Check will automatically refresh tokens as needed.
214
+ *
215
+ * @param appCheckInstance - The App Check service instance.
216
+ * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
217
+ * refreshes App Check tokens as needed. This overrides any value set
218
+ * during `initializeAppCheck()`.
219
+ * @public
220
+ */
221
+ export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isTokenAutoRefreshEnabled: boolean): void;
222
+ export { Unsubscribe }
223
+
224
+ export { }
@@ -1,266 +1,266 @@
1
- /**
2
- * Firebase App Check
3
- *
4
- * @packageDocumentation
5
- */
6
-
7
- import { FirebaseApp } from '@firebase/app';
8
- import { PartialObserver } from '@firebase/util';
9
- import { Unsubscribe } from '@firebase/util';
10
-
11
- /**
12
- * The Firebase App Check service interface.
13
- *
14
- * @public
15
- */
16
- export declare interface AppCheck {
17
- /**
18
- * The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
19
- */
20
- app: FirebaseApp;
21
- }
22
-
23
- /**
24
- * @internal
25
- */
26
- export declare type _AppCheckComponentName = 'app-check';
27
-
28
- /**
29
- * @internal
30
- */
31
- export declare type _AppCheckInternalComponentName = 'app-check-internal';
32
-
33
- /**
34
- * Options for App Check initialization.
35
- * @public
36
- */
37
- export declare interface AppCheckOptions {
38
- /**
39
- * A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
40
- */
41
- provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
42
- /**
43
- * If set to true, enables automatic background refresh of App Check token.
44
- */
45
- isTokenAutoRefreshEnabled?: boolean;
46
- }
47
-
48
- declare interface AppCheckProvider {
49
- /**
50
- * Returns an App Check token.
51
- * @internal
52
- */
53
- getToken: () => Promise<AppCheckTokenInternal>;
54
- /**
55
- * @internal
56
- */
57
- initialize(app: FirebaseApp): void;
58
- }
59
-
60
- /**
61
- * The token returned from an App Check provider.
62
- * @public
63
- */
64
- export declare interface AppCheckToken {
65
- readonly token: string;
66
- /**
67
- * The local timestamp after which the token will expire.
68
- */
69
- readonly expireTimeMillis: number;
70
- }
71
-
72
- declare interface AppCheckTokenInternal extends AppCheckToken {
73
- issuedAtTimeMillis: number;
74
- }
75
-
76
- /**
77
- * A listener that is called whenever the App Check token changes.
78
- * @public
79
- */
80
- export declare type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
81
-
82
- /**
83
- * Result returned by `getToken()`.
84
- * @public
85
- */
86
- export declare interface AppCheckTokenResult {
87
- /**
88
- * The token string in JWT format.
89
- */
90
- readonly token: string;
91
- }
92
-
93
- /**
94
- * Custom provider class.
95
- * @public
96
- */
97
- export declare class CustomProvider implements AppCheckProvider {
98
- private _customProviderOptions;
99
- private _app?;
100
- constructor(_customProviderOptions: CustomProviderOptions);
101
- /**
102
- * @internal
103
- */
104
- getToken(): Promise<AppCheckTokenInternal>;
105
- /**
106
- * @internal
107
- */
108
- initialize(app: FirebaseApp): void;
109
- /**
110
- * @internal
111
- */
112
- isEqual(otherProvider: unknown): boolean;
113
- }
114
-
115
- /**
116
- * Options when creating a {@link CustomProvider}.
117
- * @public
118
- */
119
- export declare interface CustomProviderOptions {
120
- /**
121
- * Function to get an App Check token through a custom provider
122
- * service.
123
- */
124
- getToken: () => Promise<AppCheckToken>;
125
- }
126
-
127
- /**
128
- * Get the current App Check token. Attaches to the most recent
129
- * in-flight request if one is present. Returns null if no token
130
- * is present and no token requests are in-flight.
131
- *
132
- * @param appCheckInstance - The App Check service instance.
133
- * @param forceRefresh - If true, will always try to fetch a fresh token.
134
- * If false, will use a cached token if found in storage.
135
- * @public
136
- */
137
- export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
138
-
139
- /**
140
- * Activate App Check for the given app. Can be called only once per app.
141
- * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for
142
- * @param options - App Check initialization options
143
- * @public
144
- */
145
- export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
146
-
147
- /**
148
- * Registers a listener to changes in the token state. There can be more
149
- * than one listener registered at the same time for one or more
150
- * App Check instances. The listeners call back on the UI thread whenever
151
- * the current token associated with this App Check instance changes.
152
- *
153
- * @param appCheckInstance - The App Check service instance.
154
- * @param observer - An object with `next`, `error`, and `complete`
155
- * properties. `next` is called with an
156
- * {@link AppCheckTokenResult}
157
- * whenever the token changes. `error` is optional and is called if an
158
- * error is thrown by the listener (the `next` function). `complete`
159
- * is unused, as the token stream is unending.
160
- *
161
- * @returns A function that unsubscribes this listener.
162
- * @public
163
- */
164
- export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;
165
-
166
- /**
167
- * Registers a listener to changes in the token state. There can be more
168
- * than one listener registered at the same time for one or more
169
- * App Check instances. The listeners call back on the UI thread whenever
170
- * the current token associated with this App Check instance changes.
171
- *
172
- * @param appCheckInstance - The App Check service instance.
173
- * @param onNext - When the token changes, this function is called with aa
174
- * {@link AppCheckTokenResult}.
175
- * @param onError - Optional. Called if there is an error thrown by the
176
- * listener (the `onNext` function).
177
- * @param onCompletion - Currently unused, as the token stream is unending.
178
- * @returns A function that unsubscribes this listener.
179
- * @public
180
- */
181
- export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
182
- export { PartialObserver }
183
-
184
- /**
185
- * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it
186
- * for an App Check token.
187
- *
188
- * @public
189
- */
190
- export declare class ReCaptchaEnterpriseProvider implements AppCheckProvider {
191
- private _siteKey;
192
- private _app?;
193
- private _heartbeatServiceProvider?;
194
- /**
195
- * Throttle requests on certain error codes to prevent too many retries
196
- * in a short time.
197
- */
198
- private _throttleData;
199
- /**
200
- * Create a ReCaptchaEnterpriseProvider instance.
201
- * @param siteKey - reCAPTCHA Enterprise score-based site key.
202
- */
203
- constructor(_siteKey: string);
204
- /**
205
- * Returns an App Check token.
206
- * @internal
207
- */
208
- getToken(): Promise<AppCheckTokenInternal>;
209
- /**
210
- * @internal
211
- */
212
- initialize(app: FirebaseApp): void;
213
- /**
214
- * @internal
215
- */
216
- isEqual(otherProvider: unknown): boolean;
217
- }
218
-
219
- /**
220
- * App Check provider that can obtain a reCAPTCHA V3 token and exchange it
221
- * for an App Check token.
222
- *
223
- * @public
224
- */
225
- export declare class ReCaptchaV3Provider implements AppCheckProvider {
226
- private _siteKey;
227
- private _app?;
228
- private _heartbeatServiceProvider?;
229
- /**
230
- * Throttle requests on certain error codes to prevent too many retries
231
- * in a short time.
232
- */
233
- private _throttleData;
234
- /**
235
- * Create a ReCaptchaV3Provider instance.
236
- * @param siteKey - ReCAPTCHA V3 siteKey.
237
- */
238
- constructor(_siteKey: string);
239
- /**
240
- * Returns an App Check token.
241
- * @internal
242
- */
243
- getToken(): Promise<AppCheckTokenInternal>;
244
- /**
245
- * @internal
246
- */
247
- initialize(app: FirebaseApp): void;
248
- /**
249
- * @internal
250
- */
251
- isEqual(otherProvider: unknown): boolean;
252
- }
253
-
254
- /**
255
- * Set whether App Check will automatically refresh tokens as needed.
256
- *
257
- * @param appCheckInstance - The App Check service instance.
258
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
259
- * refreshes App Check tokens as needed. This overrides any value set
260
- * during `initializeAppCheck()`.
261
- * @public
262
- */
263
- export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isTokenAutoRefreshEnabled: boolean): void;
264
- export { Unsubscribe }
265
-
266
- export { }
1
+ /**
2
+ * Firebase App Check
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { FirebaseApp } from '@firebase/app';
8
+ import { PartialObserver } from '@firebase/util';
9
+ import { Unsubscribe } from '@firebase/util';
10
+
11
+ /**
12
+ * The Firebase App Check service interface.
13
+ *
14
+ * @public
15
+ */
16
+ export declare interface AppCheck {
17
+ /**
18
+ * The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
19
+ */
20
+ app: FirebaseApp;
21
+ }
22
+
23
+ /**
24
+ * @internal
25
+ */
26
+ export declare type _AppCheckComponentName = 'app-check';
27
+
28
+ /**
29
+ * @internal
30
+ */
31
+ export declare type _AppCheckInternalComponentName = 'app-check-internal';
32
+
33
+ /**
34
+ * Options for App Check initialization.
35
+ * @public
36
+ */
37
+ export declare interface AppCheckOptions {
38
+ /**
39
+ * A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
40
+ */
41
+ provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
42
+ /**
43
+ * If set to true, enables automatic background refresh of App Check token.
44
+ */
45
+ isTokenAutoRefreshEnabled?: boolean;
46
+ }
47
+
48
+ declare interface AppCheckProvider {
49
+ /**
50
+ * Returns an App Check token.
51
+ * @internal
52
+ */
53
+ getToken: () => Promise<AppCheckTokenInternal>;
54
+ /**
55
+ * @internal
56
+ */
57
+ initialize(app: FirebaseApp): void;
58
+ }
59
+
60
+ /**
61
+ * The token returned from an App Check provider.
62
+ * @public
63
+ */
64
+ export declare interface AppCheckToken {
65
+ readonly token: string;
66
+ /**
67
+ * The local timestamp after which the token will expire.
68
+ */
69
+ readonly expireTimeMillis: number;
70
+ }
71
+
72
+ declare interface AppCheckTokenInternal extends AppCheckToken {
73
+ issuedAtTimeMillis: number;
74
+ }
75
+
76
+ /**
77
+ * A listener that is called whenever the App Check token changes.
78
+ * @public
79
+ */
80
+ export declare type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
81
+
82
+ /**
83
+ * Result returned by `getToken()`.
84
+ * @public
85
+ */
86
+ export declare interface AppCheckTokenResult {
87
+ /**
88
+ * The token string in JWT format.
89
+ */
90
+ readonly token: string;
91
+ }
92
+
93
+ /**
94
+ * Custom provider class.
95
+ * @public
96
+ */
97
+ export declare class CustomProvider implements AppCheckProvider {
98
+ private _customProviderOptions;
99
+ private _app?;
100
+ constructor(_customProviderOptions: CustomProviderOptions);
101
+ /**
102
+ * @internal
103
+ */
104
+ getToken(): Promise<AppCheckTokenInternal>;
105
+ /**
106
+ * @internal
107
+ */
108
+ initialize(app: FirebaseApp): void;
109
+ /**
110
+ * @internal
111
+ */
112
+ isEqual(otherProvider: unknown): boolean;
113
+ }
114
+
115
+ /**
116
+ * Options when creating a {@link CustomProvider}.
117
+ * @public
118
+ */
119
+ export declare interface CustomProviderOptions {
120
+ /**
121
+ * Function to get an App Check token through a custom provider
122
+ * service.
123
+ */
124
+ getToken: () => Promise<AppCheckToken>;
125
+ }
126
+
127
+ /**
128
+ * Get the current App Check token. Attaches to the most recent
129
+ * in-flight request if one is present. Returns null if no token
130
+ * is present and no token requests are in-flight.
131
+ *
132
+ * @param appCheckInstance - The App Check service instance.
133
+ * @param forceRefresh - If true, will always try to fetch a fresh token.
134
+ * If false, will use a cached token if found in storage.
135
+ * @public
136
+ */
137
+ export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
138
+
139
+ /**
140
+ * Activate App Check for the given app. Can be called only once per app.
141
+ * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for
142
+ * @param options - App Check initialization options
143
+ * @public
144
+ */
145
+ export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
146
+
147
+ /**
148
+ * Registers a listener to changes in the token state. There can be more
149
+ * than one listener registered at the same time for one or more
150
+ * App Check instances. The listeners call back on the UI thread whenever
151
+ * the current token associated with this App Check instance changes.
152
+ *
153
+ * @param appCheckInstance - The App Check service instance.
154
+ * @param observer - An object with `next`, `error`, and `complete`
155
+ * properties. `next` is called with an
156
+ * {@link AppCheckTokenResult}
157
+ * whenever the token changes. `error` is optional and is called if an
158
+ * error is thrown by the listener (the `next` function). `complete`
159
+ * is unused, as the token stream is unending.
160
+ *
161
+ * @returns A function that unsubscribes this listener.
162
+ * @public
163
+ */
164
+ export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;
165
+
166
+ /**
167
+ * Registers a listener to changes in the token state. There can be more
168
+ * than one listener registered at the same time for one or more
169
+ * App Check instances. The listeners call back on the UI thread whenever
170
+ * the current token associated with this App Check instance changes.
171
+ *
172
+ * @param appCheckInstance - The App Check service instance.
173
+ * @param onNext - When the token changes, this function is called with aa
174
+ * {@link AppCheckTokenResult}.
175
+ * @param onError - Optional. Called if there is an error thrown by the
176
+ * listener (the `onNext` function).
177
+ * @param onCompletion - Currently unused, as the token stream is unending.
178
+ * @returns A function that unsubscribes this listener.
179
+ * @public
180
+ */
181
+ export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
182
+ export { PartialObserver }
183
+
184
+ /**
185
+ * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it
186
+ * for an App Check token.
187
+ *
188
+ * @public
189
+ */
190
+ export declare class ReCaptchaEnterpriseProvider implements AppCheckProvider {
191
+ private _siteKey;
192
+ private _app?;
193
+ private _heartbeatServiceProvider?;
194
+ /**
195
+ * Throttle requests on certain error codes to prevent too many retries
196
+ * in a short time.
197
+ */
198
+ private _throttleData;
199
+ /**
200
+ * Create a ReCaptchaEnterpriseProvider instance.
201
+ * @param siteKey - reCAPTCHA Enterprise score-based site key.
202
+ */
203
+ constructor(_siteKey: string);
204
+ /**
205
+ * Returns an App Check token.
206
+ * @internal
207
+ */
208
+ getToken(): Promise<AppCheckTokenInternal>;
209
+ /**
210
+ * @internal
211
+ */
212
+ initialize(app: FirebaseApp): void;
213
+ /**
214
+ * @internal
215
+ */
216
+ isEqual(otherProvider: unknown): boolean;
217
+ }
218
+
219
+ /**
220
+ * App Check provider that can obtain a reCAPTCHA V3 token and exchange it
221
+ * for an App Check token.
222
+ *
223
+ * @public
224
+ */
225
+ export declare class ReCaptchaV3Provider implements AppCheckProvider {
226
+ private _siteKey;
227
+ private _app?;
228
+ private _heartbeatServiceProvider?;
229
+ /**
230
+ * Throttle requests on certain error codes to prevent too many retries
231
+ * in a short time.
232
+ */
233
+ private _throttleData;
234
+ /**
235
+ * Create a ReCaptchaV3Provider instance.
236
+ * @param siteKey - ReCAPTCHA V3 siteKey.
237
+ */
238
+ constructor(_siteKey: string);
239
+ /**
240
+ * Returns an App Check token.
241
+ * @internal
242
+ */
243
+ getToken(): Promise<AppCheckTokenInternal>;
244
+ /**
245
+ * @internal
246
+ */
247
+ initialize(app: FirebaseApp): void;
248
+ /**
249
+ * @internal
250
+ */
251
+ isEqual(otherProvider: unknown): boolean;
252
+ }
253
+
254
+ /**
255
+ * Set whether App Check will automatically refresh tokens as needed.
256
+ *
257
+ * @param appCheckInstance - The App Check service instance.
258
+ * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
259
+ * refreshes App Check tokens as needed. This overrides any value set
260
+ * during `initializeAppCheck()`.
261
+ * @public
262
+ */
263
+ export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isTokenAutoRefreshEnabled: boolean): void;
264
+ export { Unsubscribe }
265
+
266
+ export { }
@@ -1070,7 +1070,7 @@ function internalFactory(appCheck) {
1070
1070
  }
1071
1071
 
1072
1072
  var name = "@firebase/app-check";
1073
- var version = "0.5.7";
1073
+ var version = "0.5.8-canary.142f03ae6";
1074
1074
 
1075
1075
  /**
1076
1076
  * @license
@@ -962,7 +962,7 @@ function internalFactory(appCheck) {
962
962
  }
963
963
 
964
964
  const name = "@firebase/app-check";
965
- const version = "0.5.7";
965
+ const version = "0.5.8-canary.142f03ae6";
966
966
 
967
967
  /**
968
968
  * @license
package/dist/index.cjs.js CHANGED
@@ -1074,7 +1074,7 @@ function internalFactory(appCheck) {
1074
1074
  }
1075
1075
 
1076
1076
  var name = "@firebase/app-check";
1077
- var version = "0.5.7";
1077
+ var version = "0.5.8-canary.142f03ae6";
1078
1078
 
1079
1079
  /**
1080
1080
  * @license
@@ -1,11 +1,11 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "0.1.2"
9
- }
10
- ]
11
- }
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "0.1.2"
9
+ }
10
+ ]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/app-check",
3
- "version": "0.5.7",
3
+ "version": "0.5.8-canary.142f03ae6",
4
4
  "description": "The App Check component of the Firebase JS SDK",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.cjs.js",
@@ -34,22 +34,22 @@
34
34
  "typings:public": "node ../../scripts/build/use_typings.js ./dist/app-check-public.d.ts"
35
35
  },
36
36
  "peerDependencies": {
37
- "@firebase/app": "0.x"
37
+ "@firebase/app": "0.7.23-canary.142f03ae6"
38
38
  },
39
39
  "dependencies": {
40
- "@firebase/util": "1.5.2",
41
- "@firebase/component": "0.5.13",
42
- "@firebase/logger": "0.3.2",
40
+ "@firebase/util": "1.6.0-canary.142f03ae6",
41
+ "@firebase/component": "0.5.14-canary.142f03ae6",
42
+ "@firebase/logger": "0.3.2-canary.142f03ae6",
43
43
  "tslib": "^2.1.0"
44
44
  },
45
45
  "license": "Apache-2.0",
46
46
  "devDependencies": {
47
- "@firebase/app": "0.7.22",
47
+ "@firebase/app": "0.7.23-canary.142f03ae6",
48
48
  "rollup": "2.57.0",
49
49
  "@rollup/plugin-commonjs": "21.0.0",
50
50
  "@rollup/plugin-json": "4.1.0",
51
51
  "@rollup/plugin-node-resolve": "13.0.5",
52
- "rollup-plugin-typescript2": "0.30.0",
52
+ "rollup-plugin-typescript2": "0.31.2",
53
53
  "typescript": "4.2.2"
54
54
  },
55
55
  "repository": {