@@ -46,9 +46,18 @@ export interface AppCheckTokenOptions {
4646 */
4747export interface VerifyAppCheckTokenOptions {
4848 /**
49- * Sets the one-time use tokens feature.
50- * When set to `true`, checks if this token has already been consumed.
51- * This feature requires an additional network call to the backend and could be slower when enabled.
49+ * To use the replay protection feature, set this to true to mark the token as consumed.
50+ * Tokens that are found to be already consumed will be marked as such in the response.
51+ *
52+ * Tokens are only considered to be consumed if it is sent to App Check backend by calling the
53+ * {@link AppCheck.verifyToken} method with this field set to `true`; other uses of the token
54+ * do not consume it.
55+ *
56+ * This replay protection feature requires an additional network call to the App Check backend
57+ * and forces your clients to obtain a fresh attestation from your chosen attestation providers.
58+ * This can therefore negatively impact performance and can potentially deplete your attestation
59+ * providers' quotas faster. We recommend that you use this feature only for protecting
60+ * low volume, security critical, or expensive operations.
5261 */
5362 consume ?: boolean ;
5463}
@@ -98,15 +107,6 @@ export interface DecodedAppCheckToken {
98107 * convenience, and is set as the value of the {@link DecodedAppCheckToken.sub | sub} property.
99108 */
100109 app_id : string ;
101-
102- /**
103- * Indicates weather this token was already consumed.
104- * If this is the first time {@link AppCheck.verifyToken} method has seen this token,
105- * this field will contain the value `false`. The given token will then be
106- * marked as `already_consumed` for all future invocations of this {@link AppCheck.verifyToken}
107- * method for this token.
108- */
109- already_consumed ?: boolean ;
110110 [ key : string ] : any ;
111111}
112112
@@ -123,4 +123,17 @@ export interface VerifyAppCheckTokenResponse {
123123 * The decoded Firebase App Check token.
124124 */
125125 token : DecodedAppCheckToken ;
126+
127+ /**
128+ * Indicates weather this token was already consumed.
129+ * If this is the first time {@link AppCheck.verifyToken} method has seen this token,
130+ * this field will contain the value `false`. The given token will then be
131+ * marked as `already_consumed` for all future invocations of this {@link AppCheck.verifyToken}
132+ * method for this token.
133+ *
134+ * When this field is `true`, the caller is attempting to reuse a previously consumed token.
135+ * You should take precautions against such a caller; for example, you can take actions such as
136+ * rejecting the request or ask the caller to pass additional layers of security checks.
137+ */
138+ alreadyConsumed ?: boolean ;
126139}
0 commit comments