/**
  * Ajax handler for quick edit saving for a security key.
  *
  * @since 0.1-dev
  *
  * @access public
  * @static
  */
 public static function wp_ajax_inline_save()
 {
     check_ajax_referer('keyinlineeditnonce', '_inline_edit');
     require TWO_FACTOR_DIR . 'providers/class.two-factor-fido-u2f-admin-list-table.php';
     $wp_list_table = new Two_Factor_FIDO_U2F_Admin_List_Table();
     if (!isset($_POST['keyHandle'])) {
         wp_die();
     }
     $user_id = get_current_user_id();
     $security_keys = Two_Factor_FIDO_U2F::get_security_keys($user_id);
     if (!$security_keys) {
         wp_die();
     }
     foreach ($security_keys as &$key) {
         if ($key->keyHandle === $_POST['keyHandle']) {
             break;
         }
     }
     $key->name = $_POST['name'];
     $updated = Two_Factor_FIDO_U2F::update_security_key($user_id, $key);
     if (!$updated) {
         wp_die(esc_html__('Item not updated.'));
     }
     $wp_list_table->single_row($key);
     wp_die();
 }
    /**
     * Display the security key section in a users profile.
     *
     * This executes during the `show_user_profile` & `edit_user_profile` actions.
     *
     * @since 0.1-dev
     *
     * @access public
     * @static
     *
     * @param WP_User $user WP_User object of the logged-in user.
     */
    public static function show_user_profile($user)
    {
        wp_nonce_field("user_security_keys-{$user->ID}", '_nonce_user_security_keys');
        $new_key = false;
        $security_keys = Two_Factor_FIDO_U2F::get_security_keys($user->ID);
        if ($security_keys) {
            foreach ($security_keys as &$security_key) {
                if (property_exists($security_key, 'new')) {
                    $new_key = true;
                    unset($security_key->new);
                    // If we've got a new one, update the db record to not save it there any longer.
                    Two_Factor_FIDO_U2F::update_security_key($user->ID, $security_key);
                }
            }
            unset($security_key);
        }
        ?>
		<div class="security-keys" id="security-keys-section">
			<h3><?php 
        esc_html_e('Security Keys');
        ?>
</h3>
			<p><?php 
        esc_html_e('FIDO U2F is only supported in Chrome 41+.');
        ?>
</p>
			<p><a href="https://support.google.com/accounts/answer/6103523"><?php 
        esc_html_e('You can find FIDO U2F Security Key devices for sale from here.');
        ?>
</a></p>
			<div class="register-security-key">
				<?php 
        if (Two_Factor_FIDO_U2F::is_browser_support()) {
            ?>
				<input type="hidden" name="do_new_security_key" id="do_new_security_key" />
				<input type="hidden" name="u2f_response" id="u2f_response" />
				<button type="button" class="button button-secondary" id="register_security_key"><?php 
            esc_html_e('Add New');
            ?>
</button>
				<?php 
        } else {
            ?>
				<p><?php 
            esc_html_e('Your browser doesn\'t support FIDO U2F.');
            ?>
</p>
				<?php 
        }
        ?>
			</div>

			<?php 
        if ($new_key) {
            ?>
			<p class="new-security-key"><?php 
            esc_html_e('Your new security key registered.');
            ?>
</p>
			<?php 
        }
        ?>

			<?php 
        require TWO_FACTOR_DIR . 'providers/class.two-factor-fido-u2f-admin-list-table.php';
        $u2f_list_table = new Two_Factor_FIDO_U2F_Admin_List_Table();
        $u2f_list_table->items = $security_keys;
        $u2f_list_table->prepare_items();
        $u2f_list_table->display();
        ?>
		</div>
		<?php 
    }