Skip to content

Commit bef3b03

Browse files
WIP: feat(appcheck-recaptcha-enterprise): Add token exchange models and site key config
This commit introduces the necessary data models and configuration for performing reCAPTCHA Enterprise token exchange with the Firebase App Check backend. - `SiteKey.java`: Provides a structured way to hold and manage the reCAPTCHA Enterprise site key. - `ExchangeRecaptchaEnterpriseTokenRequest.java`: Defines the client-side model for the payload sent to the Firebase App Check Token Exchange API. - `packageinfo.java`: Includes package-level metadata for the new reCAPTCHA Enterprise App Check module. Further implementation, integration, and testing are still in progress. This is not yet ready for review or final merge.
1 parent 84407af commit bef3b03

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.google.firebase.appcheck.recaptchaenterprise.internal;
2+
3+
import androidx.annotation.NonNull;
4+
import androidx.annotation.VisibleForTesting;
5+
6+
import org.json.JSONException;
7+
import org.json.JSONObject;
8+
9+
/**
10+
* Client-side model of the ExchangeRecaptchaEnterpriseTokenRequest payload from the Firebase App
11+
* Check Token Exchange API.
12+
*/
13+
public class ExchangeRecaptchaEnterpriseTokenRequest {
14+
15+
@VisibleForTesting
16+
static final String RECAPTCHA_ENTERPRISE_TOKEN_KEY = "recaptchaEnterpriseToken";
17+
18+
private final String recaptchaEnterpriseToken;
19+
20+
public ExchangeRecaptchaEnterpriseTokenRequest(@NonNull String recaptchaEnterpriseToken) {
21+
this.recaptchaEnterpriseToken = recaptchaEnterpriseToken;
22+
}
23+
24+
@NonNull
25+
public String toJsonString() throws JSONException {
26+
JSONObject jsonObject = new JSONObject();
27+
jsonObject.put(RECAPTCHA_ENTERPRISE_TOKEN_KEY, recaptchaEnterpriseToken);
28+
29+
return jsonObject.toString();
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.google.firebase.appcheck.recaptchaenterprise.internal;
2+
3+
import androidx.annotation.NonNull;
4+
import java.util.Objects;
5+
6+
public class SiteKey {
7+
private final String value;
8+
9+
public SiteKey(@NonNull String value) {
10+
this.value = Objects.requireNonNull(value, "Site key cannot be null");
11+
}
12+
13+
@NonNull
14+
public String value() {
15+
return value;
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** @hide */
2+
package com.google.firebase.appcheck.recaptchaenterprise.internal;

0 commit comments

Comments
 (0)