# frozen_string_literal: true

require 'sequel/extensions/blank'
require 'argon2'

class UserAuthenticator
  def initialize(user)
    @user = user
  end

  def authenticate(password)
    return false if password.blank? || @user.nil?
    @user if Argon2::Password.verify_password(password, @user.hashed_password)
  end
end
