FIRInstallationsStoredAuthToken.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2019 Google
  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. #import <Foundation/Foundation.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * The enum represent possible states of the installation auth token.
  20. *
  21. * WARNING: The enum is stored to Keychain as a part of `FIRInstallationsStoredAuthToken`.
  22. * Modification of it can lead to incompatibility with previous version. Any modification must be
  23. * evaluated and, if it is really needed, the `storageVersion` must be bumped and proper migration
  24. * code added.
  25. */
  26. typedef NS_ENUM(NSInteger, FIRInstallationsAuthTokenStatus) {
  27. /// An initial status or an undefined value.
  28. FIRInstallationsAuthTokenStatusUnknown,
  29. /// The auth token has been received from the server.
  30. FIRInstallationsAuthTokenStatusTokenReceived
  31. };
  32. /**
  33. * This class serializes and deserializes the installation data into/from `NSData` to be stored in
  34. * Keychain. This class is primarily used by `FIRInstallationsStore`. It is also used on the logic
  35. * level as a data object (see `FIRInstallationsItem.authToken`).
  36. *
  37. * WARNING: Modification of the class properties can lead to incompatibility with the stored data
  38. * encoded by the previous class versions. Any modification must be evaluated and, if it is really
  39. * needed, the `storageVersion` must be bumped and proper migration code added.
  40. */
  41. @interface FIRInstallationsStoredAuthToken : NSObject <NSSecureCoding, NSCopying>
  42. @property FIRInstallationsAuthTokenStatus status;
  43. /// The installation auth token string that can be used to authorize requests to Firebase backend.
  44. @property(nullable, copy) NSString *token;
  45. /// The installation auth token expiration date.
  46. @property(nullable, copy) NSDate *expirationDate;
  47. /// The version of local storage.
  48. @property(nonatomic, readonly) NSInteger storageVersion;
  49. @end
  50. NS_ASSUME_NONNULL_END