Skip to content

Commit 2c1f46c

Browse files
authored
Merge ffd78ad into f3c7db7
2 parents f3c7db7 + ffd78ad commit 2c1f46c

File tree

11 files changed

+73
-46
lines changed

11 files changed

+73
-46
lines changed

FirebaseAppCheck.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Pod::Spec.new do |s|
3636

3737
s.source_files = [
3838
base_dir + 'Sources/**/*.[mh]',
39-
base_dir + 'Interop/*.h',
4039
'FirebaseCore/Extension/*.h',
4140
]
4241
s.public_header_files = base_dir + 'Sources/Public/FirebaseAppCheck/*.h'
@@ -45,6 +44,7 @@ Pod::Spec.new do |s|
4544
s.osx.weak_framework = 'DeviceCheck'
4645
s.tvos.weak_framework = 'DeviceCheck'
4746

47+
s.dependency 'FirebaseAppCheckInterop', '~> 10.16'
4848
s.dependency 'FirebaseCore', '~> 10.0'
4949
s.dependency 'PromisesObjC', '~> 2.1'
5050
s.dependency 'GoogleUtilities/Environment', '~> 7.8'
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
@import Foundation;
18+
19+
@class FIRAppCheckToken;
20+
21+
NS_ASSUME_NONNULL_BEGIN
22+
23+
NS_SWIFT_NAME(AppCheckProtocol)
24+
@protocol FIRAppCheckProtocol <NSObject>
25+
26+
/// Requests Firebase app check token. This method should *only* be used if you need to authorize
27+
/// requests to a non-Firebase backend. Requests to Firebase backend are authorized automatically if
28+
/// configured.
29+
///
30+
/// If your non-Firebase backend exposes sensitive or expensive endpoints that have low traffic
31+
/// volume, consider protecting it with [Replay
32+
/// Protection](https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
33+
/// In this case, use the ``limitedUseToken(completion:)`` instead to obtain a limited-use token.
34+
/// @param forcingRefresh If `YES`, a new Firebase app check token is requested and the token
35+
/// cache is ignored. If `NO`, the cached token is used if it exists and has not expired yet. In
36+
/// most cases, `NO` should be used. `YES` should only be used if the server explicitly returns an
37+
/// error, indicating a revoked token.
38+
/// @param handler The completion handler. Includes the app check token if the request succeeds,
39+
/// or an error if the request fails.
40+
- (void)tokenForcingRefresh:(BOOL)forcingRefresh
41+
completion:
42+
(void (^)(FIRAppCheckToken *_Nullable token, NSError *_Nullable error))handler
43+
NS_SWIFT_NAME(token(forcingRefresh:completion:));
44+
45+
/// Requests a limited-use Firebase App Check token. This method should be used only if you need to
46+
/// authorize requests to a non-Firebase backend.
47+
///
48+
/// Returns limited-use tokens that are intended for use with your non-Firebase backend endpoints
49+
/// that are protected with [Replay
50+
/// Protection](https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
51+
/// This method does not affect the token generation behavior of the
52+
/// ``tokenForcingRefresh()`` method.
53+
- (void)limitedUseTokenWithCompletion:(void (^)(FIRAppCheckToken *_Nullable token,
54+
NSError *_Nullable error))handler;
55+
56+
@end
57+
58+
NS_ASSUME_NONNULL_END

FirebaseAppCheck/Sources/Core/FIRAppCheck.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h"
1818

19+
@import FirebaseAppCheckInterop;
20+
1921
#if __has_include(<FBLPromises/FBLPromises.h>)
2022
#import <FBLPromises/FBLPromises.h>
2123
#else
@@ -36,9 +38,6 @@
3638
#import "FirebaseAppCheck/Sources/Core/TokenRefresh/FIRAppCheckTokenRefreshResult.h"
3739
#import "FirebaseAppCheck/Sources/Core/TokenRefresh/FIRAppCheckTokenRefresher.h"
3840

39-
#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
40-
#import "FirebaseAppCheck/Interop/FIRAppCheckTokenResultInterop.h"
41-
4241
NS_ASSUME_NONNULL_BEGIN
4342

4443
/// A notification with the specified name is sent to the default notification center

FirebaseAppCheck/Sources/Core/FIRAppCheckComponent.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19+
@import FirebaseAppCheckInterop;
20+
1921
#import "FirebaseAppCheck/Sources/Core/FIRAppCheck+Internal.h"
2022
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h"
2123

22-
#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
23-
2424
#import "FirebaseCore/Extension/FirebaseCoreInternal.h"
2525

2626
NS_ASSUME_NONNULL_BEGIN

FirebaseAppCheck/Sources/Core/FIRAppCheckTokenResult.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19-
#import "FirebaseAppCheck/Interop/FIRAppCheckTokenResultInterop.h"
19+
@import FirebaseAppCheckInterop;
2020

2121
NS_ASSUME_NONNULL_BEGIN
2222

FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19+
@import FirebaseAppCheckInterop;
20+
1921
@class FIRApp;
2022
@class FIRAppCheckToken;
2123
@protocol FIRAppCheckProviderFactory;
@@ -36,7 +38,7 @@ FOUNDATION_EXPORT NSString *const kFIRAppCheckAppNameNotificationKey NS_SWIFT_NA
3638

3739
/// A class used to manage app check tokens for a given Firebase app.
3840
NS_SWIFT_NAME(AppCheck)
39-
@interface FIRAppCheck : NSObject
41+
@interface FIRAppCheck : NSObject <FIRAppCheckProtocol>
4042

4143
- (instancetype)init NS_UNAVAILABLE;
4244

@@ -52,36 +54,6 @@ NS_SWIFT_NAME(AppCheck)
5254
/// @throw Throws an exception if required `FirebaseApp` options are missing.
5355
+ (nullable instancetype)appCheckWithApp:(FIRApp *)firebaseApp NS_SWIFT_NAME(appCheck(app:));
5456

55-
/// Requests Firebase app check token. This method should *only* be used if you need to authorize
56-
/// requests to a non-Firebase backend. Requests to Firebase backend are authorized automatically if
57-
/// configured.
58-
///
59-
/// If your non-Firebase backend exposes sensitive or expensive endpoints that have low traffic
60-
/// volume, consider protecting it with [Replay
61-
/// Protection](https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
62-
/// In this case, use the ``limitedUseToken(completion:)`` instead to obtain a limited-use token.
63-
/// @param forcingRefresh If `YES`, a new Firebase app check token is requested and the token
64-
/// cache is ignored. If `NO`, the cached token is used if it exists and has not expired yet. In
65-
/// most cases, `NO` should be used. `YES` should only be used if the server explicitly returns an
66-
/// error, indicating a revoked token.
67-
/// @param handler The completion handler. Includes the app check token if the request succeeds,
68-
/// or an error if the request fails.
69-
- (void)tokenForcingRefresh:(BOOL)forcingRefresh
70-
completion:
71-
(void (^)(FIRAppCheckToken *_Nullable token, NSError *_Nullable error))handler
72-
NS_SWIFT_NAME(token(forcingRefresh:completion:));
73-
74-
/// Requests a limited-use Firebase App Check token. This method should be used only if you need to
75-
/// authorize requests to a non-Firebase backend.
76-
///
77-
/// Returns limited-use tokens that are intended for use with your non-Firebase backend endpoints
78-
/// that are protected with [Replay
79-
/// Protection](https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
80-
/// This method does not affect the token generation behavior of the
81-
/// ``tokenForcingRefresh()`` method.
82-
- (void)limitedUseTokenWithCompletion:(void (^)(FIRAppCheckToken *_Nullable token,
83-
NSError *_Nullable error))handler;
84-
8557
/// Sets the `AppCheckProviderFactory` to use to generate
8658
/// `AppCheckDebugProvider` objects.
8759
///

FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckIntegrationTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
#import <TargetConditionals.h>
2222

23+
@import FirebaseAppCheckInterop;
24+
2325
#import "FirebaseAppCheck/Sources/Core/TokenRefresh/FIRAppCheckTokenRefresher.h"
2426
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h"
2527
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckProviderFactory.h"
2628
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckToken.h"
2729

28-
#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
29-
#import "FirebaseAppCheck/Interop/FIRAppCheckTokenResultInterop.h"
3030
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRDeviceCheckProvider.h"
3131
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRDeviceCheckProviderFactory.h"
3232

FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckTests.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@
2020

2121
#import "FBLPromise+Testing.h"
2222

23-
#import <FirebaseAppCheck/FirebaseAppCheck.h>
23+
@import FirebaseAppCheckInterop;
2424

2525
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h"
2626
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckErrors.h"
2727
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckProvider.h"
2828

29-
#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
30-
#import "FirebaseAppCheck/Interop/FIRAppCheckTokenResultInterop.h"
31-
3229
#import "FirebaseAppCheck/Sources/Core/Errors/FIRAppCheckErrorUtil.h"
3330
#import "FirebaseAppCheck/Sources/Core/FIRAppCheckSettings.h"
3431
#import "FirebaseAppCheck/Sources/Core/FIRAppCheckTokenResult.h"

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,7 @@ let package = Package(
12171217

12181218
.target(name: "FirebaseAppCheck",
12191219
dependencies: [
1220+
"FirebaseAppCheckInterop",
12201221
"FirebaseCore",
12211222
.product(name: "FBLPromises", package: "Promises"),
12221223
.product(name: "GULEnvironment", package: "GoogleUtilities"),

SharedTestUtilities/AppCheckFake/FIRAppCheckFake.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19-
#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
19+
@import FirebaseAppCheckInterop;
2020

2121
NS_ASSUME_NONNULL_BEGIN
2222

0 commit comments

Comments
 (0)