[TIZEN] Webauthn data porting 79/314179/14
authorutkarshlal <utkarsh.lal@samsung.com>
Mon, 8 Jul 2024 05:50:28 +0000 (11:20 +0530)
committerBot Blink <blinkbot@samsung.com>
Fri, 12 Jul 2024 00:23:25 +0000 (00:23 +0000)
Added class data members
Added functions for porting GA and MC data
Reworked code to use library functions
Added flags for dependencies
Added auto-close for QR after scanning
Cleanup of unneeded code

Change-Id: I5080b1631bbcf96552f9d7b77915bb9497b67fc3
Signed-off-by: utkarshlal <utkarsh.lal@samsung.com>
Signed-off-by: sidpaswan <s.paswan@samsung.com>
22 files changed:
content/browser/BUILD.gn
content/browser/renderer_host/render_frame_host_impl.cc
content/browser/renderer_host/render_frame_host_impl.h
content/browser/renderer_host/render_widget_host_impl.cc
content/browser/renderer_host/render_widget_host_impl.h
content/browser/renderer_host/render_widget_host_view_aura.cc
content/browser/renderer_host/render_widget_host_view_aura.h
content/browser/renderer_host/render_widget_host_view_base.h
content/browser/webauth/authenticator_impl.cc
content/public/browser/web_contents_delegate.h
packaging/chromium-efl.spec
tizen_src/chromium_impl/content/browser/browser_efl.gni
tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc
tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h
tizen_src/chromium_impl/content/browser/webauthn/authenticator_common_tizen.cc
tizen_src/chromium_impl/content/browser/webauthn/authenticator_common_tizen.h
tizen_src/ewk/efl_integration/eweb_view_callbacks.h
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.h
tizen_src/ewk/ubrowser/BUILD.gn
tizen_src/ewk/ubrowser/window.cc
tizen_src/ewk/ubrowser/window.h

index f7315acbd6feffecea92655ee678ccd8fbe8feee..57b7f98e40369a1a395945dde120b1c6cbb8b036 100644 (file)
@@ -3361,6 +3361,8 @@ source_set("browser") {
       "tracing/tracing_ui.h",
 
       # Most webauth code is non-Android
+      "webauth/authenticator_common_impl.cc",
+      "webauth/authenticator_common_impl.h",
       "webauth/authenticator_environment.cc",
       "webauth/authenticator_environment.h",
       "webauth/authenticator_impl.cc",
@@ -3384,13 +3386,6 @@ source_set("browser") {
       "picture_in_picture/document_picture_in_picture_window_controller_impl.h",
     ]
 
-    if (!is_tizen) {
-      sources += [
-        "webauth/authenticator_common_impl.cc",
-        "webauth/authenticator_common_impl.h",
-      ]
-    }
-
     deps += [
       "//components/speech:speech",
       "//components/vector_icons",
index fd78a1feb0ce306e77490dad4e401f3b04487bf3..dfed142a66638e9efefe97458be98428541a2b22 100644 (file)
@@ -16056,6 +16056,11 @@ void RenderFrameHostImpl::DisplayQRCode(std::string contents) {
     GetLocalRenderWidgetHost()->DisplayQRCode(contents);
   }
 }
+void RenderFrameHostImpl::CloseQRCode() {
+  if (GetLocalRenderWidgetHost()) {
+    GetLocalRenderWidgetHost()->CloseQRCode();
+  }
+}
 #endif
 
 bool RenderFrameHostImpl::ShouldReuseCompositing(
index f9c6071cbeeadf1980350d6ef9572dff46e476dc..c65a16f578f73a6af0e485bfa8b4dc9ae3d02a12 100644 (file)
@@ -531,6 +531,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
   bool ShouldChangeRenderFrameHostOnSameSiteNavigation() const override;
 #if BUILDFLAG(IS_EFL)
   void DisplayQRCode(std::string contents);
+  void CloseQRCode();
 #endif
 
   // Additional non-override const version of GetMainFrame.
index 1127c31dc967a6be377986170f867bc7c90bf7b7..8e6a0fb8da34818cdfab31354fe9d0da68610004 100644 (file)
@@ -665,6 +665,13 @@ void RenderWidgetHostImpl::DisplayQRCode(std::string contents) {
   }
   view_->DisplayQRCode(contents);
 }
+void RenderWidgetHostImpl::CloseQRCode() {
+  if (!view_) {
+    LOG(ERROR) << "view_ is null";
+    return;
+  }
+  view_->CloseQRCode();
+}
 #endif
 
 // static
index b66abe48db5aaaa594fcd401dcce4e746ac8ccfa..5e8b71e49b1f50e09a6145367f5dfab359509dd0 100644 (file)
@@ -393,6 +393,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
 
 #if BUILDFLAG(IS_EFL)
   void DisplayQRCode(std::string contents);
+  void CloseQRCode();
 #endif
 
   RenderWidgetHostDelegate* delegate() const { return delegate_; }
index b48fd3793416bbac01ebb20cf4660f8b477babe0..3b6234f28f13e4fd847efc8aa3ec0c0861697b05 100644 (file)
@@ -935,6 +935,11 @@ void RenderWidgetHostViewAura::DisplayQRCode(std::string contents) {
     efl_helper_->DisplayQRCode(contents);
   }
 }
+void RenderWidgetHostViewAura::CloseQRCode() {
+  if (efl_helper_) {
+    efl_helper_->CloseQRCode();
+  }
+}
 #endif
 
 #if BUILDFLAG(IS_WIN)
index 2eb760b1a8c1a116074d11cfa71e70290bd5b9d3..9d38a8c0706d413df2711ab82dfd5b505d19020b 100644 (file)
@@ -519,6 +519,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
 
 #if BUILDFLAG(IS_EFL)
   void DisplayQRCode(std::string contents) override;
+  void CloseQRCode() override;
 #endif
 
   // May be overridden in tests.
index 8b2481314b6efa4bdee66fe45b35a17dcba72c51..183d08163e732df034f341e5566d2d46a9676573 100644 (file)
@@ -653,6 +653,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
   void SetIsFrameSinkIdOwner(bool is_owner);
 #if BUILDFLAG(IS_EFL)
   virtual void DisplayQRCode(std::string contents) {}
+  virtual void CloseQRCode() {}
 #endif
 
  protected:
