From b79c954d3bffc456c039333aef62e3534ab6156c Mon Sep 17 00:00:00 2001 From: f Date: Mon, 21 Mar 2022 13:30:39 -0300 Subject: [PATCH] =?UTF-8?q?verificar=20la=20transacci=C3=B3n=20guardada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/readings_controller.rb | 2 +- app/models/reading.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/readings_controller.rb b/app/controllers/readings_controller.rb index b12bce4..a558fcc 100644 --- a/app/controllers/readings_controller.rb +++ b/app/controllers/readings_controller.rb @@ -16,7 +16,7 @@ class ReadingsController < ActionController::API reading.id = params[:transaction_uuid] reading.signature = request.headers[:'X-Signature'] reading.raw_transaction = request.raw_post - reading.verified = reading.verify + reading.verified = reading.verify_ssh_signature params[:arduinos]&.each do |a| arduino = reading.arduinos.build local_id: a[:id], raspberry: raspberry diff --git a/app/models/reading.rb b/app/models/reading.rb index 342d1a4..0a6e31d 100644 --- a/app/models/reading.rb +++ b/app/models/reading.rb @@ -4,8 +4,8 @@ class Reading < ApplicationRecord belongs_to :raspberry has_many :arduinos - def verify - ssh_signature.verify transaction + def verify_ssh_signature + ssh_signature.verify raw_transaction rescue SSHData::Error false end