Class: Devise::Passkeys::PasskeyIssuer

Inherits:
Object
  • Object
show all
Defined in:
lib/devise/passkeys/passkey_issuer.rb

Defined Under Namespace

Classes: CredentialFinder

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.buildObject



6
7
8
# File 'lib/devise/passkeys/passkey_issuer.rb', line 6

def self.build
  new
end

Instance Method Details

#create_and_return_passkey(resource:, label:, webauthn_credential:, extra_attributes: {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/devise/passkeys/passkey_issuer.rb', line 10

def create_and_return_passkey(resource:, label:, webauthn_credential:, extra_attributes: {})
  # rubocop:disable Lint/UselessAssignment
  passkey_class = passkey_class(resource)
  # rubocop:enable Lint/UselessAssignment

  resource.passkeys.create!({
    label: label,
    public_key: webauthn_credential.public_key,
    external_id: Base64.strict_encode64(webauthn_credential.raw_id),
    sign_count: webauthn_credential.sign_count,
    last_used_at: nil
  }.merge(extra_attributes))
end