Class: Artaius::Plugins::Identify
- Inherits:
-
Object
- Object
- Artaius::Plugins::Identify
- Includes:
- Cinch::Plugin
- Defined in:
- lib/artaius/plugins/identify.rb
Overview
The plugin handles authentication via CHALLENGEAUTH. It requires two parameters: username and password of the bot. For details go here: www.quakenet.org/development/challengeauth/
Constant Summary collapse
- Q =
Internal: Q bot of QuakeNet. Nine times out of ten you write him a PM.
'[email protected]'
Instance Method Summary collapse
-
#challengeauth(m, challenge) ⇒ Object
Internal: Authenticate bot with safe CHALLENGEAUTH method.
-
#send_challenge(m) ⇒ Object
Internal: Identify a bot with Q.
Instance Method Details
#challengeauth(m, challenge) ⇒ Object
Internal: Authenticate bot with safe CHALLENGEAUTH method.
m - The recieved message. challenge - The CHALLENGE parameter, given by Q bot.
Returns nothing.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/artaius/plugins/identify.rb', line 40 def challengeauth(m, challenge) # Q is the only trusted user. return unless m.user && m.user.nick == 'Q' debug I18n.identify.challenge(challenge) username = config[:username].irc_downcase(:rfc1459) password = config[:password][0, 10] sha256 = OpenSSL::Digest::SHA256.new key = sha256.hexdigest("#{ username }:#{ sha256.hexdigest(password) }") response = OpenSSL::HMAC.hexdigest('SHA256', key, challenge) User(Q).privmsg("CHALLENGEAUTH #{ username } #{ response } HMAC-SHA-256") end |