FIRTOTPSecret+Internal.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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/LICENSE2.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 <TargetConditionals.h>
  17. #if TARGET_OS_IOS
  18. #import "FirebaseAuth/Sources/Backend/RPC/Proto/TOTP/FIRAuthProtoStartMFATOTPEnrollmentRequestInfo.h"
  19. #import "FirebaseAuth/Sources/Backend/RPC/Proto/TOTP/FIRAuthProtoStartMFATOTPEnrollmentResponseInfo.h"
  20. #import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuth.h"
  21. #import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRMultiFactorSession.h"
  22. #import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRTOTPSecret.h"
  23. NS_ASSUME_NONNULL_BEGIN
  24. /**
  25. @brief Internal header extending TOTPSecret class.
  26. */
  27. @interface FIRTOTPSecret ()
  28. /**
  29. @brief Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs.
  30. */
  31. @property(nonatomic, copy, readonly, nullable) NSString *secretKey;
  32. /**
  33. @brief Hashing algorithm used.
  34. */
  35. @property(nonatomic, copy, readonly, nullable) NSString *hashingAlgorithm;
  36. /**
  37. @brief Length of the one-time passwords to be generated.
  38. */
  39. @property(nonatomic, readonly) NSInteger codeLength;
  40. /**
  41. @brief The interval (in seconds) when the OTP codes should change.
  42. */
  43. @property(nonatomic, readonly) NSInteger codeIntervalSeconds;
  44. /**
  45. @brief The timestamp by which TOTP enrollment should be completed. This can be used by callers to
  46. show a countdown of when to enter OTP code by.
  47. */
  48. @property(nonatomic, copy, readonly, nullable) NSDate *enrollmentCompletionDeadline;
  49. /**
  50. @brief Additional session information.
  51. */
  52. @property(nonatomic, copy, readonly, nullable) NSString *sessionInfo;
  53. /**
  54. @fn initWithSecretKey
  55. @brief Initializes an instance of FIRTOTPSecret.
  56. @param secretKey Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs.
  57. @param hashingAlgorithm Hashing algorithm used.
  58. @param codeLength Length of the one-time passwords to be generated.
  59. @param codeIntervalSeconds The interval (in seconds) when the OTP codes should change.
  60. @param enrollmentCompletionDeadline The timestamp by which TOTP enrollment should be completed.
  61. This can be used by callers to show a countdown of when to enter OTP code by.
  62. @param sessionInfo Additional session information.
  63. */
  64. - (instancetype)initWithSecretKey:(NSString *)secretKey
  65. hashingAlgorithm:(NSString *)hashingAlgorithm
  66. codeLength:(NSInteger)codeLength
  67. codeIntervalSeconds:(NSInteger)codeIntervalSeconds
  68. enrollmentCompletionDeadline:(NSDate *)enrollmentCompletionDeadline
  69. sessionInfo:(NSString *)sessionInfo;
  70. @end
  71. NS_ASSUME_NONNULL_END
  72. #endif