class ApplePay::PaymentToken
Attributes
token[RW]
Public Class Methods
new(token)
click to toggle source
# File lib/apple_pay/payment_token.rb, line 5 def initialize(token) self.token = token.with_indifferent_access end
Public Instance Methods
decrypt!(client_cert, private_key)
click to toggle source
# File lib/apple_pay/payment_token.rb, line 20 def decrypt!(client_cert, private_key) decrypted = EncryptedData.new( token[:paymentData][:data] ).decrypt!( client_cert, private_key, token[:paymentData][:header][:ephemeralPublicKey] ) JSON.parse decrypted end
verify!()
click to toggle source
# File lib/apple_pay/payment_token.rb, line 9 def verify! Signature.new( token[:paymentData][:signature], data: token[:paymentData][:data], ephemeral_public_key: token[:paymentData][:header][:ephemeralPublicKey], transaction_id: token[:paymentData][:header][:transactionId], application_data: token[:paymentData][:header][:applicationData] ).verify! self end