29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/concerns/koi/controller/has_webauthn.rb', line 29
def webauthn_registration_options_value
user = Koi::Current.admin_user.tap do |u|
u.update!(webauthn_id: WebAuthn.generate_user_id) unless u.webauthn_id
end
options = controller.webauthn_relying_party.options_for_registration(
user: {
id: user.webauthn_id,
name: user.email,
display_name: user.name,
},
exclude: user.credentials.pluck(:external_id),
)
session[:registration_challenge] = options.challenge
options
end
|