feat: Add Recaptcha attestation provider (#94)

Signed-off-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
Co-authored-by: Hitesh Maurya <hiteshmaurya@google.com>
Co-authored-by: Paul Beusterien <paulbeusterien@google.com>
This commit is contained in:
authored and GitHub committed 2026-06-09 16:44:19 -04:00
1 parent f50adb523d
commit f6b4582ed1
57 files changed
+1869 -272

No files matched your search

@@ -18,7 +18,7 @@
@class FBLPromise<Result>;
@class GACAppCheckToken;
@protocol GACAppCheckAPIServiceProtocol;
@protocol _GACAppCheckAPIServiceProtocol;
NS_ASSUME_NONNULL_BEGIN
@@ -33,12 +33,12 @@ NS_ASSUME_NONNULL_BEGIN
: NSObject <GACAppCheckDebugProviderAPIServiceProtocol>
/// Default initializer.
/// @param APIService An instance implementing `GACAppCheckAPIServiceProtocol` to be used to send
/// @param APIService An instance implementing `_GACAppCheckAPIServiceProtocol` to be used to send
/// network requests to the App Check backend.
/// @param resourceName The name of the resource protected by App Check; for a Firebase App this is
/// "projects/{project_id}/apps/{app_id}". See https://google.aip.dev/122 for more details about
/// resource names.
- (instancetype)initWithAPIService:(id<GACAppCheckAPIServiceProtocol>)APIService
- (instancetype)initWithAPIService:(id<_GACAppCheckAPIServiceProtocol>)APIService
resourceName:(NSString *)resourceName;
@end
@@ -22,11 +22,11 @@
#import "FBLPromises.h"
#endif
#import "AppCheckCore/Sources/Core/APIService/GACAppCheckAPIService.h"
#import "AppCheckCore/Sources/Core/APIService/GACAppCheckToken+APIResponse.h"
#import "AppCheckCore/Sources/Public/AppCheckCore/_GACAppCheckAPIService.h"
#import "AppCheckCore/Sources/Core/Errors/GACAppCheckErrorUtil.h"
#import "AppCheckCore/Sources/Core/GACAppCheckLogger+Internal.h"
#import "AppCheckCore/Sources/Public/AppCheckCore/_GACAppCheckErrorUtil.h"
NS_ASSUME_NONNULL_BEGIN
@@ -37,7 +37,7 @@ static NSString *const kLimitedUseField = @"limited_use";
@interface GACAppCheckDebugProviderAPIService ()
@property(nonatomic, readonly) id<GACAppCheckAPIServiceProtocol> APIService;
@property(nonatomic, readonly) id<_GACAppCheckAPIServiceProtocol> APIService;
@property(nonatomic, readonly) NSString *resourceName;
@@ -45,7 +45,7 @@ static NSString *const kLimitedUseField = @"limited_use";
@implementation GACAppCheckDebugProviderAPIService
- (instancetype)initWithAPIService:(id<GACAppCheckAPIServiceProtocol>)APIService
- (instancetype)initWithAPIService:(id<_GACAppCheckAPIServiceProtocol>)APIService
resourceName:(NSString *)resourceName {
self = [super init];
if (self) {
@@ -64,13 +64,13 @@ static NSString *const kLimitedUseField = @"limited_use";
NSURL *URL = [NSURL URLWithString:URLString];
return [self HTTPBodyWithDebugToken:debugToken limitedUse:limitedUse]
.then(^FBLPromise<GACURLSessionDataResponse *> *(NSData *HTTPBody) {
.then(^FBLPromise<_GACURLSessionDataResponse *> *(NSData *HTTPBody) {
return [self.APIService sendRequestWithURL:URL
HTTPMethod:@"POST"
body:HTTPBody
additionalHeaders:@{kContentTypeKey : kJSONContentType}];
})
.then(^id _Nullable(GACURLSessionDataResponse *_Nullable response) {
.then(^id _Nullable(_GACURLSessionDataResponse *_Nullable response) {
return [self.APIService appCheckTokenWithAPIResponse:response];
});
}
@@ -82,7 +82,7 @@ static NSString *const kLimitedUseField = @"limited_use";
if (debugToken.length <= 0) {
FBLPromise *rejectedPromise = [FBLPromise pendingPromise];
[rejectedPromise
reject:[GACAppCheckErrorUtil errorWithFailureReason:@"Debug token must not be empty."]];
reject:[_GACAppCheckErrorUtil errorWithFailureReason:@"Debug token must not be empty."]];
return rejectedPromise;
}
@@ -100,7 +100,7 @@ static NSString *const kLimitedUseField = @"limited_use";
if (payloadJSON != nil) {
return payloadJSON;
} else {
return [GACAppCheckErrorUtil JSONSerializationError:encodingError];
return [_GACAppCheckErrorUtil JSONSerializationError:encodingError];
}
}];
}