create
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2020 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 FIRAppCheckTokenResultInterop;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(AppCheckTokenHandlerInterop)
|
||||
typedef void (^FIRAppCheckTokenHandlerInterop)(id<FIRAppCheckTokenResultInterop> tokenResult);
|
||||
|
||||
NS_SWIFT_NAME(AppCheckInterop) @protocol FIRAppCheckInterop
|
||||
|
||||
/// Retrieve a cached or generate a new FAA Token. If forcingRefresh == YES always generates a new
|
||||
/// token and updates the cache.
|
||||
- (void)getTokenForcingRefresh:(BOOL)forcingRefresh
|
||||
completion:(FIRAppCheckTokenHandlerInterop)handler
|
||||
NS_SWIFT_NAME(getToken(forcingRefresh:completion:));
|
||||
|
||||
/// A notification with the specified name is sent to the default notification center
|
||||
/// (`NotificationCenter.default`) each time a Firebase app check token is refreshed.
|
||||
/// The user info dictionary contains `-[self notificationTokenKey]` and
|
||||
/// `-[self notificationAppNameKey]` keys.
|
||||
- (NSString *)tokenDidChangeNotificationName;
|
||||
|
||||
/// `userInfo` key for the FAC token in a notification for `tokenDidChangeNotificationName`.
|
||||
- (NSString *)notificationTokenKey;
|
||||
/// `userInfo` key for the `FirebaseApp.name` in a notification for
|
||||
/// `tokenDidChangeNotificationName`.
|
||||
- (NSString *)notificationAppNameKey;
|
||||
|
||||
// MARK: - Optional API
|
||||
|
||||
@optional
|
||||
|
||||
/// Retrieve a new limited-use Firebase App Check token
|
||||
- (void)getLimitedUseTokenWithCompletion:(FIRAppCheckTokenHandlerInterop)handler
|
||||
NS_SWIFT_NAME(getLimitedUseToken(completion:));
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
@class FIRAppCheckToken;
|
||||
|
||||
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 (^)(FIRAppCheckToken *_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 (^)(FIRAppCheckToken *_Nullable token,
|
||||
NSError *_Nullable error))handler;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2020 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
|
||||
|
||||
@protocol FIRAppCheckTokenResultInterop <NSObject>
|
||||
|
||||
/// App Check token in the case of success or a dummy token in the case of a failure.
|
||||
/// In general, the value of the token should always be set to the request header.
|
||||
@property(nonatomic, readonly) NSString *token;
|
||||
|
||||
/// A token fetch error in the case of a failure or `nil` in the case of success.
|
||||
@property(nonatomic, readonly, nullable) NSError *error;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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 "FIRAppCheckInterop.h"
|
||||
#import "FIRAppCheckProtocol.h"
|
||||
#import "FIRAppCheckTokenResultInterop.h"
|
||||
17
Pods/FirebaseAppCheckInterop/FirebaseAppCheck/Interop/dummy.m
generated
Normal file
17
Pods/FirebaseAppCheckInterop/FirebaseAppCheck/Interop/dummy.m
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
// Swift Package Manager needs at least one source file.
|
||||
Reference in New Issue
Block a user