FIRFinalizePasskeySignInResponse.m 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 "FirebaseAuth/Sources/Backend/RPC/FIRFinalizePasskeySignInResponse.h"
  17. /**
  18. @var kIDTokenKey
  19. @brief The name of the field in the response JSON for id token.
  20. */
  21. static const NSString *kIdTokenKey = @"idToken";
  22. /**
  23. @var kRefreshTokenKey
  24. @brief The name of the field in the response JSON for refresh token.
  25. */
  26. static const NSString *kRefreshTokenKey = @"refreshToken";
  27. @implementation FIRFinalizePasskeySignInResponse
  28. - (BOOL)setWithDictionary:(nonnull NSDictionary *)dictionary
  29. error:(NSError *__autoreleasing _Nullable *_Nullable)error {
  30. if (dictionary[kIdTokenKey] == nil) {
  31. return NO;
  32. }
  33. if (dictionary[kRefreshTokenKey] == nil) {
  34. return NO;
  35. }
  36. _idToken = dictionary[kIdTokenKey];
  37. _refreshToken = dictionary[kRefreshTokenKey];
  38. return YES;
  39. }
  40. @end