summaryrefslogtreecommitdiff
path: root/app/models/webauthn_registration.rb
blob: 71b50192e294fc59715cb1e5d94efdd1a5d6887d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

# Registration information for WebAuthn credentials

class WebauthnRegistration < ApplicationRecord
  belongs_to :user

  validates :credential_xid, :public_key, :counter, presence: true
  validates :name, length: { minimum: 0, allow_nil: false }
  validates :counter,
            numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 2**32 - 1 }
end