소스 검색

Remove `FIRAppCheckProtocol` from FirebaseAppCheckInterop SDK (#13263)

Andrew Heard 1 년 전
부모
커밋
64fd5c2021

+ 0 - 58
FirebaseAppCheck/Interop/Public/FirebaseAppCheckInterop/FIRAppCheckProtocol.h

@@ -1,58 +0,0 @@
-/*
- * Copyright 2023 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-@protocol FIRAppCheckTokenProtocol;
-
-NS_ASSUME_NONNULL_BEGIN
-
-NS_SWIFT_NAME(AppCheckProtocol)
-@protocol FIRAppCheckProtocol <NSObject>
-
-/// Requests Firebase app check token. This method should *only* be used if you need to authorize
-/// requests to a non-Firebase backend. Requests to Firebase backend are authorized automatically if
-/// configured.
-///
-/// If your non-Firebase backend exposes sensitive or expensive endpoints that have low traffic
-/// volume, consider protecting it with [Replay
-/// Protection](https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
-/// In this case, use the ``limitedUseToken(completion:)`` instead to obtain a limited-use token.
-/// @param forcingRefresh If `YES`,  a new Firebase app check token is requested and the token
-/// cache is ignored. If `NO`, the cached token is used if it exists and has not expired yet. In
-/// most cases, `NO` should be used. `YES` should only be used if the server explicitly returns an
-/// error, indicating a revoked token.
-/// @param handler The completion handler. Includes the app check token if the request succeeds,
-/// or an error if the request fails.
-- (void)tokenForcingRefresh:(BOOL)forcingRefresh
-                 completion:(void (^)(id<FIRAppCheckTokenProtocol> _Nullable token,
-                                      NSError *_Nullable error))handler
-    NS_SWIFT_NAME(token(forcingRefresh:completion:));
-
-/// Requests a limited-use Firebase App Check token. This method should be used only if you need to
-/// authorize requests to a non-Firebase backend.
-///
-/// Returns limited-use tokens that are intended for use with your non-Firebase backend endpoints
-/// that are protected with [Replay
-/// Protection](https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection).
-/// This method does not affect the token generation behavior of the
-/// ``tokenForcingRefresh()`` method.
-- (void)limitedUseTokenWithCompletion:(void (^)(id<FIRAppCheckTokenProtocol> _Nullable token,
-                                                NSError *_Nullable error))handler;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 32
FirebaseAppCheck/Interop/Public/FirebaseAppCheckInterop/FIRAppCheckTokenProtocol.h

@@ -1,32 +0,0 @@
-/*
- * Copyright 2024 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-NS_SWIFT_NAME(AppCheckTokenProtocol)
-@protocol FIRAppCheckTokenProtocol <NSObject>
-
-/// A Firebase App Check token.
-@property(nonatomic, readonly) NSString *token;
-
-/// The App Check token's expiration date in the device's local time.
-@property(nonatomic, readonly) NSDate *expirationDate;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 2
FirebaseAppCheck/Interop/Public/FirebaseAppCheckInterop/FirebaseAppCheckInterop.h

@@ -15,6 +15,4 @@
  */
 
 #import "FIRAppCheckInterop.h"
-#import "FIRAppCheckProtocol.h"
-#import "FIRAppCheckTokenProtocol.h"
 #import "FIRAppCheckTokenResultInterop.h"

+ 1 - 3
FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h

@@ -16,8 +16,6 @@
 
 #import <Foundation/Foundation.h>
 
-#import <FirebaseAppCheckInterop/FirebaseAppCheckInterop.h>
-
 @class FIRApp;
 @class FIRAppCheckToken;
 @protocol FIRAppCheckProviderFactory;
@@ -38,7 +36,7 @@ FOUNDATION_EXPORT NSString *const kFIRAppCheckAppNameNotificationKey NS_SWIFT_NA
 
 /// A class used to manage app check tokens for a given Firebase app.
 NS_SWIFT_NAME(AppCheck)
-@interface FIRAppCheck : NSObject <FIRAppCheckProtocol>
+@interface FIRAppCheck : NSObject
 
 - (instancetype)init NS_UNAVAILABLE;
 

+ 1 - 3
FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckToken.h

@@ -16,13 +16,11 @@
 
 #import <Foundation/Foundation.h>
 
-#import <FirebaseAppCheckInterop/FirebaseAppCheckInterop.h>
-
 NS_ASSUME_NONNULL_BEGIN
 
 /// An object representing a Firebase App Check token.
 NS_SWIFT_NAME(AppCheckToken)
-@interface FIRAppCheckToken : NSObject <FIRAppCheckTokenProtocol>
+@interface FIRAppCheckToken : NSObject
 
 /// A Firebase App Check token.
 @property(nonatomic, readonly) NSString *token;

+ 0 - 51
FirebaseAppCheck/Tests/Interop/ObjC/FIRAppCheckProtocolAPITests.m

@@ -1,51 +0,0 @@
-// Copyright 2024 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-#import <FirebaseAppCheckInterop/FirebaseAppCheckInterop.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FIRAppCheckProtocolAPITests : NSObject
-@end
-
-@implementation FIRAppCheckProtocolAPITests
-
-- (void)usage {
-  id<FIRAppCheckProtocol> appCheck;
-
-  [appCheck tokenForcingRefresh:NO
-                     completion:^(id<FIRAppCheckTokenProtocol> _Nullable token,
-                                  NSError *_Nullable error) {
-                       if (token) {
-                         NSString *__unused tokenValue = token.token;
-                         NSDate *__unused expirationDate = token.expirationDate;
-                       }
-                     }];
-
-  if ([appCheck respondsToSelector:@selector(limitedUseTokenWithCompletion:)]) {
-    [appCheck limitedUseTokenWithCompletion:^(id<FIRAppCheckTokenProtocol> _Nullable token,
-                                              NSError *_Nullable error) {
-      if (token) {
-        NSString *__unused tokenValue = token.token;
-        NSDate *__unused expirationDate = token.expirationDate;
-      }
-    }];
-  }
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 58
FirebaseAppCheck/Tests/Interop/Swift/AppCheckProtocolAPITests.swift

@@ -1,58 +0,0 @@
-// Copyright 2024 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// MARK: This file is used to evaluate the AppCheckProtocol API in Swift.
-
-import Foundation
-
-// MARK: Do not import `FirebaseAppCheck`, this file is for `FirebaseAppCheckInterop` only.
-
-import FirebaseAppCheckInterop
-
-final class AppCheckProtocolAPITests {
-  let appCheck: AppCheckProtocol! = nil
-
-  func usage() {
-    let _: Void = appCheck.token(forcingRefresh: false, completion: { token, error in
-      if let token: AppCheckTokenProtocol {
-        let _: String = token.token
-        let _: Date = token.expirationDate
-      }
-      if let error: Error {
-        let _: String = error.localizedDescription
-      }
-    })
-
-    let _: Void = appCheck.limitedUseToken { token, error in
-      if let token: AppCheckTokenProtocol {
-        let _: String = token.token
-        let _: Date = token.expirationDate
-      }
-      if let error: Error {
-        let _: String = error.localizedDescription
-      }
-    }
-  }
-
-  @available(iOS 13, macOS 10.15, macCatalyst 13, tvOS 13, *)
-  func usage_async() async {
-    do {
-      let token: AppCheckTokenProtocol = try await appCheck.token(forcingRefresh: false)
-      let _: String = token.token
-      let _: Date = token.expirationDate
-    } catch {
-      let _: String = error.localizedDescription
-    }
-  }
-}