Class: Ebay::NotificationApi::Verifier::MessageValidator
- Inherits:
-
Object
- Object
- Ebay::NotificationApi::Verifier::MessageValidator
- Defined in:
- lib/ebay/notification_api/verifier/message_validator.rb
Defined Under Namespace
Classes: WrongAlgorithm
Instance Method Summary collapse
-
#initialize(message, signature_header) ⇒ MessageValidator
constructor
A new instance of MessageValidator.
- #valid_message? ⇒ Boolean
Constructor Details
permalink #initialize(message, signature_header) ⇒ MessageValidator
Returns a new instance of MessageValidator.
9 10 11 12 |
# File 'lib/ebay/notification_api/verifier/message_validator.rb', line 9 def initialize(, signature_header) @signature_header = signature_header @message = end |
Instance Method Details
permalink #valid_message? ⇒ Boolean
14 15 16 17 18 |
# File 'lib/ebay/notification_api/verifier/message_validator.rb', line 14 def verifier = OpenSSL::PKey::EC.new(format_key(public_key_response["key"])) signature_base64 = Base64.decode64(signature_json["signature"]) verifier.verify(OpenSSL::Digest.new(DIGEST), signature_base64, @message.to_json) end |