@firebase/app-check 0.8.9 → 0.8.10
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/dist/esm/index.esm2017.js +1632 -1632
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/api.d.ts +105 -105
- package/dist/esm/src/api.test.d.ts +17 -17
- package/dist/esm/src/client.d.ts +30 -30
- package/dist/esm/src/client.test.d.ts +17 -17
- package/dist/esm/src/constants.d.ts +40 -40
- package/dist/esm/src/debug.d.ts +22 -22
- package/dist/esm/src/debug.test.d.ts +17 -17
- package/dist/esm/src/errors.d.ts +61 -61
- package/dist/esm/src/factory.d.ts +31 -31
- package/dist/esm/src/index.d.ts +14 -14
- package/dist/esm/src/indexeddb.d.ts +22 -22
- package/dist/esm/src/internal-api.d.ts +44 -44
- package/dist/esm/src/internal-api.test.d.ts +17 -17
- package/dist/esm/src/logger.d.ts +18 -18
- package/dist/esm/src/proactive-refresh.d.ts +35 -35
- package/dist/esm/src/proactive-refresh.test.d.ts +17 -17
- package/dist/esm/src/providers.d.ts +108 -108
- package/dist/esm/src/providers.test.d.ts +17 -17
- package/dist/esm/src/public-types.d.ts +85 -85
- package/dist/esm/src/recaptcha.d.ts +43 -43
- package/dist/esm/src/recaptcha.test.d.ts +17 -17
- package/dist/esm/src/state.d.ts +54 -54
- package/dist/esm/src/storage.d.ts +27 -27
- package/dist/esm/src/storage.test.d.ts +17 -17
- package/dist/esm/src/types.d.ts +66 -66
- package/dist/esm/src/util.d.ts +21 -21
- package/dist/esm/test/setup.d.ts +17 -17
- package/dist/esm/test/util.d.ts +34 -34
- package/dist/index.cjs.js +1632 -1632
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/api.d.ts +105 -105
- package/dist/src/api.test.d.ts +17 -17
- package/dist/src/client.d.ts +30 -30
- package/dist/src/client.test.d.ts +17 -17
- package/dist/src/constants.d.ts +40 -40
- package/dist/src/debug.d.ts +22 -22
- package/dist/src/debug.test.d.ts +17 -17
- package/dist/src/errors.d.ts +61 -61
- package/dist/src/factory.d.ts +31 -31
- package/dist/src/index.d.ts +14 -14
- package/dist/src/indexeddb.d.ts +22 -22
- package/dist/src/internal-api.d.ts +44 -44
- package/dist/src/internal-api.test.d.ts +17 -17
- package/dist/src/logger.d.ts +18 -18
- package/dist/src/proactive-refresh.d.ts +35 -35
- package/dist/src/proactive-refresh.test.d.ts +17 -17
- package/dist/src/providers.d.ts +108 -108
- package/dist/src/providers.test.d.ts +17 -17
- package/dist/src/public-types.d.ts +85 -85
- package/dist/src/recaptcha.d.ts +43 -43
- package/dist/src/recaptcha.test.d.ts +17 -17
- package/dist/src/state.d.ts +54 -54
- package/dist/src/storage.d.ts +27 -27
- package/dist/src/storage.test.d.ts +17 -17
- package/dist/src/types.d.ts +66 -66
- package/dist/src/util.d.ts +21 -21
- package/dist/test/setup.d.ts +17 -17
- package/dist/test/util.d.ts +34 -34
- package/package.json +6 -6
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
import { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider } from './providers';
|
|
19
|
-
export { Unsubscribe, PartialObserver } from '@firebase/util';
|
|
20
|
-
/**
|
|
21
|
-
* The Firebase App Check service interface.
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export interface AppCheck {
|
|
26
|
-
/**
|
|
27
|
-
* The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
|
|
28
|
-
*/
|
|
29
|
-
app: FirebaseApp;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The token returned from an App Check provider.
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export interface AppCheckToken {
|
|
36
|
-
readonly token: string;
|
|
37
|
-
/**
|
|
38
|
-
* The local timestamp after which the token will expire.
|
|
39
|
-
*/
|
|
40
|
-
readonly expireTimeMillis: number;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
export
|
|
46
|
-
/**
|
|
47
|
-
* Options for App Check initialization.
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export interface AppCheckOptions {
|
|
51
|
-
/**
|
|
52
|
-
* A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
|
|
53
|
-
*/
|
|
54
|
-
provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
|
|
55
|
-
/**
|
|
56
|
-
* If set to true, enables automatic background refresh of App Check token.
|
|
57
|
-
*/
|
|
58
|
-
isTokenAutoRefreshEnabled?: boolean;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Options when creating a {@link CustomProvider}.
|
|
62
|
-
* @public
|
|
63
|
-
*/
|
|
64
|
-
export interface CustomProviderOptions {
|
|
65
|
-
/**
|
|
66
|
-
* Function to get an App Check token through a custom provider
|
|
67
|
-
* service.
|
|
68
|
-
*/
|
|
69
|
-
getToken: () => Promise<AppCheckToken>;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Result returned by `getToken()`.
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
export interface AppCheckTokenResult {
|
|
76
|
-
/**
|
|
77
|
-
* The token string in JWT format.
|
|
78
|
-
*/
|
|
79
|
-
readonly token: string;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A listener that is called whenever the App Check token changes.
|
|
83
|
-
* @public
|
|
84
|
-
*/
|
|
85
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
import { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider } from './providers';
|
|
19
|
+
export { Unsubscribe, PartialObserver } from '@firebase/util';
|
|
20
|
+
/**
|
|
21
|
+
* The Firebase App Check service interface.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export interface AppCheck {
|
|
26
|
+
/**
|
|
27
|
+
* The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
|
|
28
|
+
*/
|
|
29
|
+
app: FirebaseApp;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The token returned from an App Check provider.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export interface AppCheckToken {
|
|
36
|
+
readonly token: string;
|
|
37
|
+
/**
|
|
38
|
+
* The local timestamp after which the token will expire.
|
|
39
|
+
*/
|
|
40
|
+
readonly expireTimeMillis: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export type _AppCheckComponentName = 'app-check';
|
|
46
|
+
/**
|
|
47
|
+
* Options for App Check initialization.
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface AppCheckOptions {
|
|
51
|
+
/**
|
|
52
|
+
* A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
|
|
53
|
+
*/
|
|
54
|
+
provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
|
|
55
|
+
/**
|
|
56
|
+
* If set to true, enables automatic background refresh of App Check token.
|
|
57
|
+
*/
|
|
58
|
+
isTokenAutoRefreshEnabled?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Options when creating a {@link CustomProvider}.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export interface CustomProviderOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Function to get an App Check token through a custom provider
|
|
67
|
+
* service.
|
|
68
|
+
*/
|
|
69
|
+
getToken: () => Promise<AppCheckToken>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Result returned by `getToken()`.
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export interface AppCheckTokenResult {
|
|
76
|
+
/**
|
|
77
|
+
* The token string in JWT format.
|
|
78
|
+
*/
|
|
79
|
+
readonly token: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A listener that is called whenever the App Check token changes.
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
|
package/dist/src/recaptcha.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
export declare const RECAPTCHA_URL = "https://www.google.com/recaptcha/api.js";
|
|
19
|
-
export declare const RECAPTCHA_ENTERPRISE_URL = "https://www.google.com/recaptcha/enterprise.js";
|
|
20
|
-
export declare function initializeV3(app: FirebaseApp, siteKey: string): Promise<GreCAPTCHA>;
|
|
21
|
-
export declare function initializeEnterprise(app: FirebaseApp, siteKey: string): Promise<GreCAPTCHA>;
|
|
22
|
-
export declare function getToken(app: FirebaseApp): Promise<string>;
|
|
23
|
-
declare global {
|
|
24
|
-
interface Window {
|
|
25
|
-
grecaptcha: GreCAPTCHATopLevel | undefined;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export interface GreCAPTCHATopLevel extends GreCAPTCHA {
|
|
29
|
-
enterprise: GreCAPTCHA;
|
|
30
|
-
}
|
|
31
|
-
export interface GreCAPTCHA {
|
|
32
|
-
ready: (callback: () => void) => void;
|
|
33
|
-
execute: (siteKey: string, options: {
|
|
34
|
-
action: string;
|
|
35
|
-
}) => Promise<string>;
|
|
36
|
-
render: (container: string | HTMLElement, parameters: GreCAPTCHARenderOption) => string;
|
|
37
|
-
}
|
|
38
|
-
export interface GreCAPTCHARenderOption {
|
|
39
|
-
sitekey: string;
|
|
40
|
-
size: 'invisible';
|
|
41
|
-
callback: () => void;
|
|
42
|
-
'error-callback': () => void;
|
|
43
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
export declare const RECAPTCHA_URL = "https://www.google.com/recaptcha/api.js";
|
|
19
|
+
export declare const RECAPTCHA_ENTERPRISE_URL = "https://www.google.com/recaptcha/enterprise.js";
|
|
20
|
+
export declare function initializeV3(app: FirebaseApp, siteKey: string): Promise<GreCAPTCHA>;
|
|
21
|
+
export declare function initializeEnterprise(app: FirebaseApp, siteKey: string): Promise<GreCAPTCHA>;
|
|
22
|
+
export declare function getToken(app: FirebaseApp): Promise<string>;
|
|
23
|
+
declare global {
|
|
24
|
+
interface Window {
|
|
25
|
+
grecaptcha: GreCAPTCHATopLevel | undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export interface GreCAPTCHATopLevel extends GreCAPTCHA {
|
|
29
|
+
enterprise: GreCAPTCHA;
|
|
30
|
+
}
|
|
31
|
+
export interface GreCAPTCHA {
|
|
32
|
+
ready: (callback: () => void) => void;
|
|
33
|
+
execute: (siteKey: string, options: {
|
|
34
|
+
action: string;
|
|
35
|
+
}) => Promise<string>;
|
|
36
|
+
render: (container: string | HTMLElement, parameters: GreCAPTCHARenderOption) => string;
|
|
37
|
+
}
|
|
38
|
+
export interface GreCAPTCHARenderOption {
|
|
39
|
+
sitekey: string;
|
|
40
|
+
size: 'invisible';
|
|
41
|
+
callback: () => void;
|
|
42
|
+
'error-callback': () => void;
|
|
43
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import '../test/setup';
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../test/setup';
|
package/dist/src/state.d.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
import { AppCheckProvider, AppCheckTokenInternal, AppCheckTokenObserver } from './types';
|
|
19
|
-
import { Refresher } from './proactive-refresh';
|
|
20
|
-
import { Deferred } from '@firebase/util';
|
|
21
|
-
import { GreCAPTCHA } from './recaptcha';
|
|
22
|
-
export interface AppCheckState {
|
|
23
|
-
activated: boolean;
|
|
24
|
-
tokenObservers: AppCheckTokenObserver[];
|
|
25
|
-
provider?: AppCheckProvider;
|
|
26
|
-
token?: AppCheckTokenInternal;
|
|
27
|
-
cachedTokenPromise?: Promise<AppCheckTokenInternal | undefined>;
|
|
28
|
-
exchangeTokenPromise?: Promise<AppCheckTokenInternal>;
|
|
29
|
-
tokenRefresher?: Refresher;
|
|
30
|
-
reCAPTCHAState?: ReCAPTCHAState;
|
|
31
|
-
isTokenAutoRefreshEnabled?: boolean;
|
|
32
|
-
}
|
|
33
|
-
export interface ReCAPTCHAState {
|
|
34
|
-
initialized: Deferred<GreCAPTCHA>;
|
|
35
|
-
widgetId?: string;
|
|
36
|
-
succeeded?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface DebugState {
|
|
39
|
-
initialized: boolean;
|
|
40
|
-
enabled: boolean;
|
|
41
|
-
token?: Deferred<string>;
|
|
42
|
-
}
|
|
43
|
-
export declare const DEFAULT_STATE: AppCheckState;
|
|
44
|
-
/**
|
|
45
|
-
* Gets a reference to the state object.
|
|
46
|
-
*/
|
|
47
|
-
export declare function getStateReference(app: FirebaseApp): AppCheckState;
|
|
48
|
-
/**
|
|
49
|
-
* Set once on initialization. The map should hold the same reference to the
|
|
50
|
-
* same object until this entry is deleted.
|
|
51
|
-
*/
|
|
52
|
-
export declare function setInitialState(app: FirebaseApp, state: AppCheckState): AppCheckState;
|
|
53
|
-
export declare function clearState(): void;
|
|
54
|
-
export declare function getDebugState(): DebugState;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
import { AppCheckProvider, AppCheckTokenInternal, AppCheckTokenObserver } from './types';
|
|
19
|
+
import { Refresher } from './proactive-refresh';
|
|
20
|
+
import { Deferred } from '@firebase/util';
|
|
21
|
+
import { GreCAPTCHA } from './recaptcha';
|
|
22
|
+
export interface AppCheckState {
|
|
23
|
+
activated: boolean;
|
|
24
|
+
tokenObservers: AppCheckTokenObserver[];
|
|
25
|
+
provider?: AppCheckProvider;
|
|
26
|
+
token?: AppCheckTokenInternal;
|
|
27
|
+
cachedTokenPromise?: Promise<AppCheckTokenInternal | undefined>;
|
|
28
|
+
exchangeTokenPromise?: Promise<AppCheckTokenInternal>;
|
|
29
|
+
tokenRefresher?: Refresher;
|
|
30
|
+
reCAPTCHAState?: ReCAPTCHAState;
|
|
31
|
+
isTokenAutoRefreshEnabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ReCAPTCHAState {
|
|
34
|
+
initialized: Deferred<GreCAPTCHA>;
|
|
35
|
+
widgetId?: string;
|
|
36
|
+
succeeded?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface DebugState {
|
|
39
|
+
initialized: boolean;
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
token?: Deferred<string>;
|
|
42
|
+
}
|
|
43
|
+
export declare const DEFAULT_STATE: AppCheckState;
|
|
44
|
+
/**
|
|
45
|
+
* Gets a reference to the state object.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getStateReference(app: FirebaseApp): AppCheckState;
|
|
48
|
+
/**
|
|
49
|
+
* Set once on initialization. The map should hold the same reference to the
|
|
50
|
+
* same object until this entry is deleted.
|
|
51
|
+
*/
|
|
52
|
+
export declare function setInitialState(app: FirebaseApp, state: AppCheckState): AppCheckState;
|
|
53
|
+
export declare function clearState(): void;
|
|
54
|
+
export declare function getDebugState(): DebugState;
|
package/dist/src/storage.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
import { AppCheckTokenInternal } from './types';
|
|
19
|
-
/**
|
|
20
|
-
* Always resolves. In case of an error reading from indexeddb, resolve with undefined
|
|
21
|
-
*/
|
|
22
|
-
export declare function readTokenFromStorage(app: FirebaseApp): Promise<AppCheckTokenInternal | undefined>;
|
|
23
|
-
/**
|
|
24
|
-
* Always resolves. In case of an error writing to indexeddb, print a warning and resolve the promise
|
|
25
|
-
*/
|
|
26
|
-
export declare function writeTokenToStorage(app: FirebaseApp, token?: AppCheckTokenInternal): Promise<void>;
|
|
27
|
-
export declare function readOrCreateDebugTokenFromStorage(): Promise<string>;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
import { AppCheckTokenInternal } from './types';
|
|
19
|
+
/**
|
|
20
|
+
* Always resolves. In case of an error reading from indexeddb, resolve with undefined
|
|
21
|
+
*/
|
|
22
|
+
export declare function readTokenFromStorage(app: FirebaseApp): Promise<AppCheckTokenInternal | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Always resolves. In case of an error writing to indexeddb, print a warning and resolve the promise
|
|
25
|
+
*/
|
|
26
|
+
export declare function writeTokenToStorage(app: FirebaseApp, token?: AppCheckTokenInternal): Promise<void>;
|
|
27
|
+
export declare function readOrCreateDebugTokenFromStorage(): Promise<string>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import '../test/setup';
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../test/setup';
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
import { PartialObserver } from '@firebase/util';
|
|
19
|
-
import { AppCheckToken, AppCheckTokenListener } from './public-types';
|
|
20
|
-
export interface FirebaseAppCheckInternal {
|
|
21
|
-
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
|
|
22
|
-
getLimitedUseToken(): Promise<AppCheckTokenResult>;
|
|
23
|
-
addTokenListener(listener: AppCheckTokenListener): void;
|
|
24
|
-
removeTokenListener(listener: AppCheckTokenListener): void;
|
|
25
|
-
}
|
|
26
|
-
export interface AppCheckTokenObserver extends PartialObserver<AppCheckTokenResult> {
|
|
27
|
-
next: AppCheckTokenListener;
|
|
28
|
-
type: ListenerType;
|
|
29
|
-
}
|
|
30
|
-
export declare const enum ListenerType {
|
|
31
|
-
'INTERNAL' = "INTERNAL",
|
|
32
|
-
'EXTERNAL' = "EXTERNAL"
|
|
33
|
-
}
|
|
34
|
-
export interface AppCheckTokenResult {
|
|
35
|
-
readonly token: string;
|
|
36
|
-
readonly error?: Error;
|
|
37
|
-
readonly internalError?: Error;
|
|
38
|
-
}
|
|
39
|
-
export interface AppCheckTokenInternal extends AppCheckToken {
|
|
40
|
-
issuedAtTimeMillis: number;
|
|
41
|
-
}
|
|
42
|
-
export interface AppCheckProvider {
|
|
43
|
-
/**
|
|
44
|
-
* Returns an App Check token.
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
getToken: () => Promise<AppCheckTokenInternal>;
|
|
48
|
-
/**
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
initialize(app: FirebaseApp): void;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
export
|
|
57
|
-
export interface ThrottleData {
|
|
58
|
-
allowRequestsAfter: number;
|
|
59
|
-
backoffCount: number;
|
|
60
|
-
httpStatus: number;
|
|
61
|
-
}
|
|
62
|
-
declare module '@firebase/component' {
|
|
63
|
-
interface NameServiceMapping {
|
|
64
|
-
'app-check-internal': FirebaseAppCheckInternal;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
import { PartialObserver } from '@firebase/util';
|
|
19
|
+
import { AppCheckToken, AppCheckTokenListener } from './public-types';
|
|
20
|
+
export interface FirebaseAppCheckInternal {
|
|
21
|
+
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
|
|
22
|
+
getLimitedUseToken(): Promise<AppCheckTokenResult>;
|
|
23
|
+
addTokenListener(listener: AppCheckTokenListener): void;
|
|
24
|
+
removeTokenListener(listener: AppCheckTokenListener): void;
|
|
25
|
+
}
|
|
26
|
+
export interface AppCheckTokenObserver extends PartialObserver<AppCheckTokenResult> {
|
|
27
|
+
next: AppCheckTokenListener;
|
|
28
|
+
type: ListenerType;
|
|
29
|
+
}
|
|
30
|
+
export declare const enum ListenerType {
|
|
31
|
+
'INTERNAL' = "INTERNAL",
|
|
32
|
+
'EXTERNAL' = "EXTERNAL"
|
|
33
|
+
}
|
|
34
|
+
export interface AppCheckTokenResult {
|
|
35
|
+
readonly token: string;
|
|
36
|
+
readonly error?: Error;
|
|
37
|
+
readonly internalError?: Error;
|
|
38
|
+
}
|
|
39
|
+
export interface AppCheckTokenInternal extends AppCheckToken {
|
|
40
|
+
issuedAtTimeMillis: number;
|
|
41
|
+
}
|
|
42
|
+
export interface AppCheckProvider {
|
|
43
|
+
/**
|
|
44
|
+
* Returns an App Check token.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
getToken: () => Promise<AppCheckTokenInternal>;
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
initialize(app: FirebaseApp): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export type _AppCheckInternalComponentName = 'app-check-internal';
|
|
57
|
+
export interface ThrottleData {
|
|
58
|
+
allowRequestsAfter: number;
|
|
59
|
+
backoffCount: number;
|
|
60
|
+
httpStatus: number;
|
|
61
|
+
}
|
|
62
|
+
declare module '@firebase/component' {
|
|
63
|
+
interface NameServiceMapping {
|
|
64
|
+
'app-check-internal': FirebaseAppCheckInternal;
|
|
65
|
+
}
|
|
66
|
+
}
|