FinalizePasskeySignInRequest.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import Foundation
  2. import AuthenticationServices
  3. /// Represents the request for the `finalizePasskeySignIn` endpoint.
  4. @available(iOS 13, *)
  5. class FinalizePasskeySignInRequest: IdentityToolkitRequest, AuthRPCRequest {
  6. typealias Response = FinalizePasskeySignInResponse
  7. var unencodedHTTPRequestBody: [String : AnyHashable]?
  8. /// GCIP endpoint for finalizePasskeySignIn RPC.
  9. private let finalizePasskeySignInEndpoint = "accounts/passkeySignIn:finalize"
  10. /// The signature from the authenticator.
  11. let signature: String
  12. /// Identifier for the registered credential.
  13. var credentialID: String = "id"
  14. /// The CollectedClientData object from the authenticator.
  15. var clientDataJSON: String = "clientDataJSON"
  16. /// The AuthenticatorData from the authenticator.
  17. var authenticatorData: String = "response"
  18. /// The user ID.
  19. let userID: String
  20. /// Initializes a new `FinalizePasskeySignInRequest` with platform credential and request configuration.
  21. ///
  22. /// - Parameters:
  23. /// - credentialID: The credential ID.
  24. /// - clientDataJson: The CollectedClientData object from the authenticator.
  25. /// - authenticatorData: The AuthenticatorData from the authenticator.
  26. /// - signature: The signature from the authenticator.
  27. /// - userID: The user ID.
  28. /// - requestConfiguration: An object containing configurations to be added to the request.
  29. init(credentialID: String, clientDataJson: String, authenticatorData: String, signature: String, userID: String, requestConfiguration: AuthRequestConfiguration) {
  30. self.credentialID = credentialID
  31. self.clientDataJSON = clientDataJson
  32. self.authenticatorData = authenticatorData
  33. self.signature = signature
  34. self.userID = userID
  35. super.init(endpoint: finalizePasskeySignInEndpoint, requestConfiguration: requestConfiguration, useIdentityPlatform: true)
  36. }
  37. }