index 06b5ac54e14dd7709f865a23eae14a7e2567dc6d..260f6dd9dab76ff291f2c2bf214a32681e2f7937 100644 (file)
@@ -32,9 +32,7 @@ void AuthenticatorImpl::Create(
 #if BUILDFLAG(IS_TIZEN)
   new AuthenticatorImpl(
       *render_frame_host, std::move(receiver),
-      std::make_unique<AuthenticatorCommonTizen>(
-          render_frame_host,
-          AuthenticatorCommonTizen::ServingRequestsFor::kWebContents));
+      std::make_unique<AuthenticatorCommonTizen>(render_frame_host));
 #else
   new AuthenticatorImpl(
       *render_frame_host, std::move(receiver),
index 2ba5592e65378cfcb7d557369645166388b85921..a7a03cec5d51c992aeefa36e50e3489a6cdd08a9 100644 (file)
@@ -414,6 +414,7 @@ class CONTENT_EXPORT WebContentsDelegate {
   virtual void UpdateTooltipUnderCursor(const std::u16string& text) {}
 #if BUILDFLAG(IS_EFL)
   virtual void DisplayQRCode(std::string contents) {}
+  virtual void CloseQRCode() {}
 #endif
 
   // Returns a pointer to a service to manage JavaScript dialogs. May return
index 5a350d390dd95ad2ac23ffb9f8bdc407fa91da9e..2058015ffad6625b010ecc8a7dcc66eac885e642 100644 (file)
@@ -119,7 +119,6 @@ BuildRequires: binutils-gold
 %endif
 BuildRequires: at-spi2-atk-devel, bison, edje-tools, expat-devel, flex, gettext, gperf, libatk-bridge-2_0-0, libcap-devel, libcurl, libatomic
 BuildRequires: libjpeg-turbo-devel, ninja, perl, python3, python3-xml, which
-BuildRequires: libwebauthn-client, libwebauthn-client-devel, libwebauthn-common, webauthn, webauthn-ble
 BuildRequires: pkgconfig(atk)
 BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(capi-appfw-app-manager)
@@ -128,8 +127,6 @@ BuildRequires: pkgconfig(capi-media-audio-io)
 BuildRequires: pkgconfig(capi-media-camera)
 BuildRequires: pkgconfig(capi-media-player)
 BuildRequires: pkgconfig(capi-media-tool)
-BuildRequires: pkgconfig(capi-media-vision)
-BuildRequires: pkgconfig(capi-network-bluetooth)
 BuildRequires: pkgconfig(capi-system-device)
 BuildRequires: pkgconfig(capi-system-info)
 BuildRequires: pkgconfig(capi-system-sensor)
@@ -271,6 +268,12 @@ BuildRequires: pkgconfig(mm-common)
 %endif
 %endif
 
+%if %{tizen_version} == 90
+BuildRequires: libwebauthn-client, libwebauthn-client-devel, libwebauthn-common, webauthn, webauthn-ble
+BuildRequires: pkgconfig(capi-media-vision)
+BuildRequires: pkgconfig(capi-network-bluetooth)
+%endif
+
 %if "%{__enable_capi_thread_booster}" == "1"
 BuildRequires: pkgconfig(capi-boost-tv)
 %endif
index ff75417fd914af9604f48be078d6090055a7181c..522c1f4dc876bf553c47d6a256df4f5fb8f2e398 100644 (file)
@@ -130,8 +130,6 @@ external_content_browser_efl_sources = [
   "//tizen_src/chromium_impl/content/browser/web_contents/web_drag_dest_efl.h",
   "//tizen_src/chromium_impl/content/browser/web_contents/web_drag_source_efl.cc",
   "//tizen_src/chromium_impl/content/browser/web_contents/web_drag_source_efl.h",
-  "//tizen_src/chromium_impl/content/browser/webauthn/authenticator_common_tizen.cc",
-  "//tizen_src/chromium_impl/content/browser/webauthn/authenticator_common_tizen.h",
   "//tizen_src/chromium_impl/content/public/browser/certificates_utils.cc",
   "//tizen_src/chromium_impl/content/public/browser/certificates_utils.h",
   "//tizen_src/chromium_impl/content/public/browser/web_contents_efl_delegate.h",
@@ -144,9 +142,15 @@ external_content_browser_efl_sources += [
 ]
 
 if (is_tizen) {
+  external_content_browser_efl_sources += [
+    "//tizen_src/chromium_impl/content/browser/webauthn/authenticator_common_tizen.cc",
+    "//tizen_src/chromium_impl/content/browser/webauthn/authenticator_common_tizen.h",
+  ]
   external_exclude_content_browser_efl_sources = [
     "tracing/tracing_ui.cc",
     "tracing/tracing_ui.h",
+    "webauth/authenticator_common_impl.cc",
+    "webauth/authenticator_common_impl.h",
   ]
 }
 
index 327a9c27c8d4011769d8b1ecefabd19471ca9e75..f4bfb05a461d814a55b9897646ef9c9862f00bc0 100644 (file)
@@ -782,6 +782,10 @@ void RWHVAuraCommonHelperEfl::DisplayQRCode(std::string contents) {
   web_contents_->GetDelegate()->DisplayQRCode(contents);
 }
 
+void RWHVAuraCommonHelperEfl::CloseQRCode() {
+  web_contents_->GetDelegate()->CloseQRCode();
+}
+
 void RWHVAuraCommonHelperEfl::BackgroundColorReceived(
     int callback_id, SkColor bg_color) {
   web_contents_->GetDelegate()->BackgroundColorReceived(callback_id, bg_color);
index e10f46855fe04d0937d1372fe0025e6595a4ff29..318a9513ef8d152757f589537a8c924841aa604d 100644 (file)
@@ -207,6 +207,7 @@ class CONTENT_EXPORT RWHVAuraCommonHelperEfl {
   void OnGetNumberFieldAttributes(bool is_minimum_negative,
                                   bool is_step_integer);
   void DisplayQRCode(std::string contents);
+  void CloseQRCode();
 
  protected:
   void SetOffscreenMode() { is_offscreen_mode_ = true; }
index 3c2bca7ac0fe2a9728af5e8899179fb043ca9cff..4058465d6516b046db3353bf809bc86290207a26 100644 (file)
@@ -466,7 +466,7 @@ blink::mojom::PRFValuesPtr PRFResultsToValues(
   return prf_values;
 }
 
-/* Webauthn specific functions*/
+/* Webauthn functions*/
 
 template <class T>
 wauthn_const_buffer_s ToWauthnConstBuff(T& x) noexcept {
@@ -476,12 +476,6 @@ wauthn_const_buffer_s ToWauthnConstBuff(T& x) noexcept {
                                x.size()};
 }
 
-inline wauthn_const_buffer_s ToWauthnConstBuff(
-    const char* stringLiteral) noexcept {
-  return wauthn_const_buffer_s{reinterpret_cast<const u_int8_t*>(stringLiteral),
-                               std::strlen(stringLiteral)};
-}
-
 typedef std::vector<uint8_t> Buffer;
 
 Buffer ToBuffer(wauthn_const_buffer_s buff) {
@@ -511,39 +505,6 @@ std::string LowercaseHexStringOf(const Bytes& bytes) {
   return res;
 }
 
-struct TestContents {
-  bool succeeded;
-  int statusMC;
-  int statusGA;
-  int updateMCRet = -1;
-  int updateGARet = -1;
-  std::string path;
-  Buffer credentialRawId;
-  Buffer userId;
-  unsigned transports = WAUTHN_TRANSPORT_NONE;
-  std::optional<LinkedData> linkedData;
-  bool negative;
-  RenderFrameHost* RFH;
-
-  std::mutex mutex;
-
-  void UpdateLinkedData(const wauthn_hybrid_linked_data_s* ld) {
-    if (ld) {
-      linkedData.emplace();
-      linkedData->contactId = ToBuffer(*ld->contact_id);
-      linkedData->linkId = ToBuffer(*ld->link_id);
-      linkedData->linkSecret = ToBuffer(*ld->link_secret);
-      linkedData->authenticatorPubKey = ToBuffer(*ld->authenticator_pubkey);
-      linkedData->authenticatorName = ToBuffer(*ld->authenticator_name);
-      linkedData->signature = ToBuffer(*ld->signature);
-      linkedData->tunnelServerDomain = ToBuffer(*ld->tunnel_server_domain);
-      linkedData->identityKey = ToBuffer(*ld->identity_key);
-    } else {
-      linkedData = std::nullopt;
-    }
-  }
-};
-
 void MCUpdateLinkedDataCallback(const wauthn_hybrid_linked_data_s* linked_data,
                                 wauthn_error_e result,
                                 void* data) {
@@ -581,12 +542,25 @@ void AuthenticatorCommonTizen::MCCallback(
     void* data) {
   AuthenticatorCommonTizen* thiz =
       reinterpret_cast<AuthenticatorCommonTizen*>(data);
-  AttestationErasureOption attestation_erasure =
-      AttestationErasureOption::kIncludeAttestation;
+
+  RenderFrameHostImpl* const render_frame_host_impl =
+      static_cast<RenderFrameHostImpl*>(thiz->GetRenderFrameHost());
+
+  content::GetUIThreadTaskRunner({})->PostTask(
+      FROM_HERE, base::BindOnce(&RenderFrameHostImpl::CloseQRCode,
+                                base::Unretained(render_frame_host_impl)));
+
+  if (pubkey_cred == nullptr || result != WAUTHN_ERROR_NONE) {
+    thiz->CompleteMakeCredentialRequest(
+        blink::mojom::AuthenticatorStatus::UNKNOWN_ERROR);
+    return;
+  }
+
   thiz->CompleteMakeCredentialRequest(
       blink::mojom::AuthenticatorStatus::SUCCESS,
-      thiz->CreateMakeCredentialResponse(std::move(pubkey_cred),
-                                         attestation_erasure),
+      thiz->CreateMakeCredentialResponse(
+          std::move(pubkey_cred),
+          AttestationErasureOption::kEraseAttestationAndAaguid),
       nullptr, Focus::kDoCheck);
 }
 
@@ -596,6 +570,20 @@ void AuthenticatorCommonTizen::GACallback(
     void* data) {
   AuthenticatorCommonTizen* thiz =
       reinterpret_cast<AuthenticatorCommonTizen*>(data);
+
+  RenderFrameHostImpl* const render_frame_host_impl =
+      static_cast<RenderFrameHostImpl*>(thiz->GetRenderFrameHost());
+
+  content::GetUIThreadTaskRunner({})->PostTask(
+      FROM_HERE, base::BindOnce(&RenderFrameHostImpl::CloseQRCode,
+                                base::Unretained(render_frame_host_impl)));
+
+  if (pubkey_cred == nullptr || result != WAUTHN_ERROR_NONE) {
+    thiz->CompleteGetAssertionRequest(
+        blink::mojom::AuthenticatorStatus::UNKNOWN_ERROR);
+    return;
+  }
+
   thiz->CompleteGetAssertionRequest(
       blink::mojom::AuthenticatorStatus::SUCCESS,
       thiz->CreateGetAssertionResponse(std::move(pubkey_cred)));
@@ -665,16 +653,12 @@ struct AuthenticatorCommonTizen::RequestState {
 // static
 std::unique_ptr<AuthenticatorCommon> AuthenticatorCommon::Create(
     RenderFrameHost* render_frame_host) {
-  return std::make_unique<AuthenticatorCommonTizen>(
-      render_frame_host,
-      AuthenticatorCommonTizen::ServingRequestsFor::kInternalUses);
+  return std::make_unique<AuthenticatorCommonTizen>(render_frame_host);
 }
 
 AuthenticatorCommonTizen::AuthenticatorCommonTizen(
-    RenderFrameHost* render_frame_host,
-    ServingRequestsFor serving_requests_for)
+    RenderFrameHost* render_frame_host)
     : render_frame_host_id_(render_frame_host->GetGlobalId()),
-      serving_requests_for_(serving_requests_for),
       security_checker_(static_cast<RenderFrameHostImpl*>(render_frame_host)
                             ->GetWebAuthRequestSecurityChecker()) {
   // Disable the back-forward cache for any document that makes WebAuthn
@@ -712,110 +696,330 @@ AuthenticatorCommonTizen::MaybeCreateRequestDelegate() {
   return delegate;
 }
 
-void AuthenticatorCommonTizen::StartMakeCredentialRequest(
-    bool allow_skipping_pin_touch) {
-  InitDiscoveryFactory();
-
-  discovery_factory()->no_cable_linking = req_state_->no_cable_linking;
-  req_state_->request_delegate->ConfigureDiscoveries(
-      req_state_->caller_origin, req_state_->relying_party_id, RequestSource(),
-      device::FidoRequestType::kMakeCredential,
-      req_state_->make_credential_options->resident_key,
-      base::span<const device::CableDiscoveryData>(), discovery_factory());
-
-  req_state_->make_credential_options->allow_skipping_pin_touch =
-      allow_skipping_pin_touch;
-
-  base::flat_set<device::FidoTransportProtocol> transports =
-      GetWebAuthnTransports(
-          GetRenderFrameHost(), discovery_factory(),
-          UsesDiscoverableCreds(*req_state_->make_credential_options));
-
-  req_state_->request_handler =
-      std::make_unique<device::MakeCredentialRequestHandler>(
-          discovery_factory(), transports,
-          *req_state_->ctap_make_credential_request,
-          *req_state_->make_credential_options,
-          base::BindOnce(&AuthenticatorCommonTizen::OnRegisterResponse,
-                         weak_factory_.GetWeakPtr()));
-
-  req_state_->request_delegate->RegisterActionCallbacks(
-      base::BindOnce(&AuthenticatorCommonTizen::OnCancelFromUI,
-                     weak_factory_.GetWeakPtr()) /* cancel_callback */,
-      base::BindRepeating(
-          &AuthenticatorCommonTizen::StartMakeCredentialRequest,
-          weak_factory_.GetWeakPtr(),
-          /*allow_skipping_pin_touch=*/false) /* start_over_callback */,
-      base::DoNothing() /* account_preselected_callback */,
-      base::BindRepeating(
-          &device::FidoRequestHandlerBase::StartAuthenticatorRequest,
-          req_state_->request_handler->GetWeakPtr()) /* request_callback */,
-      base::BindRepeating(
-          &device::FidoRequestHandlerBase::PowerOnBluetoothAdapter,
-          req_state_->request_handler
-              ->GetWeakPtr()) /* bluetooth_adapter_power_on_callback */);
-  req_state_->request_handler->set_observer(req_state_->request_delegate.get());
+bool AuthenticatorCommonTizen::IsFocused() const {
+  return GetRenderFrameHost()->IsActive() &&
+         GetWebAuthenticationDelegate()->IsFocused(
+             WebContents::FromRenderFrameHost(GetRenderFrameHost()));
 }
 
-void AuthenticatorCommonTizen::StartGetAssertionRequest(
-    bool allow_skipping_pin_touch) {
-  req_state_->get_assertion_result.reset();
-  InitDiscoveryFactory();
-
-  discovery_factory()->no_cable_linking = req_state_->no_cable_linking;
-  base::span<const device::CableDiscoveryData> cable_pairings;
-  if (req_state_->ctap_get_assertion_request->cable_extension && IsFocused()) {
-    cable_pairings = *req_state_->ctap_get_assertion_request->cable_extension;
-  }
-  req_state_->request_delegate->ConfigureDiscoveries(
-      req_state_->caller_origin, req_state_->relying_party_id, RequestSource(),
-      device::FidoRequestType::kGetAssertion,
-      /*resident_key_requirement=*/absl::nullopt, cable_pairings,
-      discovery_factory());
-#if BUILDFLAG(IS_CHROMEOS)
-  discovery_factory()->set_get_assertion_request_for_legacy_credential_check(
-      *req_state_->ctap_get_assertion_request);
-#endif
+void AuthenticatorCommonTizen::PopulateMCWebauthnArgs(
+    blink::mojom::PublicKeyCredentialCreationOptionsPtr options) {
+  // Chrome clientData -> Webauthn clientData
+  std::string client_data_json_string = req_state_->client_data_json;
+  client_data_vector_.clear();
+  client_data_vector_.insert(client_data_vector_.begin(),
+                             client_data_json_string.begin(),
+                             client_data_json_string.end());
+  client_data_vector_.push_back('\0');
+  client_data_json_buff_ = ToWauthnConstBuff(client_data_vector_);
+
+  mc_client_data_.client_data_json = &client_data_json_buff_;
+  mc_client_data_.hash_alg = WAUTHN_HASH_ALGORITHM_SHA_256;
+
+  // Chrome RP -> Webauthn RP
+  rel_party_id_ = options->relying_party.id;
+  rel_party_id_.push_back('\0');
+  rp_.id = rel_party_id_.c_str();
+
+  // options->relying_party.name is of type std::optional(std::string)
+  rel_party_name_ = options->relying_party.name.value();
+  rel_party_name_.push_back('\0');
+  rp_.name = rel_party_name_.c_str();
+
+  // Chrome User -> Webauthn User
+  user_id_vector_ = options->user.id;
+  user_id_vector_.push_back('\0');
+  user_id_buff_ = ToWauthnConstBuff(user_id_vector_);
+  user_.id = &user_id_buff_;
+
+  user_name_string_ = *options->user.name;
+  user_name_string_.push_back('\0');
+  user_.name = user_name_string_.c_str();
+
+  user_display_name_string_ = *options->user.display_name;
+  user_display_name_string_.push_back('\0');
+  user_.display_name = user_display_name_string_.c_str();
+
+  // Chrome Pubkey Params -> Webauthn Pubkey Params
+  std::unordered_map<int, wauthn_cose_algorithm_e>
+      mapping_identifier_to_algorithm;
+  mapping_identifier_to_algorithm[-7] =
+      WAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256;
+  mapping_identifier_to_algorithm[-35] =
+      WAUTHN_COSE_ALGORITHM_ECDSA_P384_WITH_SHA384;
+  mapping_identifier_to_algorithm[-36] =
+      WAUTHN_COSE_ALGORITHM_ECDSA_P521_WITH_SHA512;
+  mapping_identifier_to_algorithm[-8] = WAUTHN_COSE_ALGORITHM_EDDSA;
+  mapping_identifier_to_algorithm[-37] =
+      WAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA256;
+  mapping_identifier_to_algorithm[-38] =
+      WAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA384;
+  mapping_identifier_to_algorithm[-39] =
+      WAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA512;
+  mapping_identifier_to_algorithm[-257] =
+      WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256;
+  mapping_identifier_to_algorithm[-258] =
+      WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA384;
+  mapping_identifier_to_algorithm[-259] =
+      WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA512;
+
+  int num_pubkey_params = options->public_key_parameters.size();
+  wauthn_pubkey_cred_param_s temp_pubkey_cred_param;
+  temp_pubkey_cred_param.type = PCT_PUBLIC_KEY;
+  params_vector_.clear();
+  for (int iter = 0; iter < num_pubkey_params; iter++) {
+    temp_pubkey_cred_param.alg =
+        mapping_identifier_to_algorithm[options->public_key_parameters[iter]
+                                            .algorithm];
+    params_vector_.push_back(temp_pubkey_cred_param);
+  }
+  pubkey_cred_params_.params = &params_vector_[0];
+  pubkey_cred_params_.size = num_pubkey_params;
+
+  // Chrome Timeout -> Webauthn Timeout
+  if (options->timeout) {
+    mc_options_.timeout = options->timeout->InMilliseconds();
+  }
+
+  // Chrome Excluded Credentials -> Webauthn Excluded Credentials
+  if (!options->exclude_credentials.empty()) {
+    std::unordered_map<device::FidoTransportProtocol, unsigned int>
+        mapping_transport_to_unsigned_int;
+    mapping_transport_to_unsigned_int
+        [device::FidoTransportProtocol::kUsbHumanInterfaceDevice] = 0x00000001;
+    mapping_transport_to_unsigned_int
+        [device::FidoTransportProtocol::kNearFieldCommunication] = 0x00000002;
+    mapping_transport_to_unsigned_int
+        [device::FidoTransportProtocol::kBluetoothLowEnergy] = 0x00000004;
+    mapping_transport_to_unsigned_int[device::FidoTransportProtocol::kHybrid] =
+        0x00000010;
+    mapping_transport_to_unsigned_int
+        [device::FidoTransportProtocol::kInternal] = 0x00000020;
+
+    int num_excluded_credentials = options->exclude_credentials.size();
+    wauthn_pubkey_cred_descriptor_s temp_excluded_credential;
+    temp_excluded_credential.type = PCT_PUBLIC_KEY;
+    excluded_creds_vector_.clear();
+    excluded_creds_id_vector_.clear();
+
+    for (int iter = 0; iter < num_excluded_credentials; iter++) {
+      excluded_creds_id_vector_.push_back(
+          ToWauthnConstBuff(options->exclude_credentials[iter].id));
+      temp_excluded_credential.id = &excluded_creds_id_vector_[iter];
+
+      temp_excluded_credential.transports = 0x00000000;
+      if (!options->exclude_credentials[iter].transports.empty()) {
+        for (auto jter = options->exclude_credentials[iter].transports.begin();
+             jter != options->exclude_credentials[iter].transports.end();
+             jter++) {
+          temp_excluded_credential.transports |=
+              mapping_transport_to_unsigned_int[*jter];
+        }
+      }
+      excluded_creds_vector_.push_back(temp_excluded_credential);
+    }
+    excluded_credentials_.descriptors = &excluded_creds_vector_[0];
+    excluded_credentials_.size = num_excluded_credentials;
+
+    mc_options_.exclude_credentials = &excluded_credentials_;
+  }
+
+  // Chrome Attestation Preference -> Webauthn Attestation Preference
+  std::unordered_map<::device::AttestationConveyancePreference,
+                     wauthn_attestation_pref_e>
+      mapping_attestation_preference;
+  mapping_attestation_preference
+      [::device::AttestationConveyancePreference::kNone] = AP_NONE;
+  mapping_attestation_preference
+      [::device::AttestationConveyancePreference::kIndirect] = AP_INDIRECT;
+  mapping_attestation_preference
+      [::device::AttestationConveyancePreference::kDirect] = AP_DIRECT;
+  mapping_attestation_preference[::device::AttestationConveyancePreference::
+                                     kEnterpriseIfRPListedOnAuthenticator] =
+      AP_ENTERPRISE;
+  mapping_attestation_preference[::device::AttestationConveyancePreference::
+                                     kEnterpriseApprovedByBrowser] =
+      AP_ENTERPRISE;
+
+  // Chrome Authenticator Selection -> Webauthn Authenticator Selection
+  if (options->authenticator_selection) {
+    std::unordered_map<device::AuthenticatorAttachment,
+                       wauthn_authenticator_attachment_e>
+        mapping_authenticator_attachment;
+    mapping_authenticator_attachment[device::AuthenticatorAttachment::kAny] =
+        AA_NONE;
+    mapping_authenticator_attachment
+        [device::AuthenticatorAttachment::kPlatform] = AA_PLATFORM;
+    mapping_authenticator_attachment
+        [device::AuthenticatorAttachment::kCrossPlatform] = AA_CROSS_PLATFORM;
+
+    if (options->authenticator_selection->authenticator_attachment !=
+        device::AuthenticatorAttachment::kAny) {
+      mc_authenticator_selection_criteria_.attachment =
+          mapping_authenticator_attachment[options->authenticator_selection
+                                               ->authenticator_attachment];
+    }
+
+    std::unordered_map<device::ResidentKeyRequirement,
+                       wauthn_resident_key_requirement_e>
+        mapping_resident_key_requirement;
+    mapping_resident_key_requirement
+        [device::ResidentKeyRequirement::kDiscouraged] = RKR_DISCOURAGED;
+    mapping_resident_key_requirement
+        [device::ResidentKeyRequirement::kPreferred] = RKR_PREFERRED;
+    mapping_resident_key_requirement
+        [device::ResidentKeyRequirement::kRequired] = RKR_REQUIRED;
+
+    mc_authenticator_selection_criteria_.resident_key =
+        mapping_resident_key_requirement[options->authenticator_selection
+                                             ->resident_key];
+    mc_authenticator_selection_criteria_.require_resident_key =
+        mc_authenticator_selection_criteria_.resident_key == RKR_REQUIRED;
+
+    std::unordered_map<device::UserVerificationRequirement,
+                       wauthn_user_verification_requirement_e>
+        mapping_user_verification_requirement;
+    mapping_user_verification_requirement
+        [device::UserVerificationRequirement::kRequired] = UVR_REQUIRED;
+    mapping_user_verification_requirement
+        [device::UserVerificationRequirement::kPreferred] = UVR_PREFERRED;
+    mapping_user_verification_requirement
+        [device::UserVerificationRequirement::kDiscouraged] = UVR_DISCOURAGED;
+
+    mc_authenticator_selection_criteria_.user_verification =
+        mapping_user_verification_requirement
+            [options->authenticator_selection->user_verification_requirement];
+
+    mc_options_.authenticator_selection = &mc_authenticator_selection_criteria_;
+  }
+
+  // Chrome Attestation Formats -> Webauthn Attestation Formats
+  if (options->device_public_key) {
+    num_attestation_formats_ =
+        options->device_public_key->attestation_formats.size();
+    wauthn_const_buffer_s temp_attestation_format;
+    mc_attestation_formats_vector_.clear();
+
+    for (int iter = 0; iter < num_attestation_formats_; iter++) {
+      mc_attestation_formats_string_vector_.push_back(
+          options->device_public_key->attestation_formats[iter]);
+      mc_attestation_formats_string_vector_[iter].push_back('\0');
+
+      temp_attestation_format =
+          ToWauthnConstBuff(mc_attestation_formats_string_vector_[iter]);
+      mc_attestation_formats_vector_.push_back(temp_attestation_format);
+    }
+
+    mc_attestation_formats_.attestation_formats =
+        &mc_attestation_formats_vector_[0];
+    mc_attestation_formats_.size = num_attestation_formats_;
+
+    mc_options_.attestation_formats = &mc_attestation_formats_;
+  }
 
-  base::flat_set<device::FidoTransportProtocol> transports =
-      GetWebAuthnTransports(
-          GetRenderFrameHost(), discovery_factory(),
-          UsesDiscoverableCreds(*req_state_->ctap_get_assertion_request));
-
-  auto request_handler = std::make_unique<device::GetAssertionRequestHandler>(
-      discovery_factory(), transports, *req_state_->ctap_get_assertion_request,
-      *req_state_->ctap_get_assertion_options, allow_skipping_pin_touch,
-      base::BindOnce(&AuthenticatorCommonTizen::OnSignResponse,
-                     weak_factory_.GetWeakPtr()));
-  request_handler->transport_availability_info().conditional_ui_treatment =
-      req_state_->conditional_ui_treatment;
-
-  req_state_->request_delegate->RegisterActionCallbacks(
-      base::BindOnce(&AuthenticatorCommonTizen::OnCancelFromUI,
-                     weak_factory_.GetWeakPtr()) /* cancel_callback */,
-      base::BindRepeating(
-          &AuthenticatorCommonTizen::StartGetAssertionRequest,
-          weak_factory_.GetWeakPtr(),
-          /*allow_skipping_pin_touch=*/false) /* start_over_callback */,
-      base::BindRepeating(
-          &device::GetAssertionRequestHandler::PreselectAccount,
-          request_handler->GetWeakPtr()) /* account_preselected_callback */,
-      base::BindRepeating(
-          &device::GetAssertionRequestHandler::StartAuthenticatorRequest,
-          request_handler->GetWeakPtr()) /* request_callback */,
-      base::BindRepeating(
-          &device::FidoRequestHandlerBase::PowerOnBluetoothAdapter,
-          request_handler
-              ->GetWeakPtr()) /* bluetooth_adapter_power_on_callback */);
-
-  request_handler->set_observer(req_state_->request_delegate.get());
-  req_state_->request_handler = std::move(request_handler);
+  std::memset(&mc_options_, 0, sizeof(mc_options_));
+  mc_options_.rp = &rp_;
+  mc_options_.user = &user_;
+  mc_options_.pubkey_cred_params = &pubkey_cred_params_;
+  mc_options_.attestation =
+      mapping_attestation_preference[options->attestation];
+
+  mc_callbacks_.qrcode_callback = DisplayQRCallback;
+  mc_callbacks_.response_callback = MCCallback;
+  mc_callbacks_.linked_data_callback = MCUpdateLinkedDataCallback;
+  mc_callbacks_.user_data = this;
 }
 
-bool AuthenticatorCommonTizen::IsFocused() const {
-  return GetRenderFrameHost()->IsActive() &&
-         GetWebAuthenticationDelegate()->IsFocused(
-             WebContents::FromRenderFrameHost(GetRenderFrameHost()));
+void AuthenticatorCommonTizen::PopulateGAWebauthnArgs(
+    blink::mojom::PublicKeyCredentialRequestOptionsPtr options) {
+  // Chrome clientData -> Webauthn clientData
+  std::string client_data_json_string = req_state_->client_data_json;
+  client_data_vector_.clear();
+  client_data_vector_.insert(client_data_vector_.begin(),
+                             client_data_json_string.begin(),
+                             client_data_json_string.end());
+  client_data_vector_.push_back('\0');
+  client_data_json_buff_ = ToWauthnConstBuff(client_data_vector_);
+
+  ga_client_data_.client_data_json = &client_data_json_buff_;
+  ga_client_data_.hash_alg = WAUTHN_HASH_ALGORITHM_SHA_256;
+
+  // Chrome Timeout -> Webauthn Timeout
+  if (options->timeout) {
+    ga_options_.timeout = options->timeout->InMilliseconds();
+  }
+
+  // Chrome RP -> Webauthn RP
+  rp_id_string_ = options->relying_party_id;
+  rp_id_string_.push_back('\0');
+
+  // Chrome Allow Credentials -> Webauthn Allow Credentials
+  if (!options->allow_credentials.empty()) {
+    int num_allow_credentials = options->allow_credentials.size();
+    wauthn_pubkey_cred_descriptor_s temp_pubkey_cred_descriptor;
+    temp_pubkey_cred_descriptor.type = PCT_PUBLIC_KEY;
+    pubkey_cred_descriptor_vector_.clear();
+    pubkey_cred_id_vector_.clear();
+
+    for (int iter = 0; iter < num_allow_credentials; iter++) {
+      pubkey_cred_id_vector_.push_back(
+          ToWauthnConstBuff(options->allow_credentials[iter].id));
+      temp_pubkey_cred_descriptor.id = &pubkey_cred_id_vector_[iter];
+
+      temp_pubkey_cred_descriptor.transports = 0x00000000;
+      for (const auto& transport :
+           options->allow_credentials[iter].transports) {
+        if (transport ==
+            device::FidoTransportProtocol::kUsbHumanInterfaceDevice) {
+          temp_pubkey_cred_descriptor.transports |= 0x00000001;
+        }
+        if (transport ==
+            device::FidoTransportProtocol::kNearFieldCommunication) {
+          temp_pubkey_cred_descriptor.transports |= 0x00000002;
+        }
+        if (transport == device::FidoTransportProtocol::kBluetoothLowEnergy) {
+          temp_pubkey_cred_descriptor.transports |= 0x00000004;
+        }
+        if (transport == device::FidoTransportProtocol::kHybrid) {
+          temp_pubkey_cred_descriptor.transports |= 0x00000010;
+        }
+        if (transport == device::FidoTransportProtocol::kInternal) {
+          temp_pubkey_cred_descriptor.transports |= 0x00000020;
+        }
+      }
+      pubkey_cred_descriptor_vector_.push_back(temp_pubkey_cred_descriptor);
+    }
+    pubkey_cred_descriptors_.descriptors = &pubkey_cred_descriptor_vector_[0];
+    pubkey_cred_descriptors_.size = num_allow_credentials;
+
+    ga_options_.allow_credentials = &pubkey_cred_descriptors_;
+  }
+
+  // Chrome User Verification -> Webauthn User Verification
+  std::unordered_map<device::UserVerificationRequirement,
+                     wauthn_user_verification_requirement_e>
+      mapping_user_verification_requirement;
+  mapping_user_verification_requirement
+      [device::UserVerificationRequirement::kRequired] = UVR_REQUIRED;
+  mapping_user_verification_requirement
+      [device::UserVerificationRequirement::kPreferred] = UVR_PREFERRED;
+  mapping_user_verification_requirement
+      [device::UserVerificationRequirement::kDiscouraged] = UVR_DISCOURAGED;
+
+  ga_options_.user_verification =
+      mapping_user_verification_requirement[options->user_verification];
+
+  std::memset(&ga_options_, 0, sizeof(ga_options_));
+  ga_options_.rpId = rp_id_string_.c_str();
+  ga_options_.hints = nullptr;
+  ga_options_.attestation = device_attestation_;
+  ga_options_.extensions = nullptr;
+  ga_options_.linked_device = nullptr;
+
+  ga_callbacks_.qrcode_callback = DisplayQRCallback;
+  ga_callbacks_.response_callback = GACallback;
+  ga_callbacks_.linked_data_callback = GAUpdateLinkedDataCallback;
+  ga_callbacks_.user_data = this;
 }
 
 // mojom::Authenticator
@@ -986,7 +1190,7 @@ void AuthenticatorCommonTizen::MakeCredential(
       req_state_->make_credential_options->resident_key !=
       device::ResidentKeyRequirement::kDiscouraged;
 
-  // Below check is currently disabled to test further functionality
+  // TODO: Handle unsupported residential credentials for Tizen
 #if (0)
   if (might_create_resident_key &&
       !GetWebAuthenticationDelegate()->SupportsResidentKeys(
@@ -1002,6 +1206,7 @@ void AuthenticatorCommonTizen::MakeCredential(
         device::ResidentKeyRequirement::kDiscouraged;
   }
 #endif  // if(0)
+
   // Reject any non-sensical credProtect extension values.
   if (  // Can't require the default policy (or no policy).
       (options->enforce_protection_policy &&
@@ -1157,92 +1362,8 @@ void AuthenticatorCommonTizen::MakeCredential(
   req_state_->ctap_make_credential_request->attestation_preference =
       attestation;
 
-  // Chrome clientData -> Webauthn clientData
-  std::string clientDataJsonString = req_state_->client_data_json;
-
-  char tempCharStar[clientDataJsonString.size() + 1];
-  strcpy(tempCharStar, clientDataJsonString.c_str());
-  unsigned char* clientDataJson =
-      reinterpret_cast<unsigned char*>(tempCharStar);
-
-  wauthn_const_buffer_s clientDataJsonBuff;
-  clientDataJsonBuff.data = clientDataJson;
-  clientDataJsonBuff.size = clientDataJsonString.size();
-
-  mcClientData.client_data_json = &clientDataJsonBuff;
-  mcClientData.hash_alg = WAUTHN_HASH_ALGORITHM_SHA_256;
-
-  // Chrome RP -> Webauthn RP
-  wauthn_rp_entity_s rp;
-  std::string rel_party_id = options->relying_party.id;
-  // Field relying_party.name is of type std::optional(std::string)
-  std::string rel_party_name = options->relying_party.name.value();
-  rp.id = rel_party_id.c_str();
-  rp.name = rel_party_name.c_str();
-
-  // Chrome User -> Webauthn User
-  wauthn_user_entity_s user;
-  unsigned char* userId = &(options->user.id)[0];
-
-  wauthn_const_buffer_s userIdBuff;
-  userIdBuff.data = userId;
-  userIdBuff.size = sizeof(userId) - 1;
-
-  user.id = &userIdBuff;
-  user.name = (options->user.name)->c_str();
-  user.display_name = (options->user.display_name)->c_str();
-
-  // Chrome Pubkey Params -> Webauthn Pubkey Params
-  int num_pubkey_params = options->public_key_parameters.size();
-  wauthn_pubkey_cred_param_s params[num_pubkey_params];
-
-  std::unordered_map<int, wauthn_cose_algorithm_e>
-      mapping_identifier_to_algorithm;
-  mapping_identifier_to_algorithm[-7] =
-      WAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256;
-  mapping_identifier_to_algorithm[-35] =
-      WAUTHN_COSE_ALGORITHM_ECDSA_P384_WITH_SHA384;
-  mapping_identifier_to_algorithm[-36] =
-      WAUTHN_COSE_ALGORITHM_ECDSA_P521_WITH_SHA512;
-  mapping_identifier_to_algorithm[-8] = WAUTHN_COSE_ALGORITHM_EDDSA;
-  mapping_identifier_to_algorithm[-37] =
-      WAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA256;
-  mapping_identifier_to_algorithm[-38] =
-      WAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA384;
-  mapping_identifier_to_algorithm[-39] =
-      WAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA512;
-  mapping_identifier_to_algorithm[-257] =
-      WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256;
-  mapping_identifier_to_algorithm[-258] =
-      WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA384;
-  mapping_identifier_to_algorithm[-259] =
-      WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA512;
-
-  wauthn_pubkey_cred_param_s temp_pubkey_cred_param;
-  for (int temp = 0; temp < num_pubkey_params; temp++) {
-    temp_pubkey_cred_param.type = PCT_PUBLIC_KEY;
-    temp_pubkey_cred_param.alg =
-        mapping_identifier_to_algorithm[options->public_key_parameters[temp]
-                                            .algorithm];
-    params[temp] = temp_pubkey_cred_param;
-  }
-
-  wauthn_pubkey_cred_params_s pubkeyCredParams;
-  pubkeyCredParams.params = params;
-  pubkeyCredParams.size = sizeof(params) / sizeof(*params);
-
-  std::memset(&mcOptions, 0, sizeof(mcOptions));
-  mcOptions.rp = &rp;
-  mcOptions.user = &user;
-  mcOptions.pubkey_cred_params = &pubkeyCredParams;
-  mcOptions.timeout = options->timeout->InMilliseconds();
-
-  mcCallbacks.qrcode_callback = DisplayQRCallback;
-  mcCallbacks.response_callback = MCCallback;
-  mcCallbacks.linked_data_callback = MCUpdateLinkedDataCallback;
-  mcCallbacks.user_data = this;
-
-  int ret = wauthn_make_credential(&mcClientData, &mcOptions, &mcCallbacks);
+  PopulateMCWebauthnArgs(std::move(options));
+  wauthn_make_credential(&mc_client_data_, &mc_options_, &mc_callbacks_);
 }
 
 void AuthenticatorCommonTizen::GetAssertion(
@@ -1441,6 +1562,8 @@ void AuthenticatorCommonTizen::GetAssertion(
     options->allow_credentials =
         std::vector<device::PublicKeyCredentialDescriptor>();
   }
+
+  // TODO: Handle unsupported residential credentials for Tizen
 #if (0)
   if (options->allow_credentials.empty()) {
     if (!GetWebAuthenticationDelegate()->SupportsResidentKeys(
@@ -1452,6 +1575,7 @@ void AuthenticatorCommonTizen::GetAssertion(
     req_state_->discoverable_credential_request = true;
   }
 #endif
+
   if (options->extensions->large_blob_read &&
       options->extensions->large_blob_write) {
     CompleteGetAssertionRequest(
@@ -1542,7 +1666,45 @@ void AuthenticatorCommonTizen::GetAssertion(
             blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
         break;
     }
+
+    // Device Public Key Attestation
+    switch (device_public_key.attestation) {
+      case device::AttestationConveyancePreference::kNone:
+        device_attestation_ = AP_NONE;
+        break;
+      case device::AttestationConveyancePreference::kDirect:
+        device_attestation_ = AP_DIRECT;
+        break;
+      case device::AttestationConveyancePreference::kIndirect:
+        device_attestation_ = AP_INDIRECT;
+        break;
+      case device::AttestationConveyancePreference::
+          kEnterpriseIfRPListedOnAuthenticator:
+      case device::AttestationConveyancePreference::
+          kEnterpriseApprovedByBrowser:
+        device_attestation_ = AP_ENTERPRISE;
+    }
+
+    num_attestation_formats_ = device_public_key.attestation_formats.size();
+    wauthn_const_buffer_s temp_wauthn_const_buffer_s;
+
+    for (int iter = 0; iter < num_attestation_formats_; iter++) {
+      std::string temp_attestation_formats_string(
+          device_public_key.attestation_formats[iter]);
+      temp_attestation_formats_string.push_back('\0');
+      ga_attestation_formats_string_vector_.push_back(
+          temp_attestation_formats_string);
+
+      temp_wauthn_const_buffer_s =
+          ToWauthnConstBuff(ga_attestation_formats_string_vector_[iter]);
+      ga_attestation_formats_vector_.push_back(temp_wauthn_const_buffer_s);
+    }
+    device_attestation_formats_.attestation_formats =
+        &ga_attestation_formats_vector_[0];
+    device_attestation_formats_.size = num_attestation_formats_;
   }
+  ga_options_.attestation_formats =
+      num_attestation_formats_ ? &device_attestation_formats_ : nullptr;
 
   if (options->extensions->get_cred_blob) {
     req_state_->requested_extensions.insert(RequestExtension::kGetCredBlob);
@@ -1554,97 +1716,8 @@ void AuthenticatorCommonTizen::GetAssertion(
   req_state_->ctap_get_assertion_options->large_blob_write =
       options->extensions->large_blob_write;
 
-  char tempCharStar[req_state_->client_data_json.size() + 1];
-  strcpy(tempCharStar, req_state_->client_data_json.c_str());
-  unsigned char* clientDataJson =
-      reinterpret_cast<unsigned char*>(tempCharStar);
-
-  wauthn_const_buffer_s clientDataJsonBuff;
-  clientDataJsonBuff.data = clientDataJson;
-  clientDataJsonBuff.size = req_state_->client_data_json.size();
-
-  gaClientData.client_data_json = &clientDataJsonBuff;
-  gaClientData.hash_alg = WAUTHN_HASH_ALGORITHM_SHA_256;
-
-  // Temp User Data
-  TestContents testContents = {true,
-                               0,
-                               0,
-                               -1,
-                               -1,
-                               "/tmp/webauthn-qrcode.png",
-                               {},
-                               {},
-                               WAUTHN_TRANSPORT_NONE,
-                               std::nullopt,
-                               false,
-                               GetRenderFrameHost(),
-                               {}};
-  auto lock = std::unique_lock{testContents.mutex};
-
-  wauthn_const_buffer_s credentialId =
-      ToWauthnConstBuff(testContents.credentialRawId);
-
-  wauthn_pubkey_cred_descriptor_s pubkeyCredDescriptor;
-  pubkeyCredDescriptor.type = PCT_PUBLIC_KEY;
-  pubkeyCredDescriptor.id = &credentialId;
-  pubkeyCredDescriptor.transports = testContents.transports;
-
-  wauthn_pubkey_cred_descriptors_s pubkeyCredDescriptors;
-  pubkeyCredDescriptors.size = 1;
-  pubkeyCredDescriptors.descriptors = &pubkeyCredDescriptor;
-
-  wauthn_const_buffer_s contactId;
-  wauthn_const_buffer_s linkId;
-  wauthn_const_buffer_s linkSecret;
-  wauthn_const_buffer_s authenticatorPubKey;
-  wauthn_const_buffer_s authenticatorName;
-  wauthn_const_buffer_s signature;
-  wauthn_const_buffer_s tunnelServerDomain;
-  wauthn_const_buffer_s identityKey;
-
-  wauthn_hybrid_linked_data_s linkedDevice;
-  if (testContents.linkedData) {
-    std::cout << "linkedData is exist" << std::endl;
-    contactId = ToWauthnConstBuff(testContents.linkedData->contactId);
-    linkId = ToWauthnConstBuff(testContents.linkedData->linkId);
-    linkSecret = ToWauthnConstBuff(testContents.linkedData->linkSecret);
-    authenticatorPubKey =
-        ToWauthnConstBuff(testContents.linkedData->authenticatorPubKey);
-    authenticatorName =
-        ToWauthnConstBuff(testContents.linkedData->authenticatorName);
-    signature = ToWauthnConstBuff(testContents.linkedData->signature);
-    tunnelServerDomain =
-        ToWauthnConstBuff(testContents.linkedData->tunnelServerDomain);
-    identityKey = ToWauthnConstBuff(testContents.linkedData->identityKey);
-
-    linkedDevice.contact_id = &contactId;
-    linkedDevice.link_id = &linkId;
-    linkedDevice.link_secret = &linkSecret;
-    linkedDevice.authenticator_pubkey = &authenticatorPubKey;
-    linkedDevice.authenticator_name = &authenticatorName;
-    linkedDevice.signature = &signature;
-    linkedDevice.tunnel_server_domain = &tunnelServerDomain;
-    linkedDevice.identity_key = &identityKey;
-  }
-
-  std::memset(&gaOptions, 0, sizeof(gaOptions));  // For future compatibility.
-  gaOptions.timeout = 120000;                     // 120s
-  gaOptions.rpId = options->relying_party_id.c_str();
-  gaOptions.user_verification = UVR_REQUIRED;
-  gaOptions.allow_credentials = std::move(&pubkeyCredDescriptors);
-  gaOptions.hints = nullptr;
-  gaOptions.attestation = AP_NONE;
-  gaOptions.attestation_formats = nullptr;
-  gaOptions.extensions = nullptr;
-  gaOptions.linked_device = testContents.linkedData ? &linkedDevice : nullptr;
-
-  gaCallbacks.qrcode_callback = DisplayQRCallback;
-  gaCallbacks.response_callback = GACallback;
-  gaCallbacks.linked_data_callback = GAUpdateLinkedDataCallback;
-  gaCallbacks.user_data = this;
-
-  int ret = wauthn_get_assertion(&gaClientData, &gaOptions, &gaCallbacks);
+  PopulateGAWebauthnArgs(std::move(options));
+  wauthn_get_assertion(&ga_client_data_, &ga_options_, &ga_callbacks_);
 }
 
 void AuthenticatorCommonTizen::IsUserVerifyingPlatformAuthenticatorAvailable(
@@ -1734,440 +1807,6 @@ void AuthenticatorCommonTizen::Cancel() {
   CancelWithStatus(blink::mojom::AuthenticatorStatus::ABORT_ERROR);
 }
 
-void AuthenticatorCommonTizen::OnRegisterResponse(
-    device::MakeCredentialStatus status_code,
-    absl::optional<device::AuthenticatorMakeCredentialResponse> response_data,
-    const device::FidoAuthenticator* authenticator) {
-  if (!req_state_->request_handler) {
-    // Either the callback was called immediately and
-    // |req_state_->request_handler| has not yet been assigned (this is a bug),
-    // or a navigation caused the request to be canceled while a callback was
-    // enqueued.
-    return;
-  }
-
-  switch (status_code) {
-    case device::MakeCredentialStatus::kUserConsentButCredentialExcluded:
-    case device::MakeCredentialStatus::kWinInvalidStateError:
-      // Duplicate registration: the new credential would be created on an
-      // authenticator that already contains one of the credentials in
-      // |exclude_credentials|. If the request specified that only a platform
-      // authenticator was acceptable then we don't show an error message
-      // because there's no other authenticator that could be used for this
-      // request. Instead the RP learns of the result via the distinctive
-      // InvalidStateError result. This tells them that the platform
-      // authenticator is already registered with one of the credential IDs that
-      // they already know about.
-      //
-      // Windows already behaves like this and so its representation of
-      // InvalidStateError is handled this way too.
-      if (req_state_->make_credential_options->authenticator_attachment ==
-              device::AuthenticatorAttachment::kPlatform ||
-          status_code == device::MakeCredentialStatus::kWinInvalidStateError) {
-        CompleteMakeCredentialRequest(
-            blink::mojom::AuthenticatorStatus::CREDENTIAL_EXCLUDED, nullptr,
-            nullptr, Focus::kDoCheck);
-      } else {
-        SignalFailureToRequestDelegate(
-            AuthenticatorRequestClientDelegate::InterestingFailureReason::
-                kKeyAlreadyRegistered,
-            blink::mojom::AuthenticatorStatus::CREDENTIAL_EXCLUDED);
-      }
-      return;
-    case device::MakeCredentialStatus::kAuthenticatorResponseInvalid:
-      // The response from the authenticator was corrupted.
-      CompleteMakeCredentialRequest(
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR, nullptr,
-          nullptr, Focus::kDoCheck);
-      return;
-    case device::MakeCredentialStatus::kHybridTransportError:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kHybridTransportError,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kUserConsentDenied:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kUserConsentDenied,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kSoftPINBlock:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kSoftPINBlock,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kHardPINBlock:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kHardPINBlock,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kAuthenticatorRemovedDuringPINEntry:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kAuthenticatorRemovedDuringPINEntry,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kAuthenticatorMissingResidentKeys:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kAuthenticatorMissingResidentKeys,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kAuthenticatorMissingUserVerification:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kAuthenticatorMissingUserVerification,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kAuthenticatorMissingLargeBlob:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kAuthenticatorMissingLargeBlob,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kNoCommonAlgorithms:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kNoCommonAlgorithms,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kStorageFull:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kStorageFull,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kWinNotAllowedError:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kWinUserCancelled,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::MakeCredentialStatus::kSuccess:
-      break;
-  }
-
-  DCHECK(response_data.has_value());
-  DCHECK(authenticator);
-
-  req_state_->request_delegate->OnTransactionSuccessful(
-      RequestSource(), device::FidoRequestType::kMakeCredential,
-      authenticator->GetType());
-
-  absl::optional<device::FidoTransportProtocol> transport =
-      authenticator->AuthenticatorTransport();
-  bool is_transport_used_internal = false;
-  bool is_transport_used_cable = false;
-  if (transport) {
-    is_transport_used_internal =
-        *transport == device::FidoTransportProtocol::kInternal;
-    is_transport_used_cable =
-        *transport == device::FidoTransportProtocol::kHybrid;
-  }
-
-  absl::optional<device::DevicePublicKeyOutput> device_public_key_output =
-      response_data->GetDevicePublicKeyResponse();
-  const bool have_enterprise_attestation =
-      response_data->enterprise_attestation_returned ||
-      (device_public_key_output &&
-       device_public_key_output->enterprise_attestation_returned);
-  const bool device_public_key_included_attestation =
-      device_public_key_output &&
-      device_public_key_output->attestation_format !=
-          device::kNoneAttestationValue;
-  const auto attestation =
-      req_state_->ctap_make_credential_request->attestation_preference;
-  absl::optional<AttestationErasureOption> attestation_erasure;
-
-  if (response_data->attestation_should_be_filtered &&
-      !GetWebAuthenticationDelegate()->ShouldPermitIndividualAttestation(
-          GetBrowserContext(), req_state_->caller_origin,
-          req_state_->relying_party_id)) {
-    attestation_erasure = AttestationErasureOption::kEraseAttestationAndAaguid;
-  } else if (attestation == device::AttestationConveyancePreference::
-                                kEnterpriseApprovedByBrowser) {
-    // If enterprise attestation was approved by policy then it can be
-    // returned immediately.
-    attestation_erasure = AttestationErasureOption::kIncludeAttestation;
-  } else if (attestation == device::AttestationConveyancePreference::
-                                kEnterpriseIfRPListedOnAuthenticator &&
-             !response_data->enterprise_attestation_returned) {
-    // If enterprise attestation was requested, not approved by policy, and
-    // not approved by the authenticator, then any attestation is stripped.
-    attestation_erasure = AttestationErasureOption::kEraseAttestationAndAaguid;
-  } else if (is_transport_used_cable) {
-    // Attestation is not returned when caBLEv2 is used, but the AAGUID is
-    // maintained.
-    attestation_erasure =
-        AttestationErasureOption::kEraseAttestationButIncludeAaguid;
-  } else if (is_transport_used_internal) {
-    // Direct attestation from platform authenticators is known to be
-    // privacy preserving, so we always return it when requested. Also,
-    // counter to what the WebAuthn spec says, we do not erase the AAGUID
-    // even when attestation wasn't requested.
-    attestation_erasure =
-        attestation != device::AttestationConveyancePreference::kNone
-            ? AttestationErasureOption::kIncludeAttestation
-            : AttestationErasureOption::kEraseAttestationButIncludeAaguid;
-  } else if (attestation == device::AttestationConveyancePreference::kNone &&
-             response_data->attestation_object.IsSelfAttestation()) {
-    attestation_erasure = AttestationErasureOption::kIncludeAttestation;
-  } else if (attestation == device::AttestationConveyancePreference::kNone) {
-    attestation_erasure = AttestationErasureOption::kEraseAttestationAndAaguid;
-  }
-
-  if (attestation_erasure.has_value() &&
-      // If a DPK attestation was requested then we show a prompt. (If
-      // the RP ID is allowlisted by policy then the prompt will be
-      // resolved immediately and never actually shown.)
-      !req_state_->device_public_key_attestation_requested) {
-#if (0)
-    CompleteMakeCredentialRequest(
-        blink::mojom::AuthenticatorStatus::SUCCESS,
-        CreateMakeCredentialResponse(std::move(*response_data),
-                                     *attestation_erasure),
-        nullptr, Focus::kDoCheck);
-#endif
-  } else {
-    req_state_->awaiting_attestation_response = true;
-    req_state_->request_delegate->ShouldReturnAttestation(
-        req_state_->relying_party_id, authenticator,
-        have_enterprise_attestation,
-        base::BindOnce(
-            &AuthenticatorCommonTizen::OnRegisterResponseAttestationDecided,
-            weak_factory_.GetWeakPtr(),
-            attestation_erasure.value_or(
-                AttestationErasureOption::kIncludeAttestation),
-            device_public_key_output.has_value(),
-            device_public_key_included_attestation, std::move(*response_data)));
-  }
-}
-
-void AuthenticatorCommonTizen::OnRegisterResponseAttestationDecided(
-    AttestationErasureOption attestation_erasure,
-    const bool has_device_public_key_output,
-    const bool device_public_key_included_attestation,
-    device::AuthenticatorMakeCredentialResponse response_data,
-    bool attestation_permitted) {
-  req_state_->awaiting_attestation_response = false;
-  if (!req_state_->request_handler) {
-    // The request has already been cleaned up, probably because a navigation
-    // occurred while the permissions prompt was pending.
-    return;
-  }
-
-  if (!attestation_permitted) {
-    attestation_erasure = AttestationErasureOption::kEraseAttestationAndAaguid;
-  }
-
-  // The check for IsAttestationCertificateInappropriatelyIdentifying is
-  // performed after the permissions prompt, even though we know the answer
-  // before, because this still effectively discloses the make & model of
-  // the authenticator: If an RP sees a "none" attestation from Chrome after
-  // requesting direct attestation then it knows that it was one of the
-  // tokens with inappropriate certs.
-  if (response_data.attestation_object
-          .IsAttestationCertificateInappropriatelyIdentifying() &&
-      !GetWebAuthenticationDelegate()->ShouldPermitIndividualAttestation(
-          GetBrowserContext(), req_state_->caller_origin,
-          req_state_->relying_party_id)) {
-    // The attestation response is incorrectly individually identifiable, but
-    // the consent is for make & model information about a token, not for
-    // individually-identifiable information. Erase the attestation to stop it
-    // begin a tracking signal.
-
-    // The only way to get the underlying attestation will be to list the RP ID
-    // in the enterprise policy, because that enables the individual attestation
-    // bit in the register request and permits individual attestation generally.
-    attestation_erasure = AttestationErasureOption::kEraseAttestationAndAaguid;
-  }
-#if (0)
-  CompleteMakeCredentialRequest(
-      blink::mojom::AuthenticatorStatus::SUCCESS,
-      CreateMakeCredentialResponse(std::move(response_data),
-                                   attestation_erasure),
-      nullptr, Focus::kDoCheck);
-#endif
-}
-
-void AuthenticatorCommonTizen::OnSignResponse(
-    device::GetAssertionStatus status_code,
-    absl::optional<std::vector<device::AuthenticatorGetAssertionResponse>>
-        response_data,
-    device::FidoAuthenticator* authenticator) {
-  DCHECK(!response_data || !response_data->empty());  // empty vector is invalid
-  if (!req_state_->request_handler) {
-    // Either the callback was called immediately and
-    // |req_state_->request_handler| has not yet been assigned (this is a bug),
-    // or a navigation caused the request to be canceled while a callback was
-    // enqueued.
-    return;
-  }
-
-  switch (authenticator->GetType()) {
-    case device::AuthenticatorType::kChromeOS:
-      req_state_->get_assertion_result =
-          status_code == device::GetAssertionStatus::kSuccess
-              ? GetAssertionResult::kChromeOSSuccess
-              : GetAssertionResult::kChromeOSError;
-      break;
-    case device::AuthenticatorType::kEnclave:
-      req_state_->get_assertion_result =
-          status_code == device::GetAssertionStatus::kSuccess
-              ? GetAssertionResult::kEnclaveSuccess
-              : GetAssertionResult::kEnclaveError;
-      break;
-    case device::AuthenticatorType::kICloudKeychain:
-      req_state_->get_assertion_result =
-          status_code == device::GetAssertionStatus::kSuccess
-              ? GetAssertionResult::kICloudKeychainSuccess
-              : GetAssertionResult::kICloudKeychainError;
-      break;
-    case device::AuthenticatorType::kOther:
-      req_state_->get_assertion_result =
-          status_code == device::GetAssertionStatus::kSuccess
-              ? GetAssertionResult::kOtherSuccess
-              : GetAssertionResult::kOtherError;
-      break;
-    case device::AuthenticatorType::kPhone:
-      req_state_->get_assertion_result =
-          status_code == device::GetAssertionStatus::kSuccess
-              ? GetAssertionResult::kPhoneSuccess
-              : GetAssertionResult::kPhoneError;
-      break;
-    case device::AuthenticatorType::kTouchID:
-      req_state_->get_assertion_result =
-          status_code == device::GetAssertionStatus::kSuccess
-              ? GetAssertionResult::kTouchIDSuccess
-              : GetAssertionResult::kTouchIDError;
-      break;
-    case device::AuthenticatorType::kWinNative:
-      req_state_->get_assertion_result =
-          status_code == device::GetAssertionStatus::kSuccess
-              ? GetAssertionResult::kWinNativeSuccess
-              : GetAssertionResult::kWinNativeError;
-      break;
-  }
-
-  switch (status_code) {
-    case device::GetAssertionStatus::kUserConsentButCredentialNotRecognized:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kKeyNotRegistered,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kAuthenticatorResponseInvalid:
-      // The response from the authenticator was corrupted.
-      CompleteGetAssertionRequest(
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kUserConsentDenied:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kUserConsentDenied,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kSoftPINBlock:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kSoftPINBlock,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kHardPINBlock:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kHardPINBlock,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kAuthenticatorRemovedDuringPINEntry:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kAuthenticatorRemovedDuringPINEntry,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kAuthenticatorMissingResidentKeys:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kAuthenticatorMissingResidentKeys,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kAuthenticatorMissingUserVerification:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kAuthenticatorMissingUserVerification,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kWinNotAllowedError:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kWinUserCancelled,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kHybridTransportError:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kHybridTransportError,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kICloudKeychainNoCredentials:
-      SignalFailureToRequestDelegate(
-          AuthenticatorRequestClientDelegate::InterestingFailureReason::
-              kNoPasskeys,
-          blink::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR);
-      return;
-    case device::GetAssertionStatus::kSuccess:
-      break;
-  }
-
-  DCHECK_EQ(status_code, device::GetAssertionStatus::kSuccess);
-  DCHECK(response_data.has_value());
-
-  req_state_->request_delegate->OnTransactionSuccessful(
-      RequestSource(), device::FidoRequestType::kGetAssertion,
-      authenticator->GetType());
-
-  // Show an account picker for discoverable credential requests (empty allow
-  // lists). Responses with a single credential are considered pre-selected if
-  // one of the following is true:
-  // - The authenticator omitted user entity information because only one
-  // credential matched (only valid in CTAP 2.0).
-  // - The `userSelected` flag is set, because the user chose an account on an
-  // integrated authenticator UI (CTAP 2.1).
-  // - The user already pre-selected a platform authenticator credential from
-  // browser UI prior to the actual GetAssertion request. (The request handler
-  // set the `userSelected` flag in this case.)
-  if (response_data->size() == 1) {
-    const device::AuthenticatorGetAssertionResponse& response =
-        response_data->at(0);
-    if (!req_state_->discoverable_credential_request ||
-        response.user_selected || !response.user_entity ||
-        !response.user_entity->name || !response.user_entity->display_name) {
-      OnAccountSelected(std::move(response_data->at(0)));
-      return;
-    }
-  }
-
-  // Discoverable credential request without preselection UI. Show an account
-  // picker.
-  std::vector<device::PublicKeyCredentialUserEntity> users_list;
-  users_list.reserve(response_data->size());
-  for (const auto& response : *response_data) {
-    if (response.user_entity) {
-      users_list.push_back(*response.user_entity);
-    }
-  }
-  req_state_->request_delegate->SelectAccount(
-      std::move(*response_data),
-      base::BindOnce(&AuthenticatorCommonTizen::OnAccountSelected,
-                     weak_factory_.GetWeakPtr()));
-}
-
-void AuthenticatorCommonTizen::OnAccountSelected(
-    device::AuthenticatorGetAssertionResponse response) {}
-
 void AuthenticatorCommonTizen::SignalFailureToRequestDelegate(
     AuthenticatorRequestClientDelegate::InterestingFailureReason reason,
     blink::mojom::AuthenticatorStatus status) {
@@ -2256,14 +1895,13 @@ AuthenticatorCommonTizen::CreateMakeCredentialResponse(
     AttestationErasureOption attestation_erasure) {
   auto response = blink::mojom::MakeCredentialAuthenticatorResponse::New();
   auto common_info = blink::mojom::CommonCredentialInfo::New();
+
   std::string client_data_json = reinterpret_cast<const char*>(
       pubkey_cred->response->client_data_json->data);
+
   common_info->client_data_json.assign(client_data_json.begin(),
                                        client_data_json.end());
-
-  common_info->raw_id =
-      std::vector<uint8_t>(pubkey_cred->rawId->data,
-                           pubkey_cred->rawId->data + pubkey_cred->rawId->size);
+  common_info->raw_id = ToBuffer(*(pubkey_cred->rawId));
   common_info->id = Base64UrlEncode(common_info->raw_id);
 
   device::FidoTransportProtocol transport_used;
@@ -2320,17 +1958,13 @@ AuthenticatorCommonTizen::CreateMakeCredentialResponse(
   }
 
   response->attestation_object =
-      std::vector<uint8_t>(pubkey_cred->response->attestation_object->data,
-                           pubkey_cred->response->attestation_object->data +
-                               pubkey_cred->response->attestation_object->size);
-
+      ToBuffer(*(pubkey_cred->response->attestation_object));
   common_info->authenticator_data =
-      std::vector<uint8_t>(pubkey_cred->response->authenticator_data->data,
-                           pubkey_cred->response->authenticator_data->data +
-                               pubkey_cred->response->authenticator_data->size);
+      ToBuffer(*(pubkey_cred->response->authenticator_data));
 
   response->info = std::move(common_info);
   response->public_key_algo = pubkey_cred->response->pubkey_alg;
+
   return response;
 }
 
@@ -2348,7 +1982,6 @@ void AuthenticatorCommonTizen::CompleteMakeCredentialRequest(
     std::move(req_state_->make_credential_response_callback)
         .Run(status, std::move(response), std::move(dom_exception_details));
   }
-
   Cleanup();
 }
 
@@ -2357,26 +1990,22 @@ AuthenticatorCommonTizen::CreateGetAssertionResponse(
     const wauthn_pubkey_credential_assertion_s* pubkey_cred) {
   auto response = blink::mojom::GetAssertionAuthenticatorResponse::New();
   auto common_info = blink::mojom::CommonCredentialInfo::New();
+
   std::string client_data_json = reinterpret_cast<const char*>(
       pubkey_cred->response->client_data_json->data);
+
   auto response_extensions =
       blink::mojom::AuthenticationExtensionsClientOutputs::New();
   common_info->client_data_json.assign(client_data_json.begin(),
                                        client_data_json.end());
-  common_info->raw_id =
-      std::vector<uint8_t>(pubkey_cred->rawId->data,
-                           pubkey_cred->rawId->data + pubkey_cred->rawId->size);
+  common_info->raw_id = ToBuffer(*(pubkey_cred->rawId));
   common_info->id = Base64UrlEncode(common_info->raw_id);
   response->info = std::move(common_info);
 
   response->info->authenticator_data =
-      std::vector<uint8_t>(pubkey_cred->response->authenticator_data->data,
-                           pubkey_cred->response->authenticator_data->data +
-                               pubkey_cred->response->authenticator_data->size);
-  response->signature =
-      std::vector<uint8_t>(pubkey_cred->response->signature->data,
-                           pubkey_cred->response->signature->data +
-                               pubkey_cred->response->signature->size);
+      ToBuffer(*(pubkey_cred->response->authenticator_data));
+  response->signature = ToBuffer(*(pubkey_cred->response->signature));
+
   response->authenticator_attachment =
       pubkey_cred->authenticator_attachment
           ? pubkey_cred->authenticator_attachment ==
@@ -2387,12 +2016,11 @@ AuthenticatorCommonTizen::CreateGetAssertionResponse(
 
   pubkey_cred->response->user_handle->size
       ? response->user_handle.emplace(
-            std::vector<uint8_t>(pubkey_cred->response->user_handle->data,
-                                 pubkey_cred->response->user_handle->data +
-                                     pubkey_cred->response->user_handle->size))
+            ToBuffer(*(pubkey_cred->response->user_handle)))
       : response->user_handle.emplace();
 
   response->extensions = std::move(response_extensions);
+
   return response;
 }
 
@@ -2437,9 +2065,6 @@ RenderFrameHost* AuthenticatorCommonTizen::GetRenderFrameHost() const {
 
 AuthenticatorRequestClientDelegate::RequestSource
 AuthenticatorCommonTizen::RequestSource() const {
-  if (serving_requests_for_ == ServingRequestsFor::kInternalUses) {
-    return AuthenticatorRequestClientDelegate::RequestSource::kInternal;
-  }
   if (req_state_->is_payment_request) {
     return AuthenticatorRequestClientDelegate::RequestSource::
         kSecurePaymentConfirmation;
@@ -2451,26 +2076,6 @@ BrowserContext* AuthenticatorCommonTizen::GetBrowserContext() const {
   return GetRenderFrameHost()->GetBrowserContext();
 }
 
-device::FidoDiscoveryFactory* AuthenticatorCommonTizen::discovery_factory() {
-  DCHECK(req_state_->discovery_factory);
-  return req_state_->discovery_factory_testing_override
-             ? req_state_->discovery_factory_testing_override.get()
-             : req_state_->discovery_factory.get();
-}
-
-void AuthenticatorCommonTizen::InitDiscoveryFactory() {
-  req_state_->discovery_factory = MakeDiscoveryFactory(GetRenderFrameHost());
-  // TODO(martinkr): |discovery_factory_testing_override_| is a long-lived
-  // VirtualFidoDeviceDiscovery so that tests can maintain and alter virtual
-  // authenticator state in between requests. We should extract a longer-lived
-  // configuration object from VirtualFidoDeviceDiscovery, so we can simply
-  // stick a short-lived instance into |discovery_factory_| and eliminate
-  // |discovery_factory_testing_override_|.
-  req_state_->discovery_factory_testing_override =
-      AuthenticatorEnvironment::GetInstance()
-          ->MaybeGetDiscoveryFactoryTestOverride();
-}
-
 void AuthenticatorCommonTizen::EnableRequestProxyExtensionsAPISupport() {
   enable_request_proxy_api_ = true;
 }
index 28ceca7bdf63af1568e80e692ad2e73d3d64ab9c..be0d55bc0a97aae1369105b9a921489d9bf817b7 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef AUTHENTICATOR_COMMON_TIZEN_H_
 #define AUTHENTICATOR_COMMON_TIZEN_H_
 
-#include <mv_barcode.h>
 #include <stdint.h>
 #include <webauthn.h>
 
 #include "third_party/abseil-cpp/absl/types/optional.h"
 #include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
 
-namespace device {
-
-class FidoDiscoveryFactory;
-
-enum class FidoReturnCode : uint8_t;
-
-enum class GetAssertionStatus;
-enum class MakeCredentialStatus;
-
-}  // namespace device
-
 namespace url {
 class Origin;
 }  // namespace url
@@ -47,16 +35,6 @@ enum class AttestationErasureOption;
 // Common code for any WebAuthn Authenticator interfaces.
 class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
  public:
-  // ServingRequestsFor enumerates the sources of WebAuthn requests.
-  enum class ServingRequestsFor {
-    // kInternalUses is for synthesized requests that don't originate from
-    // any Javascript call.
-    kInternalUses,
-    // kWebContents is for typical cases where Javascript is making a
-    // `navigator.credentials` call.
-    kWebContents,
-  };
-
   // These values are persisted to logs. Entries should not be renumbered and
   // numeric values should never be reused.
   enum class GetAssertionResult {
@@ -89,8 +67,7 @@ class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
 
   // Creates a new AuthenticatorCommonTizen. Callers must ensure that this
   // instance outlives the RenderFrameHost.
-  explicit AuthenticatorCommonTizen(RenderFrameHost* render_frame_host,
-                                    ServingRequestsFor serving_requests_for);
+  explicit AuthenticatorCommonTizen(RenderFrameHost* render_frame_host);
 
   AuthenticatorCommonTizen(const AuthenticatorCommonTizen&) = delete;
   AuthenticatorCommonTizen& operator=(const AuthenticatorCommonTizen&) = delete;
@@ -124,6 +101,10 @@ class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
   void EnableRequestProxyExtensionsAPISupport() override;
 
   // Webauthn:
+  void PopulateMCWebauthnArgs(
+      blink::mojom::PublicKeyCredentialCreationOptionsPtr options);
+  void PopulateGAWebauthnArgs(
+      blink::mojom::PublicKeyCredentialRequestOptionsPtr options);
   static void DisplayQRCallback(const char* qr_contents, void* data);
   static void MCCallback(
       const wauthn_pubkey_credential_attestation_s* pubkey_cred,
@@ -145,7 +126,6 @@ class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
   MaybeCreateRequestDelegate();
 
  private:
-  friend class AuthenticatorImplTest;
   struct RequestState;
 
   // Enumerates whether or not to check that the WebContents has focus.
@@ -154,42 +134,12 @@ class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
     kDontCheck,
   };
 
-  // Replaces the current |request_handler_| with a
-  // |MakeCredentialRequestHandler|, effectively restarting the request.
-  void StartMakeCredentialRequest(bool allow_skipping_pin_touch);
-
-  // Replaces the current |request_handler_| with a
-  // |GetAssertionRequestHandler|, effectively restarting the request.
-  void StartGetAssertionRequest(bool allow_skipping_pin_touch);
-
   bool IsFocused() const;
 
   void DispatchGetAssertionRequest(
       const std::string& authenticator_id,
       absl::optional<std::vector<uint8_t>> credential_id);
 
-  // Callback to handle the async response from a U2fDevice.
-  void OnRegisterResponse(
-      device::MakeCredentialStatus status_code,
-      absl::optional<device::AuthenticatorMakeCredentialResponse> response_data,
-      const device::FidoAuthenticator* authenticator);
-
-  // Callback to complete the registration process once a decision about
-  // whether or not to return attestation data has been made.
-  void OnRegisterResponseAttestationDecided(
-      AttestationErasureOption attestation_erasure,
-      const bool has_device_public_key_output,
-      const bool device_public_key_included_attestation,
-      device::AuthenticatorMakeCredentialResponse response_data,
-      bool attestation_permitted);
-
-  // Callback to handle the async response from a U2fDevice.
-  void OnSignResponse(
-      device::GetAssertionStatus status_code,
-      absl::optional<std::vector<device::AuthenticatorGetAssertionResponse>>
-          response_data,
-      device::FidoAuthenticator* authenticator);
-
   // Begins a timeout at the beginning of a request.
   void BeginRequestTimeout(absl::optional<base::TimeDelta> timeout);
 
@@ -202,11 +152,6 @@ class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
   // Runs when the user cancels WebAuthN request via UI dialog.
   void OnCancelFromUI();
 
-  // Called when a GetAssertion has completed, either because an allow_list was
-  // used and so an answer is returned directly, or because the user selected an
-  // account from the options.
-  void OnAccountSelected(device::AuthenticatorGetAssertionResponse response);
-
   // Signals to the request delegate that the request has failed for |reason|.
   // The request delegate decides whether to present the user with a visual
   // error before the request is finally resolved with |status|.
@@ -242,13 +187,6 @@ class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
   AuthenticatorRequestClientDelegate::RequestSource RequestSource() const;
   BrowserContext* GetBrowserContext() const;
 
-  // Returns the FidoDiscoveryFactory for the current request. This may be a
-  // real instance, or one injected by the Virtual Authenticator environment, or
-  // a unit testing fake. InitDiscoveryFactory() must be called before this
-  // accessor. It gets reset at the end of each request by Cleanup().
-  device::FidoDiscoveryFactory* discovery_factory();
-  void InitDiscoveryFactory();
-
   WebAuthenticationRequestProxy* GetWebAuthnRequestProxyIfActive(
       const url::Origin& caller_origin);
 
@@ -263,15 +201,60 @@ class CONTENT_EXPORT AuthenticatorCommonTizen : public AuthenticatorCommon {
       blink::mojom::GetAssertionAuthenticatorResponsePtr response);
 
   const GlobalRenderFrameHostId render_frame_host_id_;
-  const ServingRequestsFor serving_requests_for_;
   const scoped_refptr<WebAuthRequestSecurityChecker> security_checker_;
 
-  wauthn_client_data_s mcClientData;
-  wauthn_client_data_s gaClientData;
-  wauthn_pubkey_cred_creation_options_s mcOptions;
-  wauthn_pubkey_cred_request_options_s gaOptions;
-  wauthn_mc_callbacks_s mcCallbacks;
-  wauthn_ga_callbacks_s gaCallbacks;
+  wauthn_client_data_s mc_client_data_;
+  wauthn_client_data_s ga_client_data_;
+  wauthn_pubkey_cred_creation_options_s mc_options_;
+  wauthn_pubkey_cred_request_options_s ga_options_;
+  wauthn_mc_callbacks_s mc_callbacks_;
+  wauthn_ga_callbacks_s ga_callbacks_;
+
+  // Data members for mc_client_data
+  std::vector<unsigned char> client_data_vector_;
+  wauthn_const_buffer_s client_data_json_buff_;
+
+  // Data members for mc_options
+  wauthn_rp_entity_s rp_;
+  wauthn_user_entity_s user_;
+  wauthn_pubkey_cred_params_s pubkey_cred_params_;
+  wauthn_pubkey_cred_descriptors_s excluded_credentials_;
+  wauthn_attestation_formats_s mc_attestation_formats_;
+  wauthn_authenticator_sel_cri_s mc_authenticator_selection_criteria_;
+
+  // mc_options.rp
+  std::string rel_party_id_;
+  std::string rel_party_name_;
+
+  // mc_options.user
+  wauthn_const_buffer_s user_id_buff_;
+  std::vector<uint8_t> user_id_vector_;
+  std::string user_name_string_;
+  std::string user_display_name_string_;
+
+  // mc_options.pubkey_cred_params
+  std::vector<wauthn_pubkey_cred_param_s> params_vector_;
+
+  // mc_options.exclude_credentials
+  std::vector<wauthn_pubkey_cred_descriptor_s> excluded_creds_vector_;
+  std::vector<wauthn_const_buffer_s> excluded_creds_id_vector_;
+
+  // mc_options.attestation_formats
+  std::vector<std::string> mc_attestation_formats_string_vector_;
+  std::vector<wauthn_const_buffer_s> mc_attestation_formats_vector_;
+
+  // Data members for GA
+  std::string rp_id_string_;
+  std::vector<wauthn_pubkey_cred_descriptor_s> pubkey_cred_descriptor_vector_;
+  std::vector<wauthn_const_buffer_s> pubkey_cred_id_vector_;
+  wauthn_pubkey_cred_descriptors_s pubkey_cred_descriptors_;
+
+  wauthn_attestation_pref_e device_attestation_ = AP_NONE;
+  int num_attestation_formats_ = 0;
+
+  std::vector<std::string> ga_attestation_formats_string_vector_;
+  std::vector<wauthn_const_buffer_s> ga_attestation_formats_vector_;
+  wauthn_attestation_formats_s device_attestation_formats_;
 
   // These members hold state that spans different requests. All
   // request-specific state should go in `RequestState` to ensure that it's
index 897d3c27a77b99cac6690146fe68eacc69b7c6d0..800dff8893eb7942ed74917fed8e8737dee52fb7 100644 (file)
@@ -192,7 +192,8 @@ enum CallbackType {
   NotificationPermissionReply,
   FocusIn,
   FocusOut,
-  DisplayQRCode
+  DisplayQRCode,
+  CloseQRCode
 };
 
 template <CallbackType>
@@ -311,6 +312,7 @@ DECLARE_EWK_VIEW_CALLBACK(EdgeTop, "edge,top", void);
 DECLARE_EWK_VIEW_CALLBACK(EdgeBottom, "edge,bottom", void);
 DECLARE_EWK_VIEW_CALLBACK(EdgeRight, "edge,right", void);
 DECLARE_EWK_VIEW_CALLBACK(DisplayQRCode, "display,qr,code", const char*);
+DECLARE_EWK_VIEW_CALLBACK(CloseQRCode, "close,qr,code", void);
 #if BUILDFLAG(IS_TIZEN_TV)
 DECLARE_EWK_VIEW_CALLBACK(DownloadableFontInfo, "on,downloadable,font", void*);
 DECLARE_EWK_VIEW_CALLBACK(EdgeScrollBottom, "edge,scroll,bottom", bool*);
index e69de3c02b5ee73c6704f2717263bed666037891..aeb47d53b07829a6e6b8bd986944a0dea19c94f9 100644 (file)
@@ -1065,10 +1065,16 @@ void WebContentsDelegateEfl::UpdateTooltipUnderCursor(
 
 void WebContentsDelegateEfl::DisplayQRCode(std::string contents) {
   if (!web_view_) {
-    LOG(INFO) << "QR WebContentsDelegateEfl fail";
     return;
   }
   web_view_->SmartCallback<EWebViewCallbacks::DisplayQRCode>().call(
       contents.c_str());
 }
+
+void WebContentsDelegateEfl::CloseQRCode() {
+  if (!web_view_) {
+    return;
+  }
+  web_view_->SmartCallback<EWebViewCallbacks::CloseQRCode>().call();
+}
 }  // namespace content
index 8cea1c9ecdf415200d75d195aca8867227d2a203..a6188fa21e59725f4e89cf81376bf7e38823df18 100644 (file)
@@ -105,6 +105,7 @@ class WebContentsDelegateEfl : public WebContentsDelegate {
 #endif
   void UpdateTooltipUnderCursor(const std::u16string& text) override;
   void DisplayQRCode(std::string contents) override;
+  void CloseQRCode() override;
   void RequestCertificateConfirm(
       WebContents* web_contents,
       int cert_error,
index dbb9f2b7f598e872a7e642d58dc3455aa7932ac5..35ce9596e96b03ecadce534d9d6cf83bada678a0 100644 (file)
@@ -13,8 +13,6 @@ executable("ubrowser") {
   testonly = true
   configs += [ "//tizen_src/build:capi-system-device" ]
   configs += [ "//tizen_src/build:libcapi-system-device" ]
-  configs += [ "//tizen_src/build:capi-media-vision-barcode" ]
-  configs += [ "//tizen_src/build:libcapi-media-vision-barcode" ]
   public_configs = [ "//tizen_src/build:capi-system-device-public" ]
   configs += [ "//tizen_src/build:evas" ]
   configs += [ "//tizen_src/build:libevas" ]
@@ -68,6 +66,8 @@ executable("ubrowser") {
     configs += [ "//tizen_src/build:capi-appfw-application" ]
     configs += [ "//tizen_src/build/config/tizen:executable_config" ]
     configs += [ "//tizen_src/build:libcapi-appfw-application" ]
+    configs += [ "//tizen_src/build:capi-media-vision-barcode" ]
+    configs += [ "//tizen_src/build:libcapi-media-vision-barcode" ]
     if (tizen_product_tv) {
       configs += [ "//tizen_src/build:ecore-wayland" ]
       configs += [ "//tizen_src/build:libecore-wayland" ]
index a46af452bc7f6dc00582e78fe92dcad56cf71ec2..cb823d441fc4cdf044ca76cdcdd0b79e97e70566 100644 (file)
@@ -9,7 +9,6 @@
 #include <EWebKit_product.h>
 #include <Elementary.h>
 #include <assert.h>
-#include <mv_barcode.h>
 #include <vector>
 
 #include "browser.h"
@@ -20,6 +19,7 @@
 
 #if BUILDFLAG(IS_TIZEN)
 #include <efl_extension.h>
+#include <mv_barcode.h>
 #endif
 
 #if BUILDFLAG(IS_TIZEN_TV)
@@ -172,6 +172,8 @@ Window::Window(Browser& browser, int width, int height, bool incognito)
                                  &Window::OnBeforeFormRepostWarningShow, this);
   evas_object_smart_callback_add(web_view_, "display,qr,code",
                                  &Window::DisplayQRCode, this);
+  evas_object_smart_callback_add(web_view_, "close,qr,code",
+                                 &Window::CloseQRCode, this);
 
 #if BUILDFLAG(IS_TIZEN)
   if (IsTvProfile()) {
@@ -610,11 +612,9 @@ void Window::OnBeforeFormRepostWarningShow(void* data,
 
 void Window::DisplayQRCode(void* data, Evas_Object*, void* contents) {
   log_trace("%s", __PRETTY_FUNCTION__);
-
-  const char* qr_data = (const char*)data;
-  const char* qr_contents = (const char*)contents;
   const char* path = "/tmp/webauthn-qrcode.png";
-
+#if BUILDFLAG(IS_TIZEN)
+  const char* qr_contents = (const char*)contents;
   int ret;
   int width = 300;
   int height = 300;
@@ -633,7 +633,7 @@ void Window::DisplayQRCode(void* data, Evas_Object*, void* contents) {
     log_info("mv_barcode_generate_image failed with code %d", ret);
     return;
   }
-
+#endif  // BUILDFLAG(IS_TIZEN)
   Window* thiz = static_cast<Window*>(data);
 
   thiz->layout_ = elm_layout_add(thiz->window_);
@@ -658,15 +658,6 @@ void Window::DisplayQRCode(void* data, Evas_Object*, void* contents) {
   evas_object_resize(thiz->qr_window_, 600, 600);
   evas_object_show(thiz->qr_window_);
 
-  Evas_Object* btn = elm_button_add(thiz->qr_window_);
-  elm_object_text_set(btn, "close");
-  elm_object_style_set(btn, "bottom");
-  evas_object_resize(btn, 30, 30);
-  evas_object_move(btn, 820, 260);
-  evas_object_show(btn);
-  elm_object_part_content_set(thiz->layout_, "button1", btn);
-  evas_object_smart_callback_add(btn, "clicked", ClosePopup, thiz);
-
   Evas* e = evas_object_evas_get(thiz->qr_window_);
   thiz->qr_img_ = evas_object_image_add(e);
   evas_object_image_file_set(thiz->qr_img_, path, NULL);
@@ -676,7 +667,7 @@ void Window::DisplayQRCode(void* data, Evas_Object*, void* contents) {
   evas_object_show(thiz->qr_img_);
 }
 
-void Window::ClosePopup(void* data, Evas_Object*, void*) {
+void Window::CloseQRCode(void* data, Evas_Object*, void*) {
   Window* thiz = static_cast<Window*>(data);
   evas_object_del(thiz->qr_img_);
   evas_object_del(thiz->qr_window_);
index ceadb6fc5fb538e52f0e095baef828975a20c4c7..c61ccd2a1f1a45559d92c1e06dc7f2f216692550 100644 (file)
@@ -83,6 +83,7 @@ class Window {
   static void OnHostFocusedOut(void* data, Evas_Object*, void*);
   static void OnBeforeFormRepostWarningShow(void*, Evas_Object*, void*);
   static void DisplayQRCode(void*, Evas_Object*, void*);
+  static void CloseQRCode(void*, Evas_Object*, void*);
   static void ClosePopup(void*, Evas_Object*, void*);
   static void OnFormRepostWarningShow(void*, Evas_Object*, void*);
   static void OnUserFormRepostDecisionTaken(bool decision, void* data);