@firebase/app-check 0.12.0-eap-crashlytics.659b578fb → 0.13.0-20260728185501
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/app-check-public.d.ts +2 -4
- package/dist/app-check.d.ts +2 -10
- package/dist/esm/index.esm.js +12 -69
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/api.d.ts +1 -8
- package/dist/esm/src/errors.d.ts +0 -5
- package/dist/esm/src/public-types.d.ts +1 -1
- package/dist/esm/src/state.d.ts +0 -1
- package/dist/index.cjs.js +11 -69
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/api.d.ts +1 -8
- package/dist/src/errors.d.ts +0 -5
- package/dist/src/public-types.d.ts +1 -1
- package/dist/src/state.d.ts +0 -1
- package/package.json +6 -6
|
@@ -37,7 +37,7 @@ export declare interface AppCheckOptions {
|
|
|
37
37
|
/**
|
|
38
38
|
* A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
|
|
39
39
|
*/
|
|
40
|
-
provider
|
|
40
|
+
provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
|
|
41
41
|
/**
|
|
42
42
|
* If set to true, enables automatic background refresh of App Check token.
|
|
43
43
|
*/
|
|
@@ -144,9 +144,7 @@ export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: bool
|
|
|
144
144
|
* @param options - App Check initialization options
|
|
145
145
|
* @public
|
|
146
146
|
*/
|
|
147
|
-
export declare function initializeAppCheck(app
|
|
148
|
-
|
|
149
|
-
/* Excluded from this release type: _initializeAppCheckInternal */
|
|
147
|
+
export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
|
|
150
148
|
|
|
151
149
|
/**
|
|
152
150
|
* Registers a listener to changes in the token state. There can be more
|
package/dist/app-check.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare interface AppCheckOptions {
|
|
|
43
43
|
/**
|
|
44
44
|
* A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
|
|
45
45
|
*/
|
|
46
|
-
provider
|
|
46
|
+
provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
|
|
47
47
|
/**
|
|
48
48
|
* If set to true, enables automatic background refresh of App Check token.
|
|
49
49
|
*/
|
|
@@ -166,15 +166,7 @@ export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: bool
|
|
|
166
166
|
* @param options - App Check initialization options
|
|
167
167
|
* @public
|
|
168
168
|
*/
|
|
169
|
-
export declare function initializeAppCheck(app
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Internal wrapper that sets a state variable flagging that this was
|
|
173
|
-
* initialized under the hood by a product SDK.
|
|
174
|
-
*
|
|
175
|
-
* @internal
|
|
176
|
-
*/
|
|
177
|
-
export declare function _initializeAppCheckInternal(initializerName: string, app?: FirebaseApp, options?: AppCheckOptions): AppCheck;
|
|
169
|
+
export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
|
|
178
170
|
|
|
179
171
|
/**
|
|
180
172
|
* Registers a listener to changes in the token state. There can be more
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -217,9 +217,6 @@ const ERRORS = {
|
|
|
217
217
|
'different options. To avoid this error, call initializeAppCheck() with the ' +
|
|
218
218
|
'same options as when it was originally called. This will return the ' +
|
|
219
219
|
'already initialized instance.',
|
|
220
|
-
["already-internally-initialized" /* AppCheckError.ALREADY_INTERNALLY_INITIALIZED */]: 'App Check has already been automatically initialized by {$initializerName} ' +
|
|
221
|
-
'with default options. If you want to initialize App Check with custom options, ' +
|
|
222
|
-
'call initializeAppCheck() with those options before initializing {$initializerName}.',
|
|
223
220
|
["use-before-activation" /* AppCheckError.USE_BEFORE_ACTIVATION */]: 'App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. ' +
|
|
224
221
|
'Call initializeAppCheck() before instantiating other Firebase services.',
|
|
225
222
|
["fetch-network-error" /* AppCheckError.FETCH_NETWORK_ERROR */]: 'Fetch failed to connect to a network. Check Internet connection. ' +
|
|
@@ -231,8 +228,6 @@ const ERRORS = {
|
|
|
231
228
|
["storage-get" /* AppCheckError.STORAGE_GET */]: 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
|
|
232
229
|
["storage-set" /* AppCheckError.STORAGE_WRITE */]: 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
|
|
233
230
|
["recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */]: 'ReCAPTCHA error.',
|
|
234
|
-
["no-provider" /* AppCheckError.NO_PROVIDER */]: 'No attestation provider was passed to initializeAppCheck() and ' +
|
|
235
|
-
'no ReCAPTCHA Enterprise site key was found in the Firebase config.',
|
|
236
231
|
["initial-throttle" /* AppCheckError.INITIAL_THROTTLE */]: `{$httpStatus} error. Attempts allowed again after {$time}`,
|
|
237
232
|
["throttled" /* AppCheckError.THROTTLED */]: `Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}`
|
|
238
233
|
};
|
|
@@ -1053,7 +1048,7 @@ function internalFactory(appCheck) {
|
|
|
1053
1048
|
}
|
|
1054
1049
|
|
|
1055
1050
|
const name = "@firebase/app-check";
|
|
1056
|
-
const version = "0.
|
|
1051
|
+
const version = "0.13.0-20260728185501";
|
|
1057
1052
|
|
|
1058
1053
|
/**
|
|
1059
1054
|
* @license
|
|
@@ -1492,6 +1487,7 @@ function throwIfThrottled(throttleData) {
|
|
|
1492
1487
|
*/
|
|
1493
1488
|
function initializeAppCheck(app = getApp(), options) {
|
|
1494
1489
|
app = getModularInstance(app);
|
|
1490
|
+
const provider = _getProvider(app, 'app-check');
|
|
1495
1491
|
// Ensure initializeDebugMode() is only called once.
|
|
1496
1492
|
if (!getDebugState().initialized) {
|
|
1497
1493
|
initializeDebugMode();
|
|
@@ -1504,53 +1500,23 @@ function initializeAppCheck(app = getApp(), options) {
|
|
|
1504
1500
|
// Not using logger because I don't think we ever want this accidentally hidden.
|
|
1505
1501
|
console.log(`App Check debug token: ${token}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`));
|
|
1506
1502
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* If there's no passed provider and no siteKey in project config,
|
|
1517
|
-
* throw.
|
|
1518
|
-
*/
|
|
1519
|
-
if (!options?.provider && !defaultProvider) {
|
|
1520
|
-
throw ERROR_FACTORY.create("no-provider" /* AppCheckError.NO_PROVIDER */);
|
|
1521
|
-
}
|
|
1522
|
-
const initOptions = {
|
|
1523
|
-
...options,
|
|
1524
|
-
provider: options?.provider || defaultProvider
|
|
1525
|
-
};
|
|
1526
|
-
const componentProvider = _getProvider(app, 'app-check');
|
|
1527
|
-
if (componentProvider.isInitialized()) {
|
|
1528
|
-
const existingInstance = componentProvider.getImmediate();
|
|
1529
|
-
const existingOptions = componentProvider.getOptions();
|
|
1530
|
-
/**
|
|
1531
|
-
* Check if all AppCheckOptions previously passed to initializeAppCheck
|
|
1532
|
-
* (`isTokenAutoRefreshEnabled` and `provider`) match those being passed
|
|
1533
|
-
* now. If so, return previous existing instance. Otherwise throw error.
|
|
1534
|
-
*/
|
|
1535
|
-
if (existingOptions.isTokenAutoRefreshEnabled ===
|
|
1536
|
-
initOptions.isTokenAutoRefreshEnabled &&
|
|
1537
|
-
existingOptions.provider?.isEqual(initOptions.provider)) {
|
|
1503
|
+
if (provider.isInitialized()) {
|
|
1504
|
+
const existingInstance = provider.getImmediate();
|
|
1505
|
+
const initialOptions = provider.getOptions();
|
|
1506
|
+
if (initialOptions &&
|
|
1507
|
+
!!initialOptions.isTokenAutoRefreshEnabled ===
|
|
1508
|
+
!!options.isTokenAutoRefreshEnabled &&
|
|
1509
|
+
initialOptions.provider?.isEqual(options.provider)) {
|
|
1538
1510
|
return existingInstance;
|
|
1539
1511
|
}
|
|
1540
1512
|
else {
|
|
1541
|
-
if (typeof getStateReference(app).internallyInitializedBy === 'string') {
|
|
1542
|
-
throw ERROR_FACTORY.create("already-internally-initialized" /* AppCheckError.ALREADY_INTERNALLY_INITIALIZED */, {
|
|
1543
|
-
initializerName: getStateReference(app)
|
|
1544
|
-
.internallyInitializedBy
|
|
1545
|
-
});
|
|
1546
|
-
}
|
|
1547
1513
|
throw ERROR_FACTORY.create("already-initialized" /* AppCheckError.ALREADY_INITIALIZED */, {
|
|
1548
1514
|
appName: app.name
|
|
1549
1515
|
});
|
|
1550
1516
|
}
|
|
1551
1517
|
}
|
|
1552
|
-
const appCheck =
|
|
1553
|
-
_activate(app,
|
|
1518
|
+
const appCheck = provider.initialize({ options });
|
|
1519
|
+
_activate(app, options.provider, options.isTokenAutoRefreshEnabled);
|
|
1554
1520
|
// If isTokenAutoRefreshEnabled is false, do not send any requests to the
|
|
1555
1521
|
// exchange endpoint without an explicit call from the user either directly
|
|
1556
1522
|
// or through another Firebase library (storage, functions, etc.)
|
|
@@ -1564,29 +1530,6 @@ function initializeAppCheck(app = getApp(), options) {
|
|
|
1564
1530
|
}
|
|
1565
1531
|
return appCheck;
|
|
1566
1532
|
}
|
|
1567
|
-
/**
|
|
1568
|
-
* Internal wrapper that sets a state variable flagging that this was
|
|
1569
|
-
* initialized under the hood by a product SDK.
|
|
1570
|
-
*
|
|
1571
|
-
* @internal
|
|
1572
|
-
*/
|
|
1573
|
-
function _initializeAppCheckInternal(
|
|
1574
|
-
// String to be used in error message if there is a future conflict.
|
|
1575
|
-
// Example: "Firebase AI Logic"
|
|
1576
|
-
initializerName, app = getApp(), options) {
|
|
1577
|
-
const componentProvider = _getProvider(app, 'app-check');
|
|
1578
|
-
const previouslyInitialized = componentProvider.isInitialized();
|
|
1579
|
-
if (previouslyInitialized) {
|
|
1580
|
-
// Product SDKs should accept any previously initialized
|
|
1581
|
-
// App Check configuration without error.
|
|
1582
|
-
return componentProvider.getImmediate();
|
|
1583
|
-
}
|
|
1584
|
-
else {
|
|
1585
|
-
const appCheck = initializeAppCheck(app, options);
|
|
1586
|
-
getStateReference(app).internallyInitializedBy = initializerName;
|
|
1587
|
-
return appCheck;
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
1533
|
/**
|
|
1591
1534
|
* Activate App Check
|
|
1592
1535
|
* @param app - Firebase app to activate App Check for.
|
|
@@ -1770,5 +1713,5 @@ function registerAppCheck() {
|
|
|
1770
1713
|
}
|
|
1771
1714
|
registerAppCheck();
|
|
1772
1715
|
|
|
1773
|
-
export { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider,
|
|
1716
|
+
export { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider, getLimitedUseToken, getToken, initializeAppCheck, onTokenChanged, setTokenAutoRefreshEnabled };
|
|
1774
1717
|
//# sourceMappingURL=index.esm.js.map
|