class Telegram::Auth::Verification

Attributes

error[R]

Public Class Methods

new(hash, fields) click to toggle source
# File lib/telegram/auth/verification.rb, line 7
def initialize(hash, fields)
  @fields = fields
  @hash = hash
end

Public Instance Methods

process() click to toggle source
# File lib/telegram/auth/verification.rb, line 12
def process
  Configuration.instance.validate! && check_sha && check_expiry
end

Private Instance Methods

check_expiry() click to toggle source
# File lib/telegram/auth/verification.rb, line 22
def check_expiry
  @error = ExpiredError.new("Expired") if @fields.expired?
  !@error
end
check_sha() click to toggle source
# File lib/telegram/auth/verification.rb, line 17
def check_sha
  @error = ShaError.new("Invalid hash") unless @hash.casecmp(@fields.hash) == 0
  !@error
end