Bnet::Authenticator

Ruby implementation of the Battle.net Mobile Authenticator.

Gem Version Dependency Status

Build Status

Coverage Status

Code Climate Coverage Status from Code Climate

FYI: Badge images provided by http://shields.io/

Installation

$ [sudo] gem install bnet-authenticator

Using the library

>> require 'bnet/authenticator'

Request a new authenticator

>> authenticator = Bnet::Authenticator.request_authenticator(:US)
=> {:serial=>"US-1405-0242-3258", :secret=>"778275450e5c3e092bc4fe901cd7c11241166c88", :restorecode=>"0WCRH9Z926", :region=>:US}

Get a token

>> authenticator.get_token
=> ["38530888", 1399038930]

Restore an authenticator from server

>> Bnet::Authenticator.restore_authenticator('CN-1402-1943-1283', '4CKBN08QEB')
=> {:serial=>"CN-1402-1943-1283", :secret=>"4202aa2182640745d8a807e0fe7e34b30c1edb23", :restorecode=>"4CKBN08QEB", :region=>:CN}

Initialize an authenticator with given serial and secret

>> Bnet::Authenticator.new('CN-1402-1943-1283', '4202aa2182640745d8a807e0fe7e34b30c1edb23')
=> {:serial=>"CN-1402-1943-1283", :secret=>"4202aa2182640745d8a807e0fe7e34b30c1edb23", :restorecode=>"4CKBN08QEB", :region=>:CN}

Using the command-line tool

Run bna and follow instructions.