Skip to content

Commit 559db4c

Browse files
Remove now-unnecessary helpers (#115)
* Remove now-unnecessary helpers * Update CHANGELOG
1 parent e1d495f commit 559db4c

2 files changed

Lines changed: 1 addition & 71 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changed
66

77
- Options for getting or creating passkeys and security keys are now served by dedicated Rails controllers and retrieved via JavaScript fetch requests. [#73](https://github.com/cedarcode/devise-webauthn/pull/73) [@nicolastemciuc]
8+
- BREAKING!: Remove helpers for generating WebAuthn options. [#106](https://github.com/cedarcode/devise-webauthn/pull/115) [@nicolastemciuc]
89

910
## [v0.3.0](https://github.com/cedarcode/devise-webauthn/compare/v0.2.2...v0.3.0/) - 2026-01-16
1011

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
# rubocop:disable Metrics/ModuleLength
43
module Devise
54
module Webauthn
65
module CredentialsHelper
@@ -59,75 +58,6 @@ def login_with_security_key_button(text = nil, resource:, button_classes: nil, f
5958
end
6059
end
6160

62-
def create_passkey_options(resource)
63-
@create_passkey_options ||= begin
64-
options = WebAuthn::Credential.options_for_create(
65-
user: {
66-
id: resource.webauthn_id,
67-
name: resource_human_palatable_identifier
68-
},
69-
exclude: resource.passkeys.pluck(:external_id),
70-
authenticator_selection: {
71-
resident_key: "required",
72-
user_verification: "required"
73-
}
74-
)
75-
76-
# Store challenge in session for later verification
77-
session[:webauthn_challenge] = options.challenge
78-
79-
options
80-
end
81-
end
82-
83-
def passkey_authentication_options
84-
@passkey_authentication_options ||= begin
85-
options = WebAuthn::Credential.options_for_get(
86-
user_verification: "required"
87-
)
88-
89-
# Store challenge in session for later verification
90-
session[:authentication_challenge] = options.challenge
91-
92-
options
93-
end
94-
end
95-
96-
def create_security_key_options(resource)
97-
@create_security_key_options ||= begin
98-
options = WebAuthn::Credential.options_for_create(
99-
user: {
100-
id: resource.webauthn_id,
101-
name: resource_human_palatable_identifier
102-
},
103-
exclude: resource.webauthn_credentials.pluck(:external_id),
104-
authenticator_selection: {
105-
resident_key: "discouraged",
106-
user_verification: "discouraged"
107-
}
108-
)
109-
110-
# Store challenge in session for later verification
111-
session[:webauthn_challenge] = options.challenge
112-
113-
options
114-
end
115-
end
116-
117-
def security_key_authentication_options(resource)
118-
@security_key_authentication_options ||= begin
119-
options = WebAuthn::Credential.options_for_get(
120-
allow: resource.webauthn_credentials.pluck(:external_id),
121-
user_verification: "discouraged"
122-
)
123-
124-
# Store challenge in session for later verification
125-
session[:two_factor_authentication_challenge] = options.challenge
126-
127-
options
128-
end
129-
end
130-
13161
private
13262

13363
def resource_human_palatable_identifier
@@ -139,4 +69,3 @@ def resource_human_palatable_identifier
13969
end
14070
end
14171
end
142-
# rubocop:enable Metrics/ModuleLength

0 commit comments

Comments
 (0)