class PlayMarket::Client

Constants

GOOGLE_PLAY_PUBLIC_KEY

Attributes

google_api_client[R]
verification_url[RW]

Public Instance Methods

verify!(data, signature) click to toggle source
# File lib/play_market/client.rb, line 13
def verify!(data, signature)
  key.verify(digest, Base64.decode64(signature), data) or raise VerificationError, "The receipt could not be authenticated."
  PlayMarket::Receipt.new(JSON.parse(data))
end

Private Instance Methods

digest() click to toggle source
# File lib/play_market/client.rb, line 24
def digest
  OpenSSL::Digest::SHA1.new
end
key() click to toggle source
# File lib/play_market/client.rb, line 19
def key
  raise VerificationError, "Need to supply Google Play public key" unless GOOGLE_PLAY_PUBLIC_KEY
  OpenSSL::PKey::RSA.new(Base64.decode64(GOOGLE_PLAY_PUBLIC_KEY))
end