mirror of
https://github.com/google/app-check
synced 2026-11-09 22:05:52 +05:45
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:
57 files changed
+1869
-272
No files matched your search
@@ -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 GACDeviceCheckAPIService ()
|
||||
|
||||
@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 GACDeviceCheckAPIService
|
||||
|
||||
- (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 HTTPBodyWithDeviceToken:deviceToken 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];
|
||||
});
|
||||
}
|
||||
@@ -79,7 +79,7 @@ static NSString *const kLimitedUseField = @"limited_use";
|
||||
limitedUse:(BOOL)limitedUse {
|
||||
if (deviceToken.length <= 0) {
|
||||
FBLPromise *rejectedPromise = [FBLPromise pendingPromise];
|
||||
[rejectedPromise reject:[GACAppCheckErrorUtil
|
||||
[rejectedPromise reject:[_GACAppCheckErrorUtil
|
||||
errorWithFailureReason:@"DeviceCheck 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];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user