Sha256: b4d916206a11e80bacac5af33ba8e2f028000b7a2f7ed5e208ba3cdcb1b4e3f6

Contents?: true

Size: 575 Bytes

Versions: 2

Compression:

Stored size: 575 Bytes

Contents

require "cbor"
require "cose/recipient"
require "cose/security_message"

module COSE
  class Mac < SecurityMessage
    attr_reader :payload, :tag, :recipients

    def self.keyword_arguments_for_initialize(decoded)
      {
        payload: CBOR.decode(decoded[0]),
        tag: decoded[1],
        recipients: decoded[2].map { |s| COSE::Recipient.deserialize(s) }
      }
    end

    def initialize(payload:, tag:, recipients:, **keyword_arguments)
      super(**keyword_arguments)

      @payload = payload
      @tag = tag
      @recipients = recipients
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cose-0.8.0 lib/cose/mac.rb
cose-0.7.0 lib/cose/mac.rb