Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/webauthn/rails/credentials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def callback
)

credential = current_user.webauthn_credentials.find_or_initialize_by(
external_id: Base64.strict_encode64(webauthn_credential.raw_id)
external_id: webauthn_credential.id
)

if credential.update(
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/webauthn/rails/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def callback
)

user.webauthn_credentials.build(
external_id: Base64.strict_encode64(webauthn_credential.raw_id),
external_id: webauthn_credential.id,
nickname: params[:credential_nickname],
public_key: webauthn_credential.public_key,
sign_count: webauthn_credential.sign_count
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/webauthn/rails/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def callback
user = User.find_by(username: session[:current_authentication][:username] || session[:current_authentication]["username"])
raise "user #{session[:current_authentication][:username]} never initiated sign up" unless user

stored_credential = user.webauthn_credentials.find_by(external_id: Base64.strict_encode64(webauthn_credential.raw_id))
stored_credential = user.webauthn_credentials.find_by(external_id: webauthn_credential.id)

begin
webauthn_credential.verify(
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/registrations_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
username: "bob",
webauthn_credentials: [
WebauthnCredential.new(
external_id: Base64.strict_encode64(webauthn_credential.raw_id),
external_id: webauthn_credential.id,
nickname: "Bob's USB Key",
public_key: webauthn_credential.public_key,
sign_count: webauthn_credential.sign_count
Expand Down