class MomoPay::Rsa

Constants

SKIP_KEYS

Attributes

data[R]
keys[R]

Public Class Methods

new(data) click to toggle source
# File lib/momo_pay/rsa.rb, line 6
def initialize(data)
  @data = data
end

Public Instance Methods

hash() click to toggle source
# File lib/momo_pay/rsa.rb, line 10
def hash
  Base64.encode64(rsa_public_key.public_encrypt(hash_json)).delete("\n")
end

Private Instance Methods

hash_json() click to toggle source
# File lib/momo_pay/rsa.rb, line 23
def hash_json
  data.select { |key, _| SKIP_KEYS.exclude?(key.to_s) }.to_json
end
rsa_public_key() click to toggle source
# File lib/momo_pay/rsa.rb, line 19
def rsa_public_key
  @rsa_public_key ||= OpenSSL::PKey::RSA.new(MomoPay.setup.public_key_pem)
end