You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
605 B

  1. # frozen_string_literal: true
  2. class MessageFranking
  3. attr_reader :hmac, :source_account_id, :target_account_id,
  4. :timestamp, :original_franking
  5. def initialize(attributes = {})
  6. @hmac = attributes[:hmac]
  7. @source_account_id = attributes[:source_account_id]
  8. @target_account_id = attributes[:target_account_id]
  9. @timestamp = attributes[:timestamp]
  10. @original_franking = attributes[:original_franking]
  11. end
  12. def to_token
  13. crypt = ActiveSupport::MessageEncryptor.new(SystemKey.current_key, serializer: Oj)
  14. crypt.encrypt_and_sign(self)
  15. end
  16. end