about summary refs log tree commit diff
path: root/app/controllers/api/v1/crypto/keys/counts_controller.rb
blob: ffd7151b78291e5eba5c71bb661b70fe36793bea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class Api::V1::Crypto::Keys::CountsController < Api::BaseController
  before_action -> { doorkeeper_authorize! :crypto }
  before_action :require_user!
  before_action :set_current_device

  def show
    render json: { one_time_keys: @current_device.one_time_keys.count }
  end

  private

  def set_current_device
    @current_device = Device.find_by!(access_token: doorkeeper_token)
  end
end