INNER CODE UNIT · Ruby
call
royshil/obs-backgroundremoval · scripts/ws_client.rb:88
def call(type, data = {})
@seqnum += 1
send_request type, @seqnum, data
receive_response type, @seqnum
end
def close
@socket.close if @socket
end
def authenticate(password)
hello = JSON.parse(receive_packet)
if hello && hello['op'] == 0
salt = hello['d']['authentication']['salt']
challenge = hello['d']['authentication']['challenge']
secret = Base64.strict_encode64(Digest::SHA256.digest(password + salt))
auth_response = Base64.strict_encode64(Digest::SHA256.digest(secret + challenge))