Class: ApplePay::PaymentToken::Signature
- Inherits:
-
Object
- Object
- ApplePay::PaymentToken::Signature
- Defined in:
- lib/apple_pay/payment_token/signature.rb
Defined Under Namespace
Classes: VerificationFailed
Instance Attribute Summary collapse
-
#application_data ⇒ Object
Returns the value of attribute application_data.
-
#data ⇒ Object
Returns the value of attribute data.
-
#ephemeral_public_key ⇒ Object
Returns the value of attribute ephemeral_public_key.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#wrapped_key ⇒ Object
Returns the value of attribute wrapped_key.
Instance Method Summary collapse
-
#initialize(signature, data:, ephemeral_public_key: nil, wrapped_key: nil, transaction_id:, application_data: nil) ⇒ Signature
constructor
A new instance of Signature.
- #verify! ⇒ Object
Constructor Details
#initialize(signature, data:, ephemeral_public_key: nil, wrapped_key: nil, transaction_id:, application_data: nil) ⇒ Signature
Returns a new instance of Signature.
8 9 10 11 12 13 14 15 |
# File 'lib/apple_pay/payment_token/signature.rb', line 8 def initialize(signature, data:, ephemeral_public_key: nil, wrapped_key: nil, transaction_id:, application_data: nil) self.signature = signature self.data = data self.ephemeral_public_key = ephemeral_public_key self.wrapped_key = wrapped_key self.transaction_id = transaction_id self.application_data = application_data end |
Instance Attribute Details
#application_data ⇒ Object
Returns the value of attribute application_data.
6 7 8 |
# File 'lib/apple_pay/payment_token/signature.rb', line 6 def application_data @application_data end |
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/apple_pay/payment_token/signature.rb', line 6 def data @data end |
#ephemeral_public_key ⇒ Object
Returns the value of attribute ephemeral_public_key.
6 7 8 |
# File 'lib/apple_pay/payment_token/signature.rb', line 6 def ephemeral_public_key @ephemeral_public_key end |
#signature ⇒ Object
Returns the value of attribute signature.
6 7 8 |
# File 'lib/apple_pay/payment_token/signature.rb', line 6 def signature @signature end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
6 7 8 |
# File 'lib/apple_pay/payment_token/signature.rb', line 6 def transaction_id @transaction_id end |
#wrapped_key ⇒ Object
Returns the value of attribute wrapped_key.
6 7 8 |
# File 'lib/apple_pay/payment_token/signature.rb', line 6 def wrapped_key @wrapped_key end |
Instance Method Details
#verify! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/apple_pay/payment_token/signature.rb', line 17 def verify! chain = CertificateChain.new signature signature_base_string = [ Base64.decode64(ephemeral_public_key || wrapped_key), Base64.decode64(data), [transaction_id].pack('H*'), [application_data].pack('H*') ].join chain.verify( signature_base_string ) or raise VerificationFailed end |