PasskeyViewController.swift 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2025 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 FirebaseAuth
  15. import FirebaseCore
  16. import AuthenticationServices
  17. class PasskeyViewController: UIViewController{
  18. }
  19. //func passkeySignUp(appManager: AppManager, logFailure: @escaping (String, Error?) -> Void, logSuccess: @escaping (String) -> Void, log: @escaping (String) -> Void, passkeyEnroll: @escaping () -> Void) {
  20. // // Sign in anonymously
  21. // appManager.auth().signInAnonymously { (result: AuthDataResult?, error: Error?) in
  22. // if let error = error {
  23. // logFailure("sign-in anonymously failed", error)
  24. // } else if let user = result?.user {
  25. // logSuccess("sign-in anonymously succeeded.")
  26. // log("User ID : \(user.uid)")
  27. // passkeyEnroll() // Call passkeyEnroll after successful anonymous sign-in
  28. // } else {
  29. // logFailure("sign-in anonymously failed", nil)
  30. // }
  31. // }
  32. //}
  33. //
  34. //private func passkeySignIn(){
  35. // user?.startPasskeyEnrollmentWithName(withName: <#T##String?#>)
  36. //}
  37. //
  38. //func passkeyEnroll(
  39. // appManager: AppManager,
  40. // logFailure: @escaping (String, Error?) -> Void,
  41. // log: @escaping (String) -> Void,
  42. // showTextInputPrompt: @escaping (String, UIKeyboardType, @escaping (Bool, String?) -> Void) -> Void,
  43. // presentationContextProvider: ASAuthorizationControllerPresentationContextProviding,
  44. // authorizationControllerDelegate: ASAuthorizationControllerDelegate
  45. //) async {
  46. // guard let user = appManager.auth().currentUser else {
  47. // logFailure("Please sign in first.", nil)
  48. // return
  49. // }
  50. //
  51. // guard let passkeyName = await showTextInputPrompt("passkey name", keyboardType: UIKeyboardType = .default) else {
  52. // return
  53. // }
  54. //
  55. // if #available(iOS 16.0, macOS 12.0, tvOS 16.0, *) {
  56. // do {
  57. // let request = try await user.startPasskeyEnrollmentWithName(withName: passkeyName)
  58. // let controller = ASAuthorizationController(authorizationRequests: [request])
  59. // controller.delegate = authorizationControllerDelegate
  60. // controller.presentationContextProvider = presentationContextProvider
  61. // controller.performRequests()
  62. // } catch {
  63. // logFailure("Passkey enrollment failed", error)
  64. // }
  65. // } else {
  66. // log("OS version is not supported for this action.")
  67. // }
  68. //}
  69. //
  70. //func passkeyUnenroll(){
  71. //
  72. //}