Class List Method List File List

# Class: ROTP::HOTP

Inherits:
  OTP
  - Object
  - OTP
  - ROTP::HOTP
  show all
Defined in:
  lib/rotp/hotp.rb

## Instance Method Summary (collapse)

- - (Object) at(count)
- - (String) provisioning_uri(name, start_count = 0)

  Returns the provisioning URI for the OTP This can then be encoded in a QR Code and used to provision the Google Authenticator app.

### Methods inherited from OTP

#byte_secret, #generate_otp, #initialize, #int_to_bytestring

## Constructor Details

This class inherits a constructor from ROTP::OTP

## Instance Method Details

- (`Object`) at(count)

    3
    4
    5
    # File 'lib/rotp/hotp.rb', line 3

    def at(count)
      generate_otp(count)
    end

- (`String`) provisioning_uri(name, start_count = 0)

Returns the provisioning URI for the OTP This can then be encoded in a QR Code and used to provision the Google Authenticator app

### Parameters:

- (`String`) name —

  of the account

- (`Integer`) initial —

  counter value, defaults to 0

### Returns:

- (`String`) —

  provisioning uri

    13
    14
    15
    # File 'lib/rotp/hotp.rb', line 13

    def provisioning_uri(name, start_count=0)
      "otpauth://hotp/#{URI.encode(name)}?secret=#{secret}&counter=#{start_count}"
    end