FIRAppDistributionAuthPersistence+Private.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <AppAuth/AppAuth.h>
  15. #import "FIRAppDistributionKeychainUtility+Private.h"
  16. NS_ASSUME_NONNULL_BEGIN
  17. // Label exceptions from AppDistributionAuthPersistence calls.
  18. FOUNDATION_EXPORT NSString *const kFIRAppDistributionAuthPersistenceErrorDomain;
  19. /**
  20. * The set of error codes that may be returned from internal calls to persist Tester authentication
  21. * to the keychain. These should never be returned to the user.
  22. * @enum FIRAppDistributionKeychainError
  23. */
  24. typedef NS_ENUM(NSUInteger, FIRAppDistributionKeychainError) {
  25. // Authentication token persistence error
  26. FIRAppDistributionErrorTokenPersistenceFailure = 0,
  27. // Authentication token retrieval error
  28. FIRAppDistributionErrorTokenRetrievalFailure = 1,
  29. // Authentication token deletion error
  30. FIRAppDistributionErrorTokenDeletionFailure = 2,
  31. } NS_SWIFT_NAME(AppDistributionKeychainError);
  32. @interface FIRAppDistributionAuthPersistence : NSObject
  33. - (instancetype)init NS_UNAVAILABLE;
  34. // Handle null checking, creation, and formatting of an error encountered
  35. + (void)handleAuthStateError:(NSError **_Nullable)error
  36. description:(NSString *)description
  37. code:(FIRAppDistributionKeychainError)code;
  38. + (BOOL)persistAuthState:(OIDAuthState *)authState error:(NSError **_Nullable)error;
  39. + (BOOL)clearAuthState:(NSError **_Nullable)error;
  40. + (OIDAuthState *)retrieveAuthState:(NSError **_Nullable)error;
  41. @end
  42. NS_ASSUME_NONNULL_END