verificar la transacción guardada
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
9eab5ca0f6
commit
b79c954d3b
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue