@firebase/app-check 0.6.5 → 0.7.0-canary.9c317277f
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 +6 -0
- package/dist/app-check-public.d.ts +17 -0
- package/dist/app-check.d.ts +17 -0
- package/dist/esm/index.esm.js +49 -2
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/index.esm2017.js +39 -2
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/api.d.ts +16 -0
- package/dist/esm/src/internal-api.d.ts +5 -0
- package/dist/index.cjs.js +49 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/api.d.ts +16 -0
- package/dist/src/internal-api.d.ts +5 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @firebase/app-check
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`195e82ebb`](https://github.com/firebase/firebase-js-sdk/commit/195e82ebba29d501892cf9269ecee74eec9df220) [#7169](https://github.com/firebase/firebase-js-sdk/pull/7169) - Add new limited use token method to App Check
|
|
8
|
+
|
|
3
9
|
## 0.6.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -102,6 +102,23 @@ export declare interface CustomProviderOptions {
|
|
|
102
102
|
getToken: () => Promise<AppCheckToken>;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Requests a Firebase App Check token. This method should be used
|
|
107
|
+
* only if you need to authorize requests to a non-Firebase backend.
|
|
108
|
+
*
|
|
109
|
+
* Returns limited-use tokens that are intended for use with your
|
|
110
|
+
* non-Firebase backend endpoints that are protected with
|
|
111
|
+
* <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
|
|
112
|
+
* Replay Protection</a>. This method
|
|
113
|
+
* does not affect the token generation behavior of the
|
|
114
|
+
* #getAppCheckToken() method.
|
|
115
|
+
*
|
|
116
|
+
* @param appCheckInstance - The App Check service instance.
|
|
117
|
+
* @returns The limited use token.
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
export declare function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;
|
|
121
|
+
|
|
105
122
|
/**
|
|
106
123
|
* Get the current App Check token. Attaches to the most recent
|
|
107
124
|
* in-flight request if one is present. Returns null if no token
|
package/dist/app-check.d.ts
CHANGED
|
@@ -124,6 +124,23 @@ export declare interface CustomProviderOptions {
|
|
|
124
124
|
getToken: () => Promise<AppCheckToken>;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Requests a Firebase App Check token. This method should be used
|
|
129
|
+
* only if you need to authorize requests to a non-Firebase backend.
|
|
130
|
+
*
|
|
131
|
+
* Returns limited-use tokens that are intended for use with your
|
|
132
|
+
* non-Firebase backend endpoints that are protected with
|
|
133
|
+
* <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
|
|
134
|
+
* Replay Protection</a>. This method
|
|
135
|
+
* does not affect the token generation behavior of the
|
|
136
|
+
* #getAppCheckToken() method.
|
|
137
|
+
*
|
|
138
|
+
* @param appCheckInstance - The App Check service instance.
|
|
139
|
+
* @returns The limited use token.
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
export declare function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;
|
|
143
|
+
|
|
127
144
|
/**
|
|
128
145
|
* Get the current App Check token. Attaches to the most recent
|
|
129
146
|
* in-flight request if one is present. Returns null if no token
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -915,6 +915,35 @@ function getToken$2(appCheck, forceRefresh) {
|
|
|
915
915
|
});
|
|
916
916
|
});
|
|
917
917
|
}
|
|
918
|
+
/**
|
|
919
|
+
* Internal API for limited use tokens. Skips all FAC state and simply calls
|
|
920
|
+
* the underlying provider.
|
|
921
|
+
*/
|
|
922
|
+
function getLimitedUseToken$1(appCheck) {
|
|
923
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
924
|
+
var app, provider, debugToken, token, token;
|
|
925
|
+
return __generator(this, function (_a) {
|
|
926
|
+
switch (_a.label) {
|
|
927
|
+
case 0:
|
|
928
|
+
app = appCheck.app;
|
|
929
|
+
ensureActivated(app);
|
|
930
|
+
provider = getStateReference(app).provider;
|
|
931
|
+
if (!isDebugMode()) return [3 /*break*/, 3];
|
|
932
|
+
return [4 /*yield*/, getDebugToken()];
|
|
933
|
+
case 1:
|
|
934
|
+
debugToken = _a.sent();
|
|
935
|
+
return [4 /*yield*/, exchangeToken(getExchangeDebugTokenRequest(app, debugToken), appCheck.heartbeatServiceProvider)];
|
|
936
|
+
case 2:
|
|
937
|
+
token = (_a.sent()).token;
|
|
938
|
+
return [2 /*return*/, { token: token }];
|
|
939
|
+
case 3: return [4 /*yield*/, provider.getToken()];
|
|
940
|
+
case 4:
|
|
941
|
+
token = (_a.sent()).token;
|
|
942
|
+
return [2 /*return*/, { token: token }];
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
});
|
|
946
|
+
}
|
|
918
947
|
function addTokenListener(appCheck, type, listener, onError) {
|
|
919
948
|
var app = appCheck.app;
|
|
920
949
|
var state = getStateReference(app);
|
|
@@ -1120,7 +1149,7 @@ function internalFactory(appCheck) {
|
|
|
1120
1149
|
}
|
|
1121
1150
|
|
|
1122
1151
|
var name = "@firebase/app-check";
|
|
1123
|
-
var version = "0.
|
|
1152
|
+
var version = "0.7.0-canary.9c317277f";
|
|
1124
1153
|
|
|
1125
1154
|
/**
|
|
1126
1155
|
* @license
|
|
@@ -1717,6 +1746,24 @@ function getToken(appCheckInstance, forceRefresh) {
|
|
|
1717
1746
|
});
|
|
1718
1747
|
});
|
|
1719
1748
|
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Requests a Firebase App Check token. This method should be used
|
|
1751
|
+
* only if you need to authorize requests to a non-Firebase backend.
|
|
1752
|
+
*
|
|
1753
|
+
* Returns limited-use tokens that are intended for use with your
|
|
1754
|
+
* non-Firebase backend endpoints that are protected with
|
|
1755
|
+
* <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
|
|
1756
|
+
* Replay Protection</a>. This method
|
|
1757
|
+
* does not affect the token generation behavior of the
|
|
1758
|
+
* #getAppCheckToken() method.
|
|
1759
|
+
*
|
|
1760
|
+
* @param appCheckInstance - The App Check service instance.
|
|
1761
|
+
* @returns The limited use token.
|
|
1762
|
+
* @public
|
|
1763
|
+
*/
|
|
1764
|
+
function getLimitedUseToken(appCheckInstance) {
|
|
1765
|
+
return getLimitedUseToken$1(appCheckInstance);
|
|
1766
|
+
}
|
|
1720
1767
|
/**
|
|
1721
1768
|
* Wraps `addTokenListener`/`removeTokenListener` methods in an `Observer`
|
|
1722
1769
|
* pattern for public use.
|
|
@@ -1780,5 +1827,5 @@ function registerAppCheck() {
|
|
|
1780
1827
|
}
|
|
1781
1828
|
registerAppCheck();
|
|
1782
1829
|
|
|
1783
|
-
export { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider, getToken, initializeAppCheck, onTokenChanged, setTokenAutoRefreshEnabled };
|
|
1830
|
+
export { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider, getLimitedUseToken, getToken, initializeAppCheck, onTokenChanged, setTokenAutoRefreshEnabled };
|
|
1784
1831
|
//# sourceMappingURL=index.esm.js.map
|