class Monban::UseCase::Auth::Verify::Authy

Public Instance Methods

verify(params) click to toggle source
# File lib/monban/use_case/auth/verify/authy.rb, line 20
def verify(params)
  Getto::Params.new.validate(params) do |v|
    v.hash(
      account_id:  v.integer                         {|val| param_error!(account_id: val) },
      authy_token: v.combine([v.string, v.not_empty]){|val| param_error!(authy_token: val) },
    )
  end or param_error!(params: params)

  authy_id = repository.authy_id(
    account_id: params[:account_id],
  ) or error.invalid_account! "account_id: #{params[:account_id]}"

  authy.verify(
    authy_id:    authy_id,
    authy_token: params[:authy_token],
  ) or error.invalid_account! "authy_token unmatched: #{authy_id}/#{params[:authy_token]}"

  nil
end