INNER CODE UNIT · Ruby
secret
royshil/obs-backgroundremoval · scripts/ws_client.rb:104
secret = Base64.strict_encode64(Digest::SHA256.digest(password + salt))
auth_response = Base64.strict_encode64(Digest::SHA256.digest(secret + challenge))
send_packet({
"op" => 1,
"d" => { "rpcVersion" => 1, "authentication" => auth_response, "eventSubscriptions" => 0 }
})
end
identified = JSON.parse(receive_packet)
raise unless identified && identified['op'] == 2
end
def self.open(host, port, password)
instance = self.new
instance.connect host, port
instance.authenticate password
begin