Module: RocketChat::Realtime::Methods::Auth

Included in:
Client
Defined in:
lib/rocket_chat/realtime/methods/auth.rb

Overview

Auth methods

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#login(username, password) ⇒ Object

Login into server

Parameters:

  • username (String)
  • password (String)

Since:

  • 0.1.0



20
21
22
23
24
25
26
27
28
29
# File 'lib/rocket_chat/realtime/methods/auth.rb', line 20

def (username, password)
  method = Messages::Method.new(
    'login',
    user: { username: username },
    password: { algorithm: 'sha-256', digest: Digest::SHA256.hexdigest(password) }
  )
  AsyncTask.start(method.id) do
    driver.text(method.to_json)
  end
end