Skip to content

Version 3.0

Choose a tag to compare

@jbtronics jbtronics released this 14 Aug 15:25
· 20 commits to master since this release

Version 3.0 (Upgrade to webauthn-lib 5)

Due to major changes in web-auth/webauthn-lib upgrading this library from 2 to 3 might require some manual intervention.

Changes

  • Use webauthn-lib 5
  • Use newer bundle directory structure
  • Use PHP file format for service configuration instead of yaml

Breaking changes

  • PHP 8.2 (or higher) required now
  • The webauthn-lib builtin doctrine entities changed its column definitions for transports and other_ui (from array to json). If you are using a webauthn key entity based on the webauthn-lib, then you will have to create a database migration to change the types. If you already have data in the table, then you will also need to migrate the format first. You can do this with a function similar to this in your doctrine migration:
public function convertArrayToJson(): void
    {
        $connection = $this->connection;
        $rows = $connection->fetchAllAssociative('SELECT id, transports, other_ui FROM webauthn_keys');

        foreach ($rows as $row) {
            $id = $row['id'];
            $new_transports = json_encode(unserialize($row['transports'], ['allowed_classes' => false]),
                JSON_THROW_ON_ERROR);
            $new_other_ui = json_encode(unserialize($row['other_ui'], ['allowed_classes' => false]),
                JSON_THROW_ON_ERROR);

            $connection->executeStatement(
                'UPDATE webauthn_keys SET transports = :transports, other_ui = :other_ui WHERE id = :id',
                [
                    'transports' => $new_transports,
                    'other_ui' => $new_other_ui,
                    'id' => $id,
                ]
            );
        }
    }